- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
MacOS: High Sierra; Xcode: 10.1 ; Ifort: 18.0.5
Hi,
I have an issue building an application with intel18 on MacOS, which I do not have with gcc,
I have symbols defined in a module io, which are found by the compiler, but not from the linker.
Subroutine set_runtime_parameters() ! ======> in headers.a
…
use io,only:amr_log_file,output_dir
…
io.F90 is part of a headers.a library, which is passed to the linker, see below. Looking for a workaround, I copied the module files to the directory where the library headers.a is located, but it did not help. Do I miss a flag or something else? Any help is highly appreciated.
Thanks,
Ted
/opt/mpich321_intel18/bin/mpif90 -g -cpp -O0 -check bounds -check format -zero CMakeFiles/plotting.bin.dir/__/test_plotting.F90.o
-o /Users/tesari/lynx/build/intel18_mpich321/ep /bin/plotting.bin
-L/Users/tesari/lynx/build/intel18_mpich321/ep /lib -lheaders ! <==============
/opt/intel/compilers_and_libraries_2018.5.231/mac/compiler/lib/libirng.a
/opt/intel/compilers_and_libraries_2018.5.231/mac/compiler/lib/libdecimal.a -lc++
Undefined symbols for architecture x86_64:
"_io_mp_amr_log_file_", referenced from:
_amr_set_runtime_parameters_ in libparamesh.a(amr_set_runtime_parameters.F90.o)
"_io_mp_output_dir_", referenced from:
_amr_set_runtime_parameters_ in libparamesh.a(amr_set_runtime_parameters.F90.o)
ld: symbol(s) not found for architecture x86_64
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which compiler compiled this .o and the .a? I suggest simplifying the build, taking mpif90 out of the loop, until you get it built. Please note that you cannot mix Fortran compilers (such as gfortran and ifort) in an application.
The module files (.mod) are not referenced during the link step.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you compile a source.f90 file that contains a module it produces two or more output files: You have the .mod files (think of these as pre-compiled headers) and .o (.obj) files:
! ModuleTest.f90 ! ! FUNCTIONS: ! ModuleTest - Entry point of console application. ! !**************************************************************************** ! ! PROGRAM: ModuleTest ! ! PURPOSE: Entry point for the console application. ! !**************************************************************************** module ModuleWithProgram integer :: i_ModuleWithProgram contains subroutine sub_ModuleWithProgram print *,"ModuleWithProgram" end subroutine sub_ModuleWithProgram end module ModuleWithProgram program ModuleTest use ModuleWithProgram use ModuleOutsideProgram implicit none call sub_ModuleWithProgram call sub_ModuleOutsideProgram end program ModuleTest ====================================== ! Source1.f90 *** note name need not be same as module name module ModuleOutsideProgram integer :: i_ModuleOutsideProgram contains subroutine sub_ModuleOutsideProgram print *,"ModuleOutsideProgram" end subroutine sub_ModuleOutsideProgram end module ModuleOutsideProgram ================================ C:\test\ModuleTest\ModuleTest>dir /s/b C:\test\ModuleTest\ModuleTest\Debug C:\test\ModuleTest\ModuleTest\ModuleTest.f90 Source of PROGRAM containing a module C:\test\ModuleTest\ModuleTest\ModuleTest.vfproj C:\test\ModuleTest\ModuleTest\ReadMe.txt C:\test\ModuleTest\ModuleTest\Source1.f90 Source of auxilliary file containing a module C:\test\ModuleTest\ModuleTest\Debug\BuildLog.htm C:\test\ModuleTest\ModuleTest\Debug\moduleoutsideprogram.mod .mod file of module in Source of auxilliary file C:\test\ModuleTest\ModuleTest\Debug\ModuleTest.exe .exe file of complete program with auxilliary C:\test\ModuleTest\ModuleTest\Debug\ModuleTest.exe.intermediate.manifest C:\test\ModuleTest\ModuleTest\Debug\ModuleTest.obj .obj file of Source of PROGRAM containing a module C:\test\ModuleTest\ModuleTest\Debug\ModuleTest.pdb C:\test\ModuleTest\ModuleTest\Debug\modulewithprogram.mod .mod file created for module contained in Source of auxilliary file C:\test\ModuleTest\ModuleTest\Debug\Source1.obj .obj file for (all) modules contained in Source of auxilliary file C:\test\ModuleTest\ModuleTest\Debug\vc120.pdb
The above is from a Windows system, a similar layout occurs on Linux
You apparently are not linking in the .o file(s) that was(were) produced along with the module(s). Note, the .mod files take on the name of the module (one per module), the .o file(s) take on the file name containing the module(s).
Jim Dempsey
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page