superlu
superlu copied to clipboard
Issues compiling shared library
I'm trying to compile a shared library version of SuperLU. I'm using the following cmake command from the build
directory
cmake -G'MSYS Makefiles' -Denable_blaslib=OFF -DCMAKE_INSTALL_PREFIX="C:/msys64/mingw64/" -DBUILD_SHARED_LIBS=TRUE ..
Running make
works until it reaches Linking C shared library libmatgen.dll
, where I get a lot of undefined reference to [...]
-errors
[...]
[ 90%] Linking C shared library libmatgen.dll
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slatm1.c.obj):slatm1.c:(.text+0x15d): undefined reference to `input_error'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slatb4.c.obj):slatb4.c:(.text+0x38): undefined reference to `smach'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slatb4.c.obj):slatb4.c:(.text+0x87): undefined reference to `smach'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slartg.c.obj):slartg.c:(.text+0x3c): undefined reference to `smach'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slartg.c.obj):slartg.c:(.text+0x52): undefined reference to `smach'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slartg.c.obj):slartg.c:(.text+0x68): undefined reference to `smach'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slartg.c.obj):slartg.c:(.text+0x9c): more undefined references to `smach' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slatms.c.obj):slatms.c:(.text+0x776): undefined reference to `input_error'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slatms.c.obj):slatms.c:(.text+0xa83): undefined reference to `sscal_'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slatms.c.obj):slatms.c:(.text+0xbdd): undefined reference to `scopy_'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slatms.c.obj):slatms.c:(.text+0xca7): undefined reference to `scopy_'
[...]
I think this is some kind of linking error related to BLAS, but I haven't been able to figure it out. Any ideas?
EDIT: Compiling the static version seems to work fine, but then I get undefined reference to [...]
-errors when trying to compile any program, for example EXAMPLES/superlu.c
.
Using the internal BLAS instead of the installed version (cmake -G'MSYS Makefiles' -Denable_blaslib=ON -DCMAKE_INSTALL_PREFIX="C:/msys64/mingw64/" -DBUILD_SHARED_LIBS=TRUE ..
) gives me the same errors, but at a different stage in the compilation
[...]
[ 16%] Building C object CBLAS/CMakeFiles/blas.dir/zher2.c.obj
[ 16%] Linking C shared library libblas.dll
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/blas.dir/objects.a(sgemv.c.obj):sgemv.c:(.text+0x117): undefined reference to `input_error'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/blas.dir/objects.a(ssymv.c.obj):ssymv.c:(.text+0xe5): undefined reference to `input_error'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/blas.dir/objects.a(strsv.c.obj):strsv.c:(.text+0x179): undefined reference to `input_error'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/blas.dir/objects.a(sger.c.obj):sger.c:(.text+0xb7): undefined reference to `input_error'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/blas.dir/objects.a(ssyr2.c.obj):ssyr2.c:(.text+0xe5): undefined reference to `input_error'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/blas.dir/objects.a(dgemv.c.obj):dgemv.c:(.text+0x117): more undefined references to `input_error' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/blas.dir/objects.a(icamax.c.obj):icamax.c:(.text+0x7f): undefined reference to `r_imag'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/blas.dir/objects.a(icamax.c.obj):icamax.c:(.text+0x152): undefined reference to `r_imag'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/blas.dir/objects.a(icamax.c.obj):icamax.c:(.text+0x218): undefined reference to `r_imag'
[...]
Are you using MS Windows? I am not familiar with Windows, not sure the problem. Does static link work?
Sherry
On Wed, Aug 22, 2018 at 1:16 AM, Filip Sund [email protected] wrote:
I'm trying to compile a shared library version of SuperLU. I'm using the following cmake command from the build directory
cmake -G'MSYS Makefiles' -Denable_blaslib=OFF -DCMAKE_INSTALL_PREFIX="C:/msys64/mingw64/" -DBUILD_SHARED_LIBS=TRUE ..
Running make works until it reaches Linking C shared library libmatgen.dll, where I get a lot of undefined reference to [...]-errors
[ 90%] Linking C shared library libmatgen.dll C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slatm1.c.obj):slatm1.c:(.text+0x15d): undefined reference to
input_error' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slatb4.c.obj):slatb4.c:(.text+0x38): undefined reference to
smach' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slatb4.c.obj):slatb4.c:(.text+0x87): undefined reference tosmach' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slartg.c.obj):slartg.c:(.text+0x3c): undefined reference to
smach' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slartg.c.obj):slartg.c:(.text+0x52): undefined reference tosmach' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slartg.c.obj):slartg.c:(.text+0x68): undefined reference to
smach' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slartg.c.obj):slartg.c:(.text+0x9c): more undefined references tosmach' follow C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slatms.c.obj):slatms.c:(.text+0x776): undefined reference to
input_error' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slatms.c.obj):slatms.c:(.text+0xa83): undefined reference tosscal_' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slatms.c.obj):slatms.c:(.text+0xbdd): undefined reference to
scopy_' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/matgen.dir/objects.a(slatms.c.obj):slatms.c:(.text+0xca7): undefined reference to `scopy_' [...]I think this is some kind of linking error related to BLAS, but I haven't been able to figure it out. Any ideas?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xiaoyeli/superlu/issues/26, or mute the thread https://github.com/notifications/unsubscribe-auth/ALMq9409Xzvhh7cOwzttm1x2x1ZXkLVpks5uTRN2gaJpZM4WHMvD .
Yes, I managed to get static linking to work in the end.
The issues might be related to Windows, but I am not sure. There is a comment on stack overflow suggesting using the options
-Wl,--out-implib,libexample_dll.a
to the linker to generate the import library libexample_dll.a. I have not tried this yet, since I am not sure how to do this when using CMake. Anyway, the static version works for me, so I will just use that.
Great. I'll probably get some Windows expert to take a look at this.
Sherry Li
On Fri, Aug 24, 2018 at 1:49 AM, Filip Sund [email protected] wrote:
Yes, I managed to get static linking to work in the end.
The issues might be related to Windows, but I am not sure. There is a comment on stack overflow https://stackoverflow.com/a/17602173/1850917 suggesting using the options
-Wl,--out-implib,libexample_dll.a
to the linker to generate the import library libexample_dll.a. I have not tried this yet, since I am not sure how to do this when using CMake. Anyway, the static version works for me, so I will just use that.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/xiaoyeli/superlu/issues/26#issuecomment-415695847, or mute the thread https://github.com/notifications/unsubscribe-auth/ALMq9yltzSScz3Ay2IeI6ePaQ7nPG-PHks5uT74ngaJpZM4WHMvD .