Open max-kamps opened 6 years ago
I can confirm this issue. Disabling memorystat by changing "#define USE_MEMORYSTAT 1" to "#define USE_MEMORYSTAT 0" in src/config.h circumvents this compiler error, but it is by far not enough to get the full build to work. I will report further findings in a couple of minutes ...
Okay, I got it working now. Here are all the problems I encountered:
Again, disabling MemoryStat fixes this.
Specifically:
I had to disable all of them. It should be noted however that it seems like this is caused by some compiler incompatibility. I'm running GNU C++ 7.3.1. Clang might not have this problem.
I actually did not have the boost headers installed going into this, but premake assumed I had anyway and set HAS_BOOST=1. Installing the boost headers solves this problem.
It seems some part of it's build system setup didn't behave properly on my system. To disable ULib, I had to disable src/tests/ULibtest.cpp.bak, and comment out two lines in build/premake5.lua: line 138 and line 239 (both begin with "linkoptions").
Specifically:
Disable them too and it should work.
Oh, and you'll also need php installed, which isn't mentioned in the readme AFAIK.
I hope this helps.
4. ULib can't build correctly
This may be related #91
I disabled the ULib as explained in the https://github.com/miloyip/nativejson-benchmark/issues/102#issuecomment-385033311, then run
make clean
cd build
./premake.sh
cd gmake
make -f benchmark.make config=release_x64 && make -f nativejson.make config=release_x64
and it failed with
ULibtest.cpp
In file included from ../../thirdparty/ULib/include/ulib/base/hash.h:20,
from ../../thirdparty/ULib/include/ulib/string.h:17,
from ../../thirdparty/ULib/include/ulib/container/construct.h:17,
from ../../thirdparty/ULib/include/ulib/container/vector.h:17,
from ../../thirdparty/ULib/include/ulib/container/hash_map.h:17,
from ../../thirdparty/ULib/include/ulib/json/value.h:17,
from ../../src/tests/ULibtest.cpp:16:
../../thirdparty/ULib/include/ulib/base/base.h:20:12: fatal error: ulib/internal/config.h: No such file or directory
20 | # include <ulib/internal/config.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~
Removing thirdparty/ULib
submodule completely should be a usable workaround, then rebuild
cd build && ./premake.sh && cd gmake && make -f benchmark.make config=release_x64 && make -f nativejson.make config=release_x64 && cd ../..
5. Some tests crash in the verifying stage (segfault)
The Configure crashes too, so
rm -rf src/tests/configurutest.cpp
rm -rf thirdparty/configuru/
and rebuild.
In file included from ../../src/tests/configurutest.cpp:8:
../../thirdparty/configuru/configuru.hpp:574:34: error: ‘function’ in namespace ‘std’ does not name a template type
574 | void visit_dangling(const std::function<void(const std::string& key, const Config& value)>& visitor) const;
Workaround: add missing #include <functional>
in configuru.hpp
.
facil.io.cpp
In file included from ../../thirdparty/facil.io/lib/facil/core/types/fiobj/fiobj_ary.h:12:0,
from ../../thirdparty/facil.io/lib/facil/core/types/fiobj.h:8,
from ../../src/tests/facil.io.cpp:2:
../../thirdparty/facil.io/lib/facil/core/types/fiobj/fiobject.h: In function ‘fio_cstr_s fiobj_obj2cstr(FIOBJ)’:
../../thirdparty/facil.io/lib/facil/core/types/fiobj/fiobject.h:499:59: sorry, unimplemented: non-trivial designated initializers not supported
return (fio_cstr_s){.buffer = (void *)"null", .len = 4};
^
../../thirdparty/facil.io/lib/facil/core/types/fiobj/fiobject.h:499:59: sorry, unimplemented: non-trivial designated initializers not supported
../../thirdparty/facil.io/lib/facil/core/types/fiobj/fiobject.h:505:61: sorry, unimplemented: non-trivial designated initializers not supported
return (fio_cstr_s){.buffer = (void *)"null", .len = 4};
^
../../thirdparty/facil.io/lib/facil/core/types/fiobj/fiobject.h:505:61: sorry, unimplemented: non-trivial designated initializers not supported
../../thirdparty/facil.io/lib/facil/core/types/fiobj/fiobject.h:507:62: sorry, unimplemented: non-trivial designated initializers not supported
return (fio_cstr_s){.buffer = (void *)"false", .len = 5};
^
../../thirdparty/facil.io/lib/facil/core/types/fiobj/fiobject.h:507:62: sorry, unimplemented: non-trivial designated initializers not supported
../../thirdparty/facil.io/lib/facil/core/types/fiobj/fiobject.h:509:61: sorry, unimplemented: non-trivial designated initializers not supported
return (fio_cstr_s){.buffer = (void *)"true", .len = 4};
^
../../thirdparty/facil.io/lib/facil/core/types/fiobj/fiobject.h:509:61: sorry, unimplemented: non-trivial designated initializers not supported
nativejson.make:206: recipe for target '../../intermediate/release_x64/gmake/x64/release/nativejson/facil.io.o' failed
Workaround: Remove Facil.io completely
rm src/cjsonlibs/facil.io_all.c
rm src/tests/facil.io.cpp
rm -rf thirdparty/facil.io/
Rebuild
cd build && ./premake.sh && cd gmake && make -f benchmark.make config=release_x64 && make -f nativejson.make config=release_x64 && cd ../..
Having all the workarounds applied, the benchmark builds and runs without crash.
Complete set of fixes is available from my branch https://github.com/mloskot/nativejson-benchmark/tree/ml/issue-102-add-workarounds-to-build
So uh, I thought I'd make a 2021 update to this issue:
Only some of the workarounds are needed (others appear unnecessary).
In my case, I disabled 1. MemoryStat and 4. ULib as mentioned by @tomolt. I also fixed/disabled configuru and facil.io as mentioned by @mloskot . However, it appears the complexity in the make-setup is unneeded and provided for one via the main Makefile.
After all of this, I found new issues.
In the clean directive of results/makefile, add a -
preceding rm
. This will allow for failure in case no html files exist. Now, the main Makefile can be used rather than a number of commands, simply via make clean all
. clean
directive is necessary because you (may) need to re-run premake (done via the setup
directive internally) and such.
The simdjson conformance test is missing a variable initialization (oddly). In the conformance test, function ParseString
, line 127, a parser is referred to but never declared / initialized. Adding simdjson::dom::parser parser;
appears to fix this issue.
thirdparty/ujson/ujson/ujson.hpp
refers to std::out_of_range
, but only includes <exception>
. You need to add an include for <stdexcept>
which contains std::out_of_range
(among other exception classes).
Fails to compile because of a non-existent header "libplatform/libplatform.h"
. I was unable to determine which header this "actually" referred to, so I just removed the test by renaming it-- mv src/tests/v8test.cpp src/tests/v8test.cpp.bak
I changed the build/premake5.lua
line 53 to remove these linked libraries (but not the others, on the off chance that such is needed). The (condensed) patch for premake5.lua:
diff --git a/build/premake5.lua b/build/premake5.lua
index 20916ff..749f2f2 100755
--- a/build/premake5.lua
+++ b/build/premake5.lua
@@ -53 +53 @@ function gmake_common()
- links { "v8_base", "v8_libbase", "v8_libplatform", "v8_nosnapshot" }
+ links { "v8_libbase", "v8_libplatform" }
@@ -139 +139 @@ solution "benchmark"
- linkoptions { "../../thirdparty/ULib/src/ulib/.libs/libulib.a" }
+-- linkoptions { "../../thirdparty/ULib/src/ulib/.libs/libulib.a" }
@@ -243 +243 @@ solution "jsonstat"
- linkoptions { "../../thirdparty/ULib/src/ulib/.libs/libulib.a" }
+-- linkoptions { "../../thirdparty/ULib/src/ulib/.libs/libulib.a" }
After all this, you should get some tests to run, but tests will fail. You should be able to just run make all
at this point and not have to deal with cleaning and rebuilding everything entirely. In my case, on munmap_chunk() (invalid pointer)
for the configuru, JVar tests, free() (invalid pointer)
for the ujson test. SimpleJSON
segfaults on stringify. I was uninterested in these tests, so I just removed them by renaming their .cpp
files to .cpp.bak
.
The simdjson test "gracefully" fails in verification, but seems to work in general, and I was actually interested in this test (I wanted to in fact, see if this benchmark suite matched simdjson's, for the obvious reason that simdjson claims to have beaten the author of this suite's json libary (RapidJSON).
Self-explanatory. Install php for your distribution.
The html files are located in result
, but relatively source some things from resource
. So simply being in the repo's root and python3 -m http.server
should do the trick. Many tests still...don't work / don't have metrics. But better than nothing?
I also don't know if I should trust metrics given the fact that there's an incredibly large amount of warnings generated upon compilation.
In case anyone is curious, a very-abridged summary of my findings:
CPU / OS / compiler detected as XeonE5620@2.40GHz_linux64_gcc10.2
(note I have dual CPUs, don't know if both were used or not).
The obvious: you'll probably want to run your own benchmark. I was unable to figure out how to order the pre-made Conformance Graphs, unfortunately.