Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Linker Problem: IMSL and GCC

Maia__Nycholas
Beginner
908 Views

Hi,

I'm a completly new user of ifort compiler and IMSL.

I got some Fortran-90 code running on Visual Studio 2008 (Windows).
This code depends of IMSL Library.

I would like to compile this legacy code to a fully static library - just one file called "my_lib.lib" and call their subroutines using C/C++.

I alreay read about ISO C BINDING, but my problem is the linker when some f90 files uses IMSL functions.

My followed steps:
1- Create a new Visual Studio Project -> Library -> Static Library
2- Add all *.f90 files (subroutines)
3- Add "ISO C BINDIND header" for each custom subroutine
4- Compile the static library and get the "my_lib.lib" using VS2008

Now I would like to link "my_lib.lib" with my C code.
I'm using MingW to do that:

gcc -o app_win.exe main.c -I "C:\Program Files (x86)\VNI\imsl\fnl600\IA32\include\static" -L "C:\Program Files (x86)\VNI\imsl\fnl600\IA32\lib" my_lib.lib

Console Errors:

undefined reference to `S_EVCCG'
undefined reference to `S_EPICG'
undefined reference to `UMACH'
undefined reference to `S_WRCRN1D'
undefined reference to `S_WRCRN'

Questions:
1- How can I link the static library "my_lib.lib" that contains IMSL functions using gcc/g++?
2- Is there any another cofigurations that I need to do in Visual Studio before compile the static library?
3- Is possible to put inside this static library all IMSL dependencies?

Thanks,
Nycholas Maia

0 Kudos
1 Solution
mecej4
Honored Contributor III
908 Views

Answering all your questions would take far more effort and time than is reasonable. The answers can be found by reading the documentation for Intel Fortran, MKL and IMSL. The team that is developing and preparing the IMSL-dependent library are the people who should be helping you with all these questions. If your company is unwilling to provide you with current versions of the software needed for your work, they should make other arrangements to instruct and support you in the task of getting the old tools to work.

With the setup that you have, you should set aside any thoughts of using gcc/gfortran to compile and link. Use VC (or Intel C, if you have it), to compile your C++ code. Use the ifort command to link with the IMSL libraries, by specifying %LINK_FNL% as a linker option. If using Visual Studio to build, there is a project setting that you need to choose to enable the IMSL libraries to be linked with.

I don't know if VS2019 will work with Ifort 11.1. In your position, I would just be content with getting the old tools to work, without attempting to mix in tools that are almost a decade newer.

View solution in original post

0 Kudos
4 Replies
mecej4
Honored Contributor III
908 Views

You did not mention why you are using GCC instead of MSVC or Intel-C together with IMSL FNL version 6, which is several years old. Secondly, you did not mention which Windows port of GCC you are using, if any, or whether you are using the MS Bash on Windows. In any case, any version of GCC + a version of IMSL FNL for Windows is an unsupported combination.

If you are going to do mixed language compilation with unsupported and potentially incompatible combinations of compilers and libraries, you will need a thorough understanding of the nature of static and dynamic libraries and the linking process.

The linking failed because you did not specify any of the IMSL libraries to be used by GCC in the link command.

The IMSL routines that were listed as undefined references can be easily replaced by corresponding Lapack routines that are available in MKL. Following this approach will let you bypass all the issues related to linking GCC code to IMSL.

My advice at this point:

  1. build an EXE using IFort and MSVC, not GCC
  2. run the code to obtain reference results
  3. only if necessary, build using GCC and overcome the GCC/IMSL incompatibilities, and
  4. run and check the results with those from 2.
0 Kudos
Maia__Nycholas
Beginner
908 Views

Thank you Mecej4, and sorry for my missing specs informations. Here we go:

In my local machine I have:
- Windows 10 x64
- Visual Studio 2008 IDE (yes...11 years old)
- Intel Fortran 11.1
- IMSL Library (x86 and x64)

I entered in this new job a few days ago and I would like to update all development software tools that could be possible without a bigger cost.

All the Fortran team are developing the math subroutines library using VS2008 + IMSL and they will give to me a single file (static library) that I will link/merge with my C/C++ main program ( that contains GUI, OpenGL, Read/Write files, etc).

I always worked in UNIX (Linux Ubuntu) environment using (gcc and g++) to compile and link everything. For that reason I was choosing compile and link my C/C++ and Fortran-90 aplication using gcc 8.2 or g++ 8.2 which are contained within in the latest version of MingW.

For my new Windows development environment, I would like to write my C/C++ code using Visual Studio Community 2019 (very good and free tool), but I'am not finding how to "install or add" the Intel Fortran 11.1 compiler inside the Visual Studio 2019 IDE. 

Question 1:
How can I use VS Community 2019 for C/C++ and Intel Fortran-90 development. Is this possible?

Another questions (may be to another topic):
I'am a bit confuse about the differences of these libraries:
1- Intel IMSL
2- Intel Parallel Studio XE
3- Intel Performance Libaries (free)
4- Intel Math Kernel (that's inside Performance Libraries)

Question 2:
Intel Performance Libraries already have the IMSL functions inside it? Can I uninstall de IMSL and replace it by Performace Libraries?

Question 3:
What are de differences between this 3 math libraries?

Question 4:
May be my company cannot pay enough to buy a ideal and complete new pack of development software like:
Visual Studio 2019 Professional + Parallel Studio XE 2019.

If my Fortran-90 team continue to develop their Fortran-90 subroutines using Visual Studio 2008 + IMSL, what will be the possible software problems that I will have?
May be no compatibility with some OS?
Or not good compile/link from x86 to x64 architecture?
Could you give a help?

Question 5:
Can I use the IMSL Library without Intel Fortran Compiler?
May be using gFortran?

Thanks,

0 Kudos
mecej4
Honored Contributor III
909 Views

Answering all your questions would take far more effort and time than is reasonable. The answers can be found by reading the documentation for Intel Fortran, MKL and IMSL. The team that is developing and preparing the IMSL-dependent library are the people who should be helping you with all these questions. If your company is unwilling to provide you with current versions of the software needed for your work, they should make other arrangements to instruct and support you in the task of getting the old tools to work.

With the setup that you have, you should set aside any thoughts of using gcc/gfortran to compile and link. Use VC (or Intel C, if you have it), to compile your C++ code. Use the ifort command to link with the IMSL libraries, by specifying %LINK_FNL% as a linker option. If using Visual Studio to build, there is a project setting that you need to choose to enable the IMSL libraries to be linked with.

I don't know if VS2019 will work with Ifort 11.1. In your position, I would just be content with getting the old tools to work, without attempting to mix in tools that are almost a decade newer.

0 Kudos
FortranFan
Honored Contributor II
908 Views

Maia, Nycholas wrote:

.. I entered in this new job a few days ago and I would like to update all development software tools that could be possible without a bigger cost.

..

For my new Windows development environment, I would like to write my C/C++ code using Visual Studio Community 2019 (very good and free tool), but I'am not finding how to "install or add" the Intel Fortran 11.1 compiler inside the Visual Studio 2019 IDE. 

Question 1:
How can I use VS Community 2019 for C/C++ and Intel Fortran-90 development. Is this possible? ..

@Nycholas Maia,

Have you reviewed the information made available by Intel on their IDZ sites e.g., their FAQ page on Intel Fortran?

https://software.intel.com/en-us/articles/intel-visual-fortran-composer-xe-information-and-frequently-asked-questions

For example, your question on Visual Studio is addressed in one of the links at the above page:

https://software.intel.com/en-us/articles/intel-parallel-studio-xe-compilers-required-microsoft-visual-studio

Same with IMSL.

Note also you may be able to use the Intel support site for direct queries: https://supporttickets.intel.com/?lang=en-US

By the way, I suggest you discuss cost considerations elsewhere, with your company, with Intel, with other vendors such as Microsoft, RogueWave, etc.  Same with usage restrictions e.g., whether Visual Studio Community Edition is allowed for use in your environment, perhaps not but that's between you, your company, and Microsoft to work out.

0 Kudos
Reply