building jsoncpp (Linux) – an instruction for us mere mortals?
Question:
I am trying to build jsoncpp on Ubuntu 10.x – however the ‘instructions’ are at times vague. For example, it is not clear exactly which folder the scons.py file needs to reside in before the lib can be built.
Can someone outline the steps required to build the jsoncpp library? on Linux, or failing that, if anyone is aware of any online resource with this info, please share the link.
Answers:
Here’s what I did:
apt-get install scons
wget "http://downloads.sourceforge.net/project/jsoncpp/jsoncpp/0.5.0/jsoncpp-src-0.5.0.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fjsoncpp%2F&ts=1294425421&use_mirror=freefr"
tar -xvzf jsoncpp-src-0.5.0.tar.gz
cd jsoncpp-src-0.5.0
scons platform=linux-gcc
jsoncpp doesn’t seem to install itself, so you’ll have to manually copy the library and header files wherever you want them when you’re building applications that use the library.
It is now pretty easy to do using cmake:
Make sure CMake is installed and than in the main repo run the following commands:
mkdir -p build/debug
cd build/debug
cmake -DCMAKE_BUILD_TYPE=debug -DJSONCPP_LIB_BUILD_STATIC=ON-DJSONCPP_LIB_BUILD_SHARED=OFF -G "Unix Makefiles" ../..
make
make install
The CMAKE solution is also deprecated now. The current build solution is provided here
cd jsoncpp-master/
BUILD_TYPE=release
#plain, debug, debugoptimized, release, minsize
LIB_TYPE=shared
#LIB_TYPE=static
meson --buildtype ${BUILD_TYPE} --default-library ${LIB_TYPE} .
build-${LIB_TYPE}
ninja -v -C build-${LIB_TYPE} test
And for newbies, a simple test example is given here.
Using meson
did not work for me. The recommended way of using vcpkg
did work:
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install jsoncpp
I am trying to build jsoncpp on Ubuntu 10.x – however the ‘instructions’ are at times vague. For example, it is not clear exactly which folder the scons.py file needs to reside in before the lib can be built.
Can someone outline the steps required to build the jsoncpp library? on Linux, or failing that, if anyone is aware of any online resource with this info, please share the link.
Here’s what I did:
apt-get install scons wget "http://downloads.sourceforge.net/project/jsoncpp/jsoncpp/0.5.0/jsoncpp-src-0.5.0.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fjsoncpp%2F&ts=1294425421&use_mirror=freefr" tar -xvzf jsoncpp-src-0.5.0.tar.gz cd jsoncpp-src-0.5.0 scons platform=linux-gcc
jsoncpp doesn’t seem to install itself, so you’ll have to manually copy the library and header files wherever you want them when you’re building applications that use the library.
It is now pretty easy to do using cmake:
Make sure CMake is installed and than in the main repo run the following commands:
mkdir -p build/debug
cd build/debug
cmake -DCMAKE_BUILD_TYPE=debug -DJSONCPP_LIB_BUILD_STATIC=ON-DJSONCPP_LIB_BUILD_SHARED=OFF -G "Unix Makefiles" ../..
make
make install
The CMAKE solution is also deprecated now. The current build solution is provided here
cd jsoncpp-master/
BUILD_TYPE=release
#plain, debug, debugoptimized, release, minsize
LIB_TYPE=shared
#LIB_TYPE=static
meson --buildtype ${BUILD_TYPE} --default-library ${LIB_TYPE} .
build-${LIB_TYPE}
ninja -v -C build-${LIB_TYPE} test
And for newbies, a simple test example is given here.
Using meson
did not work for me. The recommended way of using vcpkg
did work:
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install jsoncpp