Added instructions for compiling jsoncpp examples using g++ on MacOS with the -Wl option to avoid a "no LC_RPATH's found" error message during runtime.

TouringPlans.com 2025-01-13 13:09:34 -05:00
parent 8a0f07e4ad
commit a25be91024

@ -151,3 +151,23 @@ To get the code directly from a git repository, add a [`git_repository`](https:/
)
In either case, add `"@jsoncpp//:jsoncpp"` as a dependency to targets that use JsonCpp.
### Building and Testing on MacOS
On Sonoma 14.6.1 the instructions above for using meson and ninja seem to be the most straightforward way to build the libraries.
To compile and run the examples, the following command line might be helpful as a suggestion:
g++ readFromString.cpp -ljsoncpp -std=c++11 -o readFromString -L../../build-shared -Wl,-rpath,../../build-shared
Including "-Wl,-rpath,../../build-shared" is there to prevent the following runtime linking error on MacOS:
./readFromString
dyld[21351]: Library not loaded: @rpath/libjsoncpp.27.dylib
Referenced from: <A9CEAE97-A51C-3CE9-B1EA-9E813BD76B73> ./jsoncpp/example/readFromString/readFromString
Reason: no LC_RPATH's found
Abort trap: 6