superlu
superlu copied to clipboard
Multiple definition error
Hi all.
I obtaining a linking error when try to compile libsuperlu_fortran
in Fedora 38:
[ 98%] Linking Fortran shared library libsuperlu_fortran.so
cd /home/sagitter/rpmbuild/BUILD/superlu-6.0.0/redhat-linux-build/FORTRAN && /usr/bin/cmake -E cmake_link_script CMakeFiles/superlu_fortran.dir/link.txt --verbose=1
/usr/bin/gfortran -fPIC -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules -fcommon -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes -shared -Wl,-soname,libsuperlu_fortran.so.6 -o libsuperlu_fortran.so.6.0.0 CMakeFiles/superlu_fortran.dir/c_fortran_dgssv.c.o CMakeFiles/superlu_fortran.dir/hbcode1.F90.o CMakeFiles/superlu_fortran.dir/f_main.F90.o CMakeFiles/superlu_fortran.dir/c_fortran_zgssv.c.o CMakeFiles/superlu_fortran.dir/zhbcode1.F90.o CMakeFiles/superlu_fortran.dir/z_f_main.F90.o ../SRC/libsuperlu.so.6.0.0 -lflexiblas /usr/lib64/libmetis.so -lm
/usr/bin/ld: CMakeFiles/superlu_fortran.dir/z_f_main.F90.o (symbol from plugin): in function `main':
(.text+0x0): multiple definition of `main'; CMakeFiles/superlu_fortran.dir/f_main.F90.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
I think it is a bug in the CMake code to build the superlu_fortran
library. Two Fortran files containing main
functions are part of the library (f_main.F90
and z_f_main.F90
), which probably causes the issue.
I revised the CMake code to build superlu_fortan, see #99. I hope this fixes your issue.