Skip to content

Problem in linking libraries minpack/distributed #15

Description

@Crivella

I guess this is related to the comment by @paulatz in #13

When compiling with QE cmake, I end up incurring the following for several executables:

[ 98%] Linking Fortran executable ../../bin/d3_interpolate2.x
gmake[2]: *** [external/d3q/CMakeFiles/qe_d3_recenter_exe.dir/build.make:126: bin/d3_recenter.x] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:3121: external/d3q/CMakeFiles/qe_d3_recenter_exe.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
ld: libqe_thermal2.so: undefined reference to `plmdif'
collect2: error: ld returned 1 exit status

I checked and saw that this function is defined in minpack/distributed/plmdif.c.
After adding it to the same section in CMakeLists.txt as the minpack/lapackified functions i got other undefined references, so i added all .c files to the section but than encountered this

[ 98%] Linking Fortran shared library libqe_thermal2.so                                                                                                                                                                                                  
/home/crivella/.local/easybuild/software/binutils/2.40-GCCcore-12.3.0/bin/ld: CMakeFiles/qe_thermal2.dir/minpack/distributed/enorm.c.o: in function `enorm_':                                                                                            
enorm.c:(.text+0x10): multiple definition of `enorm_'; CMakeFiles/qe_thermal2.dir/minpack/lapackified/enorm.c.o:enorm.c:(.text+0x20): first defined here                                                                                                 
/home/crivella/.local/easybuild/software/binutils/2.40-GCCcore-12.3.0/bin/ld: warning: CMakeFiles/qe_thermal2.dir/thermal2/eos.f90.o: requires executable stack (because the .note.GNU-stack section is executable)                                      
collect2: error: ld returned 1 exit status 

So i tried to remove the enorm.c from distributed but than encountered undefined errors still leading to 2 undefined references

[100%] Linking Fortran executable ../../bin/d3_sparse.x                                                                                                                                                                                                  
/home/crivella/.local/easybuild/software/binutils/2.40-GCCcore-12.3.0/bin/ld: libqe_thermal2.so: undefined reference to `enorm'                                                                                                                          
collect2: error: ld returned 1 exit status                                                                                                                                                                                                               
make[3]: *** [external/d3q/CMakeFiles/qe_d3_qq2rr_exe.dir/build.make:126: bin/d3_qq2rr.x] Error 1                                                                                                                                                        
make[2]: *** [CMakeFiles/Makefile2:3035: external/d3q/CMakeFiles/qe_d3_qq2rr_exe.dir/all] Error 2 
[100%] Linking Fortran executable ../../bin/d3_qha.x                                                                                                                                                                                                     
/home/crivella/.local/easybuild/software/binutils/2.40-GCCcore-12.3.0/bin/ld: CMakeFiles/qe_d3_qha_exe.dir/thermal2/PROGRAM_qha.f90.o: undefined reference to symbol 'remove_stack_limit_'                                                               
/home/crivella/.local/easybuild/software/binutils/2.40-GCCcore-12.3.0/bin/ld: /home/crivella/Codes/QE/7.3-cmake/_build/Modules/libqe_modules_c.so: error adding symbols: DSO missing from command line 

EDIT: The remove_stack_limit_ one should be related to a separate non d3q specific problem, but the enorm one still blocks the compilation.


EDIT2: Actually not necessarily, I am seeing that in QE, calls to remove_stack_limit are enabled at the precompiler level only when using an intel compiler

#if defined(__INTEL_COMPILER)
  CALL remove_stack_limit ( )
#endif

while here (for example

CALL remove_stack_limit()
) they are not.
So this might be the cause for at least this specific error


EDIT3: NVM i think this is a QE problem (see https://gitlab.com/QEF/q-e/-/issues/667), but it might still be worth looking into whether this function should only be called when running with intel or not


If i instead remove the one from lapackified i encounter this

/home/crivella/.local/easybuild/software/binutils/2.40-GCCcore-12.3.0/bin/ld: CMakeFiles/qe_d3_qha_exe.dir/thermal2/PROGRAM_qha.f90.o: undefined reference to symbol 'remove_stack_limit_'                                                               
/home/crivella/.local/easybuild/software/binutils/2.40-GCCcore-12.3.0/bin/ld: /home/crivella/Codes/QE/7.3-cmake/_build/Modules/libqe_modules_c.so: error adding symbols: DSO missing from command line                                                   
collect2: error: ld returned 1 exit status

Kinda stuck after this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions