sundials
sundials copied to clipboard
unit_tests which use internal functions will not link successfully on Windows
I have not confirmed, but I believe this is because internal functions are not marked for export.
[100%] Linking C executable ark_test_arkstepsetforcing.exe
cd /d C:\Users\cjbal\Documents\Workspace\sundials\sundials\buildir-mingw\test\unit_tests\arkode\C_serial && "C:\Program Files\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\ark_test_arkstepsetforcing.dir\link.txt --verbose=1
"C:\Program Files\CMake\bin\cmake.exe" -E remove -f CMakeFiles\ark_test_arkstepsetforcing.dir/objects.a
C:\MinGW\bin\ar.exe cr CMakeFiles\ark_test_arkstepsetforcing.dir/objects.a @CMakeFiles\ark_test_arkstepsetforcing.dir\objects1.rsp
C:\MinGW\bin\gcc.exe -Wl,--whole-archive CMakeFiles\ark_test_arkstepsetforcing.dir/objects.a -Wl,--no-whole-archive -o ark_test_arkstepsetforcing.exe -Wl,--out-implib,libark_test_arkstepsetforcing.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles\ark_test_arkstepsetforcing.dir\linklibs.rsp
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: CMakeFiles\ark_test_arkstepsetforcing.dir/objects.a(ark_test_arkstepsetforcing.c.obj):ark_test_arkstepsetforcing.c:(.text+0xdfe): undefined reference to `arkStep_SetInnerForcing'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: CMakeFiles\ark_test_arkstepsetforcing.dir/objects.a(ark_test_arkstepsetforcing.c.obj):ark_test_arkstepsetforcing.c:(.text+0x1267): undefined reference to `arkStep_SetInnerForcing'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: CMakeFiles\ark_test_arkstepsetforcing.dir/objects.a(ark_test_arkstepsetforcing.c.obj):ark_test_arkstepsetforcing.c:(.text+0x16d0): undefined reference to `arkStep_SetInnerForcing'
collect2.exe: error: ld returned 1 exit status
test\unit_tests\arkode\C_serial\CMakeFiles\ark_test_arkstepsetforcing.dir\build.make:87: recipe for target 'test/unit_tests/arkode/C_serial/ark_test_arkstepsetforcing.exe' failed
mingw32-make[2]: *** [test/unit_tests/arkode/C_serial/ark_test_arkstepsetforcing.exe] Error 1
mingw32-make[2]: Leaving directory 'C:/Users/cjbal/Documents/Workspace/sundials/sundials/buildir-mingw'
CMakeFiles\Makefile2:9354: recipe for target 'test/unit_tests/arkode/C_serial/CMakeFiles/ark_test_arkstepsetforcing.dir/all' failed
mingw32-make[1]: *** [test/unit_tests/arkode/C_serial/CMakeFiles/ark_test_arkstepsetforcing.dir/all] Error 2
mingw32-make[1]: Leaving directory 'C:/Users/cjbal/Documents/Workspace/sundials/sundials/buildir-mingw'
Makefile:139: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
Your hypothesis seems reasonable to me. This might be simple enough to test (add SUNDIALS_EXPORT
to these functions and try to rebuild on Windows).
The approach in #317 allows us to test internal functions without marking them with dllexport.