lijoantony / JsonBenchmarkCpp

Benchmark of JSON frameworks in c++
Other
17 stars 9 forks source link

build problem #6

Closed sajjadG closed 11 years ago

sajjadG commented 11 years ago

I cloned the source and then typed make in terminal but I got these error!

~/src/JsonBenchmarkCpp$ make
if [ ! -d "libs/cajun/cajun" ]; then\
        unzip libs/cajun/cajun.zip -d libs/cajun;\
    fi
if [ ! -d "libs/json_spirit/json_spirit_v4.05" ]; then\
        unzip libs/json_spirit/json_spirit_v4_05.zip -d libs/json_spirit;\
    fi
if [ ! -d "libs/libjson/libjson" ]; then\
        unzip libs/libjson/libjson_7.4.0.zip -d libs/libjson;\
        make -w -Clibs/libjson/libjson;\
    fi
g++ -c -Wall -O2 -Ilibs/cajun/cajun -Ilibs/json_spirit/json_spirit_v4.05/json_spirit -Ilibs/libjson/libjson -Ilibs/json-parser main.cpp -o main.o
In file included from libs/libjson/libjson/libjson.h:4:0,
                 from main.cpp:32:
libs/libjson/libjson/Source/JSONDefs.h:154:6: warning: #warning , Release build of libjson, but NDEBUG is not on [-Wcpp]
In file included from libs/libjson/libjson/Source/internalJSONNode.h:5:0,
                 from libs/libjson/libjson/Source/JSONNode.h:5,
                 from libs/libjson/libjson/libjson.h:177,
                 from main.cpp:32:
libs/libjson/libjson/Source/JSONChildren.h: In constructor ‘jsonChildren::iteratorKeeper::iteratorKeeper(jsonChildren*, JSONNode**&, bool)’:
libs/libjson/libjson/Source/JSONChildren.h:171:10: warning: ‘jsonChildren::iteratorKeeper::myReverse’ will be initialized after [-Wreorder]
libs/libjson/libjson/Source/JSONChildren.h:168:20: warning:   ‘jsonChildren* jsonChildren::iteratorKeeper::myChildren’ [-Wreorder]
In file included from libs/libjson/libjson/Source/internalJSONNode.h:5:0,
                 from libs/libjson/libjson/Source/JSONNode.h:5,
                 from libs/libjson/libjson/libjson.h:177,
                 from main.cpp:32:
libs/libjson/libjson/Source/JSONChildren.h:145:5: warning:   when initialized here [-Wreorder]
main.cpp: In function ‘void jsonparserBenchmark(std::string)’:
main.cpp:166:18: warning: variable ‘value’ set but not used [-Wunused-but-set-variable]
g++ main.o libs/json-parser/json.c libs/libjson/libjson/libjson.a -lrt libs/json_spirit/json_spirit_v4.05/build/json_spirit/libjson_spirit.a -o JsonBenchmarkCpp
g++: error: libs/libjson/libjson/libjson.a: No such file or directory
g++: error: libs/json_spirit/json_spirit_v4.05/build/json_spirit/libjson_spirit.a: No such file or directory
make: *** [JsonBenchmarkCpp] Error 1

it seems it is looking for libjson.a and libjson_spirit.a but cannot find them! Tried to compile them.

~/src/JsonBenchmarkCpp$ cd libs/libjson/libjson
~/src/JsonBenchmarkCpp/libs/libjson/libjson$ make

============================================================
libjson version: 7.4.0 target:  OS: Linux
============================================================
mkdir -p Objects_static
g++ Source/internalJSONNode.cpp -o Objects_static/internalJSONNode.o -c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG
g++ Source/JSONAllocator.cpp -o Objects_static/JSONAllocator.o -c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG
g++ Source/JSON_Base64.cpp -o Objects_static/JSON_Base64.o -c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG
g++ Source/JSONChildren.cpp -o Objects_static/JSONChildren.o -c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG
g++ Source/JSONDebug.cpp -o Objects_static/JSONDebug.o -c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG
g++ Source/JSONIterators.cpp -o Objects_static/JSONIterators.o -c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG
g++ Source/JSONMemory.cpp -o Objects_static/JSONMemory.o -c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG
g++ Source/JSONNode.cpp -o Objects_static/JSONNode.o -c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG
g++ Source/JSONNode_Mutex.cpp -o Objects_static/JSONNode_Mutex.o -c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG
g++ Source/JSONPreparse.cpp -o Objects_static/JSONPreparse.o -c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG
g++ Source/JSONStream.cpp -o Objects_static/JSONStream.o -c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG
g++ Source/JSONValidator.cpp -o Objects_static/JSONValidator.o -c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG
g++ Source/JSONWorker.cpp -o Objects_static/JSONWorker.o -c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG
g++ Source/JSONWriter.cpp -o Objects_static/JSONWriter.o -c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG
g++ Source/libjson.cpp -o Objects_static/libjson.o -c -O3 -ffast-math -fexpensive-optimizations -DNDEBUG
Archive
cd Objects_static ; \
    ar -cvq libjson.a internalJSONNode.o JSONAllocator.o JSON_Base64.o JSONChildren.o JSONDebug.o JSONIterators.o JSONMemory.o JSONNode.o JSONNode_Mutex.o JSONPreparse.o JSONStream.o JSONValidator.o JSONWorker.o JSONWriter.o libjson.o  ; \
    mv -f libjson.a ../
a - internalJSONNode.o
a - JSONAllocator.o
a - JSON_Base64.o
a - JSONChildren.o
a - JSONDebug.o
a - JSONIterators.o
a - JSONMemory.o
a - JSONNode.o
a - JSONNode_Mutex.o
a - JSONPreparse.o
a - JSONStream.o
a - JSONValidator.o
a - JSONWorker.o
a - JSONWriter.o
a - libjson.o
Archive: Done
============================================================
Done
============================================================

Then I went to compile json_spirit

~/src/JsonBenchmarkCpp$ cd libs/json_spirit/json_spirit_v4.05/
~/src/JsonBenchmarkCpp/libs/json_spirit/json_spirit_v4.05$ mkdir build
~/src/JsonBenchmarkCpp/libs/json_spirit/json_spirit_v4.05/build$ cmake ../
CMake Error: The current CMakeCache.txt directory /home/sajjad/src/JsonBenchmarkCpp/libs/json_spirit/json_spirit_v4.05/build/CMakeCache.txt is different than the directory /home/lijo/hack/JsonBenchmarkCpp/libs/json_spirit/json_spirit_v4.05/build where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
CMake Error: The source "/home/sajjad/src/JsonBenchmarkCpp/libs/json_spirit/json_spirit_v4.05/CMakeLists.txt" does not match the source "/home/lijo/hack/JsonBenchmarkCpp/libs/json_spirit/json_spirit_v4.05/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.

What the hell! why cmake generated this make files?! it should not refer to /home/lijo/hack

Then I did this. I went a dir back to root of spirit dir and then build in there!

cd ../
cmake .
rm -rf build/
mkdir build
mv json_spirit/ build/
cd ../../../
make

now it works :) :100:

lijoantony commented 11 years ago

I am glad that you could make it work. Feel free to send me a pull request so that others would not be bitten by the same bug ;)