Error building examples on Linux
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 686
- Forks
- 167
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 17
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with the provided CMake configuration, then inspect install/examples/cvode/CXX_serial/Makefile and its link command around line 85. Compare the failing CXX_serial example with the working nvector/serial example and identify why the listed N_Vector references are unresolved. Done means the CVODE CXX examples build successfully on the stated Linux environment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100