-
Notifications
You must be signed in to change notification settings - Fork 156
Open
Labels
Description
I am working on a larger project that use SUNDIALS and want to test its functionality independently. I have tried to build the CXX examples. Most of them work, but some of them do not.
Current Behavior:
Building CVODE CXX examples fail due to undefined references.
Steps To Reproduce:
Fork/clone the repo, checkout v7.0.0. Occurs on master as well
Build SUNDIALS with CMake:
#!/bin/bash
# SUNDIALS
mkdir -p build
mkdir -p install
cd build
cmake_flags="-DCMAKE_INSTALL_PREFIX=../install \
-DBUILD_STATIC_LIBS=ON \
-DBUILD_SHARED_LIBS=OFF \
-DEXAMPLES_INSTALL=ON
-DEXAMPLES_INSTALL_PATH=../install/examples \
-DEXAMPLES_ENABLE_CXX=ON"
if [[ "$(uname)" == "Linux" ]]; then
cmake_flags="$cmake_flags -DCMAKE_C_FLAGS=-fPIC"
fi
cmake $cmake_flags ..
make config=release -j$(nproc)
make install
cd ..
echo "SUNDIALS built."
Build some examples
cd install/examples/nvector/serial
make
./test_nvector_serial 10 0
Output is success.
cd install/examples/cvode/CXX_serial
make
Output (see full output.txt):
~/Git/sundials/install/examples/cvode/CXX_serial$ make
/usr/bin/c++ -o cv_heat2D cv_heat2D.o -O3 -DNDEBUG -std=c++14 -I/home/wdugan/Git/sundials/install/include -I. -L/home/wdugan/Git/sundials/install/lib -lsundials_cvode -lsundials_nvecserial -lm -Wl,-rpath,/home/wdugan/Git/sundials/install/lib
/usr/bin/ld: cv_heat2D.o: in function `PSolve(double, _generic_N_Vector*, _generic_N_Vector*, _generic_N_Vector*, _generic_N_Vector*, double, double, int, void*)':
cv_heat2D.cpp:(.text+0x13): undefined reference to `N_VProd'
/usr/bin/ld: cv_heat2D.o: in function `PSetup(double, _generic_N_Vector*, _generic_N_Vector*, int, int*, double, void*)':
cv_heat2D.cpp:(.text+0x4b6): undefined reference to `N_VGetArrayPointer'
/usr/bin/ld: cv_heat2D.cpp:(.text+0x57e): undefined reference to `N_VConst'
/usr/bin/ld: cv_heat2D.o: in function `Solution(double, _generic_N_Vector*, UserData&)':
cv_heat2D.cpp:(.text+0x624): undefined reference to `N_VGetArrayPointer'
...
collect2: error: ld returned 1 exit status
make: *** [Makefile:85: examples] Error 1
Environment:
- SUNDIALS v7.0.0
- Ubuntu 24.04 LTS
- GCC 13.2.0
Edit - Test outputs
As the documentation suggests, i have run 'make test' and 'make test_install'. All is success.
test_output.txt