open-source-parsers / open-source-parsers/jsoncpp
Cannot statically link jsoncpp with my CMake project
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 8.9k
- Forks
- 2.7k
- Avg merge
- 31m
- Merged PRs (30d)
- 1
Description
Describe the bug
When I try to statically link jsoncpp into my project, I get the following error message:
[ 3%] Linking CXX executable ../../../../bin/jsontestrunner_exe
/usr/bin/ld: cannot find -ljsoncpp_static: No such file or directory
To Reproduce
Steps to reproduce the behavior:
- Add the following to
CMakeLists.txtfile:
set(BUILD_SHARED_LIBS False)
set(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++ -static")
- Run
cd build && cmake .. && cmake --build .
Expected behavior
Have a statically linked library
Desktop (please complete the following information):
- OS: Fedora 40
- CMake version: 3.28.2
- Meson version: 1.4.0
- Ninja version: 1.12.1
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 with the CMakeLists.txt settings in the reproduction and run the provided cmake and cmake --build commands on the reported setup. Trace why the static build requests jsoncpp_static, then verify that the project produces and links a statically linked library without the reported linker error.
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
- 42/100