Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent, cross-platform binary builds #524

Open
jeremiahpslewis opened this issue Dec 14, 2021 · 24 comments
Open

Consistent, cross-platform binary builds #524

jeremiahpslewis opened this issue Dec 14, 2021 · 24 comments

Comments

@jeremiahpslewis
Copy link

It would be great to be able to run qlever as a built binary on a range of platforms and without relying upon docker. The PR below will (hopefully) make this possible, using Julia's packaging system.

@hannahbast
Copy link
Member

Thanks, @jeremiahpslewis, can you briefly explain (preferably as a sequence of instructions) what exactly it is that we have to do from our side?

@jeremiahpslewis
Copy link
Author

@hannahbast I think I can get the PR 95% of the way together with the Yggdrasil community, then I would tag you on the PR so you could give feedback on the build script in case there are optimizations?

Going forward, as the project matures and you (potentially?) adopt semantic versioning, your team or I could then keep the Yggdrasil build up to date with your releases, it's usually just updating the version and git commit hash.

@hannahbast
Copy link
Member

@jeremiahpslewis Thanks! Doesn't our Dockerfile provide all the information you need? It lists all the packages that need to be installed and the exact command with which to build the code. All the build options can be found in the CMakeLists.txt, but you can just use that file as is with cmake. Or doesn't the build work that way with Yggdrasil?

@jeremiahpslewis
Copy link
Author

@hannahbast Yep, it should, I don't anticipate any issues, unless there are minor tweaks required to make it possible to build on other platforms. :)

@jeremiahpslewis
Copy link
Author

jeremiahpslewis commented Dec 15, 2021

@hannahbast Ok, so here is a question...have you ever seen an error like this where everything builds and then the tests fail?
Full trace: https://gist.github.com/jeremiahpslewis/5cacd8d25997a59d154a6931524826f1

[01:10:30] make[2]: Leaving directory '/workspace/srcdir/qlever/build'
[01:10:30] [ 98%] Built target BindTest
[01:10:30] make[2]: Leaving directory '/workspace/srcdir/qlever/build'
[01:10:30] [ 98%] Built target MultiColumnJoinTest
[01:10:30] make[2]: Leaving directory '/workspace/srcdir/qlever/build'
[01:10:30] [ 98%] Built target MinusTest
[01:10:30] make[2]: Leaving directory '/workspace/srcdir/qlever/build'
[01:10:30] [ 98%] Built target UnionTest
[01:10:30] make[2]: Leaving directory '/workspace/srcdir/qlever/build'
[01:10:30] [ 98%] Built target EngineTest
[01:10:30] make[2]: Leaving directory '/workspace/srcdir/qlever/build'
[01:10:30] [ 98%] Built target GroupByTest
[01:10:30] make[2]: Leaving directory '/workspace/srcdir/qlever/build'
[01:10:30] make[2]: Leaving directory '/workspace/srcdir/qlever/build'
[01:10:30] [ 98%] Built target HasPredicateScanTest
[01:10:30] [ 98%] Built target TransitivePathTest
[01:10:30] `_ZN16sparqlExpression6detail85_ZN16sparqlExpression6detail15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_m.destroyEPZNS0_15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_mE83_ZN16sparqlExpression6detail15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_m.frame' referenced in section `.rodata.cst8' of ../lib/libparser.a(SparqlParserHelpers.cpp.o): defined in discarded section `.text._ZN16sparqlExpression6detail85_ZN16sparqlExpression6detail15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_m.destroyEPZNS0_15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_mE83_ZN16sparqlExpression6detail15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_m.frame[_ZN16sparqlExpression6detail15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_m]' of ../lib/libparser.a(SparqlParserHelpers.cpp.o)
[01:10:30] `_ZN16sparqlExpression6detail93_ZN16sparqlExpression6detail15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_m.destroyEPZNS0_15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_mE91_ZN16sparqlExpression6detail15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_m.frame' referenced in section `.rodata.cst8' of ../lib/libparser.a(SparqlParserHelpers.cpp.o): defined in discarded section `.text._ZN16sparqlExpression6detail93_ZN16sparqlExpression6detail15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_m.destroyEPZNS0_15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_mE91_ZN16sparqlExpression6detail15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_m.frame[_ZN16sparqlExpression6detail15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_m]' of ../lib/libparser.a(SparqlParserHelpers.cpp.o)
[01:10:30] [ 98%] Linking CXX executable SparqlEngineMain
[01:10:30] /usr/bin/cmake -E cmake_link_script CMakeFiles/SparqlEngineMain.dir/link.txt --verbose=1
[01:10:30] /opt/bin/x86_64-linux-gnu-libgfortran5-cxx11/x86_64-linux-gnu-g++ --sysroot=/opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/    -Wall -Wextra -Wno-missing-field-initializers -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=0   -O3 -DNDEBUG -O3  -rdynamic CMakeFiles/SparqlEngineMain.dir/src/SparqlEngineMain.cpp.o  -o SparqlEngineMain  -Wl,-rpath,/usr/local/lib -ljemalloc lib/libengine.a -lpthread lib/libindex.a lib/libparser.a lib/libsparqlExpressions.a lib/libsparqlParser.a lib/libindex.a lib/libparser.a lib/libsparqlExpressions.a lib/libsparqlParser.a lib/libstxxl.a lib/libfoxxll.a lib/libtlx.a -pthread -lzstd lib/libre2.a lib/librdfEscaping.a ../dist/libantlr4-runtime.a -luuid lib/libhttpServer.a lib/libSortPerformanceEstimator.a lib/libabsl_cord.a lib/libabsl_cordz_info.a lib/libabsl_cord_internal.a lib/libabsl_cordz_functions.a lib/libabsl_cordz_handle.a lib/libabsl_hash.a lib/libabsl_city.a lib/libabsl_bad_variant_access.a lib/libabsl_low_level_hash.a lib/libabsl_raw_hash_set.a lib/libabsl_bad_optional_access.a lib/libabsl_hashtablez_sampler.a lib/libabsl_exponential_biased.a lib/libabsl_synchronization.a lib/libabsl_stacktrace.a lib/libabsl_graphcycles_internal.a lib/libabsl_symbolize.a lib/libabsl_malloc_internal.a lib/libabsl_debugging_internal.a lib/libabsl_demangle_internal.a lib/libabsl_time.a lib/libabsl_strings.a lib/libabsl_throw_delegate.a lib/libabsl_strings_internal.a lib/libabsl_base.a lib/libabsl_spinlock_wait.a -lpthread -lrt lib/libabsl_raw_logging_internal.a lib/libabsl_log_severity.a lib/libabsl_int128.a lib/libabsl_civil_time.a lib/libabsl_time_zone.a -ljemalloc /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/lib/libicuuc.so /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/lib/libicui18n.so 
[01:10:30] [ 98%] Linking CXX executable WriteIndexListsMain
[01:10:30] /usr/bin/cmake -E cmake_link_script CMakeFiles/WriteIndexListsMain.dir/link.txt --verbose=1
[01:10:30] /opt/bin/x86_64-linux-gnu-libgfortran5-cxx11/x86_64-linux-gnu-g++ --sysroot=/opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/    -Wall -Wextra -Wno-missing-field-initializers -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=0   -O3 -DNDEBUG -O3  -rdynamic CMakeFiles/WriteIndexListsMain.dir/src/WriteIndexListsMain.cpp.o  -o WriteIndexListsMain  -Wl,-rpath,/usr/local/lib -ljemalloc lib/libengine.a -lpthread lib/libindex.a lib/libparser.a lib/libsparqlExpressions.a lib/libsparqlParser.a lib/libindex.a lib/libparser.a lib/libsparqlExpressions.a lib/libsparqlParser.a lib/libstxxl.a lib/libfoxxll.a lib/libtlx.a -pthread -lzstd lib/libre2.a lib/librdfEscaping.a ../dist/libantlr4-runtime.a -luuid lib/libhttpServer.a lib/libSortPerformanceEstimator.a lib/libabsl_cord.a lib/libabsl_cordz_info.a lib/libabsl_cord_internal.a lib/libabsl_cordz_functions.a lib/libabsl_cordz_handle.a lib/libabsl_hash.a lib/libabsl_city.a lib/libabsl_bad_variant_access.a lib/libabsl_low_level_hash.a lib/libabsl_raw_hash_set.a lib/libabsl_bad_optional_access.a lib/libabsl_hashtablez_sampler.a lib/libabsl_exponential_biased.a lib/libabsl_synchronization.a lib/libabsl_stacktrace.a lib/libabsl_graphcycles_internal.a lib/libabsl_symbolize.a lib/libabsl_malloc_internal.a lib/libabsl_debugging_internal.a lib/libabsl_demangle_internal.a lib/libabsl_time.a lib/libabsl_strings.a lib/libabsl_throw_delegate.a lib/libabsl_strings_internal.a lib/libabsl_base.a lib/libabsl_spinlock_wait.a -lpthread -lrt lib/libabsl_raw_logging_internal.a lib/libabsl_log_severity.a lib/libabsl_int128.a lib/libabsl_civil_time.a lib/libabsl_time_zone.a -ljemalloc /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/lib/libicuuc.so /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/lib/libicui18n.so 
[01:10:30] collect2: error: ld returned 1 exit status
[01:10:30] make[2]: *** [test/CMakeFiles/QueryPlannerTest.dir/build.make:156: test/QueryPlannerTest] Error 1
[01:10:30] make[2]: Leaving directory '/workspace/srcdir/qlever/build'
[01:10:30] make[1]: *** [CMakeFiles/Makefile2:7565: test/CMakeFiles/QueryPlannerTest.dir/all] Error 2
[01:10:30] make[1]: *** Waiting for unfinished jobs....
[01:10:31] `_ZN16sparqlExpression6detail85_ZN16sparqlExpression6detail15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_m.destroyEPZNS0_15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_mE83_ZN16sparqlExpression6detail15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_m.frame' referenced in section `.rodata.cst8' of lib/libparser.a(SparqlParserHelpers.cpp.o): defined in discarded section `.text._ZN16sparqlExpression6detail85_ZN16sparqlExpression6detail15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_m.destroyEPZNS0_15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_mE83_ZN16sparqlExpression6detail15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_m.frame[_ZN16sparqlExpression6detail15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_m]' of lib/libparser.a(SparqlParserHelpers.cpp.o)
[01:10:31] `_ZN16sparqlExpression6detail93_ZN16sparqlExpression6detail15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_m.destroyEPZNS0_15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_mE91_ZN16sparqlExpression6detail15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_m.frame' referenced in section `.rodata.cst8' of lib/libparser.a(SparqlParserHelpers.cpp.o): defined in discarded section `.text._ZN16sparqlExpression6detail93_ZN16sparqlExpression6detail15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_m.destroyEPZNS0_15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_mE91_ZN16sparqlExpression6detail15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_m.frame[_ZN16sparqlExpression6detail15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_m]' of lib/libparser.a(SparqlParserHelpers.cpp.o)

@hannahbast
Copy link
Member

@jeremiahpslewis I have never seen this error before. Johannes (@joka921), can you comment? The actual error message seems to be in the last two lines

@joka921
Copy link
Member

joka921 commented Dec 15, 2021

@jeremiahpslewis
Thanks for your efforts.
This issue is currently giving me a headache,
but I am working on it.

@joka921
Copy link
Member

joka921 commented Dec 15, 2021

@jeremiahpslewis ,
Could you please try out recompiling this scenario with the commit from the following PR:
It tries to fix at least the ServerMain exectutable, by linking in a different order.

Alternatively:

Is there a documentation where I can run the exact toolchain this script uses on our machines, so we can have a faster cycle?
#525

@joka921
Copy link
Member

joka921 commented Dec 15, 2021

Ok,
I now had a look at the various runs from your Yggdrasil PR.

  1. This strange linking error on x86_64 linux is still a riddle to me. The symbols which are problematic there/placed in the wrong section are automatically created by C++20s coroutine mechanism. I suspect, that one of the used tools there (compiler/linker/std-library/ar/ranlib) messes something up, I currently cannot really reproduce this, but in general G++11 should compile).

  2. On some other architectures (Aarch64, PowerPC) it seems to me, that the compilation runs fine, but afterwards the packaging script fails. As I understand it, the binaries are expected in a /lib or /lib64 folder, whereas our executables are placed directly in the directory where cmake is called. Can this behavior be changed, s.t. these runs pass?

  3. Cmake currently fails for the MacOS builds, I have googled a bit and the main reason seems to be, that the compiler detection is a little bit off, because our minimal cmake version was too low. I have just opened a PR here that increases this version, so you can update the commit hash in your Yggdrasil PR to check, what else might go wrong on clang/MacOs

@jeremiahpslewis
Copy link
Author

jeremiahpslewis commented Dec 15, 2021

@joka921 There's a great command line interface which drops you into a debug shell for running builds locally, here are the steps (assumes you have docker installed):

  1. Download and install Julia 1.7, here: https://julialang.org/downloads/
  2. Start Julia, then run this line: using Pkg; Pkg.add("BinaryBuilder")
  3. git clone https://github.com/jeremiahpslewis/Yggdrasil.git, cd Yggdrasil, git switch jpsl/qlever_jll
  4. Navigate to cd Q/QLever folder in Yggdrasil directory
  5. Run: julia build_tarballs.jl x86_64-linux-gnu --debug --verbose

@jeremiahpslewis
Copy link
Author

@joka921 I'm working on updating the PR for the aarch64 etc. builds, you are right that I need to move the binaries to the right location

@jeremiahpslewis
Copy link
Author

jeremiahpslewis commented Dec 15, 2021

@joka921 Here are the updated Mac build logs:

Link: https://gist.github.com/jeremiahpslewis/ce7191f5283156d87a9993b00caed6b2

Highlights:

2021-12-15T17:22:39.3591876Z �[0m�[1m[17:22:39] �[22m
2021-12-15T17:22:39.3593528Z �[0m�[1m[17:22:39] �[22m�[31mHEAD is now at 944ef05 Merge pull request #55 from Flamefire/disable_tests_for_subproject�[39m
2021-12-15T17:22:39.3980342Z �[0m�[1m[17:22:39] �[22m�[31mSubmodule 'extern/gtest' (https://github.com/google/googletest) registered for path 'extern/gtest'�[39m
2021-12-15T17:22:39.4028849Z �[0m�[1m[17:22:39] �[22m�[31mCloning into '/workspace/srcdir/qlever/build/runtime/thirdparty/utfcpp/extern/gtest'...�[39m
2021-12-15T17:22:40.1329209Z �[0m�[1m[17:22:40] �[22m�[31mIn file included from /workspace/srcdir/qlever/test/TupleHelpersTest.cpp:10:�[39m
2021-12-15T17:22:40.1330689Z �[0m�[1m[17:22:40] �[22m�[31m/workspace/srcdir/qlever/test/../src/util/TupleHelpers.h:54:10: error: no viable constructor or deduction guide for deduction of template arguments of 'tuple'�[39m
2021-12-15T17:22:40.1331855Z �[0m�[1m[17:22:40] �[22m�[31m  return std::tuple(�[39m
2021-12-15T17:22:40.1332510Z �[0m�[1m[17:22:40] �[22m�[31m         ^�[39m
2021-12-15T17:22:40.1333761Z �[0m�[1m[17:22:40] �[22m�[31m/workspace/srcdir/qlever/test/TupleHelpersTest.cpp:69:14: note: in instantiation of function template specialization 'ad_tuple_helpers::toUniquePtrTuple<int, std::basic_string<char>, bool>' requested here�[39m
2021-12-15T17:22:40.1335003Z �[0m�[1m[17:22:40] �[22m�[31m    auto x = toUniquePtrTuple(3, "kartoffel"s, true);�[39m
2021-12-15T17:22:40.1335661Z �[0m�[1m[17:22:40] �[22m�[31m             ^�[39m
2021-12-15T17:22:40.1337305Z �[0m�[1m[17:22:40] �[22m�[31m/opt/aarch64-apple-darwin20/aarch64-apple-darwin20/sys-root/usr/include/c++/v1/tuple:678:7: note: candidate template ignored: requirement '_CheckArgsConstructor<true, void>::__enable_implicit()' was not satisfied [with _Tp = <std::unique_ptr<bool>>, _Alloc = std::unique_ptr<std::basic_string<char>>, _Dummy = true]�[39m
2021-12-15T17:22:40.1339017Z �[0m�[1m[17:22:40] �[22m�[31m      tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t)�[39m
2021-12-15T17:22:40.1339741Z �[0m�[1m[17:22:40] �[22m�[31m      ^�[39m
2021-12-15T17:22:40.1341430Z �[0m�[1m[17:22:40] �[22m�[31m/opt/aarch64-apple-darwin20/aarch64-apple-darwin20/sys-root/usr/include/c++/v1/tuple:698:7: note: candidate template ignored: requirement '_CheckArgsConstructor<true, void>::__enable_explicit()' was not satisfied [with _Tp = <std::unique_ptr<bool>>, _Alloc = std::unique_ptr<std::basic_string<char>>, _Dummy = true]�[39m
2021-12-15T17:22:40.1342848Z �[0m�[1m[17:22:40] �[22m�[31m      tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t)�[39m
2021-12-15T17:22:40.1343482Z �[0m�[1m[17:22:40] �[22m�[31m      ^�[39m
2021-12-15T17:22:40.1345256Z �[0m�[1m[17:22:40] �[22m�[31m/opt/aarch64-apple-darwin20/aarch64-apple-darwin20/sys-root/usr/include/c++/v1/tuple:784:9: note: candidate template ignored: substitution failure [with _Tp = <>, _Alloc = std::unique_ptr<std::basic_string<char>>, _Up = <std::unique_ptr<bool>>]: cannot reference member of primary template because deduced class template specialization 'tuple<>' is an explicit specialization�[39m
2021-12-15T17:22:40.1347375Z �[0m�[1m[17:22:40] �[22m�[31m        tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)�[39m
2021-12-15T17:22:40.1347937Z �[0m�[1m[17:22:40] �[22m�[31m        ^�[39m
2021-12-15T17:22:40.1349438Z �[0m�[1m[17:22:40] �[22m�[31m/opt/aarch64-apple-darwin20/aarch64-apple-darwin20/sys-root/usr/include/c++/v1/tuple:804:9: note: candidate template ignored: substitution failure [with _Tp = <>, _Alloc = std::unique_ptr<std::basic_string<char>>, _Up = <std::unique_ptr<bool>>]: cannot reference member of primary template because deduced class template specialization 'tuple<>' is an explicit specialization�[39m
2021-12-15T17:22:40.1350916Z �[0m�[1m[17:22:40] �[22m�[31m        tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)�[39m
2021-12-15T17:22:40.1351489Z �[0m�[1m[17:22:40] �[22m�[31m        ^�[39m
2021-12-15T17:22:40.1353387Z �[0m�[1m[17:22:40] �[22m�[31m/opt/aarch64-apple-darwin20/aarch64-apple-darwin20/sys-root/usr/include/c++/v1/tuple:851:9: note: candidate template ignored: substitution failure [with _Tp = <>, _Alloc = std::unique_ptr<std::basic_string<char>>, _Tuple = std::unique_ptr<bool>]: cannot reference member of primary template because deduced class template specialization 'tuple<>' is an explicit specialization�[39m
2021-12-15T17:22:40.1355068Z �[0m�[1m[17:22:40] �[22m�[31m        tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)�[39m
2021-12-15T17:22:40.1355778Z �[0m�[1m[17:22:40] �[22m�[31m        ^�[39m
2021-12-15T17:22:40.1357611Z �[0m�[1m[17:22:40] �[22m�[31m/opt/aarch64-apple-darwin20/aarch64-apple-darwin20/sys-root/usr/include/c++/v1/tuple:865:9: note: candidate template ignored: substitution failure [with _Tp = <>, _Alloc = std::unique_ptr<std::basic_string<char>>, _Tuple = std::unique_ptr<bool>]: cannot reference member of primary template because deduced class template specialization 'tuple<>' is an explicit specialization�[39m
2021-12-15T17:22:40.1359351Z �[0m�[1m[17:22:40] �[22m�[31m        tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)�[39m
2021-12-15T17:22:40.1359995Z �[0m�[1m[17:22:40] �[22m�[31m        ^�[39m
2021-12-15T17:22:40.1361082Z �[0m�[1m[17:22:40] �[22m�[31m/opt/aarch64-apple-darwin20/aarch64-apple-darwin20/sys-root/usr/include/c++/v1/tuple:933:1: note: candidate template ignored: could not match 'tuple' against 'unique_ptr'�[39m
2021-12-15T17:22:40.1362320Z �[0m�[1m[17:22:40] �[22m�[31mtuple(allocator_arg_t, const _Alloc&, tuple<_Args...> const&) -> tuple<_Args...>;�[39m
2021-12-15T17:22:40.1363021Z �[0m�[1m[17:22:40] �[22m�[31m^�[39m
2021-12-15T17:22:40.1364164Z �[0m�[1m[17:22:40] �[22m�[31m/opt/aarch64-apple-darwin20/aarch64-apple-darwin20/sys-root/usr/include/c++/v1/tuple:935:1: note: candidate template ignored: could not match 'tuple' against 'unique_ptr'�[39m
2021-12-15T17:22:40.1365319Z �[0m�[1m[17:22:40] �[22m�[31mtuple(allocator_arg_t, const _Alloc&, tuple<_Args...>&&) -> tuple<_Args...>;�[39m
2021-12-15T17:22:40.1365955Z �[0m�[1m[17:22:40] �[22m�[31m^�[39m
2021-12-15T17:22:40.1367136Z �[0m�[1m[17:22:40] �[22m�[31m/opt/aarch64-apple-darwin20/aarch64-apple-darwin20/sys-root/usr/include/c++/v1/tuple:626:5: note: candidate function template not viable: requires 2 arguments, but 3 were provided�[39m
2021-12-15T17:22:40.1368215Z �[0m�[1m[17:22:40] �[22m�[31m    tuple(_AllocArgT, _Alloc const& __a)�[39m
2021-12-15T17:22:40.1368869Z �[0m�[1m[17:22:40] �[22m�[31m    ^�[39m
2021-12-15T17:22:40.1370053Z �[0m�[1m[17:22:40] �[22m�[31m/opt/aarch64-apple-darwin20/aarch64-apple-darwin20/sys-root/usr/include/c++/v1/tuple:616:5: note: candidate function template not viable: requires 1 argument, but 3 were provided�[39m
2021-12-15T17:22:40.1371125Z �[0m�[1m[17:22:40] �[22m�[31m    tuple(tuple const&) = default;�[39m
2021-12-15T17:22:40.1371755Z �[0m�[1m[17:22:40] �[22m�[31m    ^�[39m
2021-12-15T17:22:40.1372894Z �[0m�[1m[17:22:40] �[22m�[31m/opt/aarch64-apple-darwin20/aarch64-apple-darwin20/sys-root/usr/include/c++/v1/tuple:617:5: note: candidate function template not viable: requires 1 argument, but 3 were provided�[39m
2021-12-15T17:22:40.1373801Z �[0m�[1m[17:22:40] �[22m�[31m    tuple(tuple&&) = default;�[39m
2021-12-15T17:22:40.1374377Z �[0m�[1m[17:22:40] �[22m�[31m    ^�[39m
2021-12-15T17:22:40.1375982Z �[0m�[1m[17:22:40] �[22m�[31m/opt/aarch64-apple-darwin20/aarch64-apple-darwin20/sys-root/usr/include/c++/v1/tuple:642:5: note: candidate template ignored: requirement '_CheckArgsConstructor<true, void>::__enable_implicit()' was not satisfied [with _Tp = <std::unique_ptr<int>, std::unique_ptr<std::basic_string<char>>, std::unique_ptr<bool>>, _Dummy = true]�[39m
2021-12-15T17:22:40.1377946Z �[0m�[1m[17:22:40] �[22m�[31m    tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value))�[39m
2021-12-15T17:22:40.1378734Z �[0m�[1m[17:22:40] �[22m�[31m    ^�[39m
2021-12-15T17:22:40.1380312Z �[0m�[1m[17:22:40] �[22m�[31m/opt/aarch64-apple-darwin20/aarch64-apple-darwin20/sys-root/usr/include/c++/v1/tuple:660:14: note: candidate template ignored: requirement '_CheckArgsConstructor<true, void>::__enable_explicit()' was not satisfied [with _Tp = <std::unique_ptr<int>, std::unique_ptr<std::basic_string<char>>, std::unique_ptr<bool>>, _Dummy = true]�[39m

@jeremiahpslewis
Copy link
Author

Latest Mac error:

[05:31:10] cd /workspace/srcdir/qlever/build/third_party/antlr4/runtime/Cpp/runtime && /opt/bin/x86_64-apple-darwin14-libgfortran5-cxx11/x86_64-apple-darwin14-clang++ --sysroot=/opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root   -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/atn -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/dfa -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/misc -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/support -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/tree -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/tree/pattern -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/tree/xpath -I/workspace/srcdir/qlever/build/runtime/thirdparty/utfcpp/install/include/utf8cpp -I/workspace/srcdir/qlever/build/runtime/thirdparty/utfcpp/install/include/utf8cpp/utf8  -mmacosx-version-min=10.15   -Wall -pedantic -W -std=c++11 -stdlib=libc++ -O3 -DNDEBUG -O3 -DNDEBUG    -Wno-overloaded-virtual -Wno-dollar-in-identifier-extension -Wno-four-char-constants  -fcoroutines-ts -Wno-attributes -Wno-implicit-fallthrough -Wno-ambiguous-reversed-operator -std=c++2a -o CMakeFiles/antlr4_static.dir/src/atn/ErrorInfo.cpp.o -c /workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/atn/ErrorInfo.cpp
[05:31:10] [ 60%] Building CXX object third_party/antlr4/runtime/Cpp/runtime/CMakeFiles/antlr4_static.dir/src/atn/LL1Analyzer.cpp.o
[05:31:10] cd /workspace/srcdir/qlever/build/third_party/antlr4/runtime/Cpp/runtime && /opt/bin/x86_64-apple-darwin14-libgfortran5-cxx11/x86_64-apple-darwin14-clang++ --sysroot=/opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root   -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/atn -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/dfa -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/misc -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/support -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/tree -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/tree/pattern -I/workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/tree/xpath -I/workspace/srcdir/qlever/build/runtime/thirdparty/utfcpp/install/include/utf8cpp -I/workspace/srcdir/qlever/build/runtime/thirdparty/utfcpp/install/include/utf8cpp/utf8  -mmacosx-version-min=10.15   -Wall -pedantic -W -std=c++11 -stdlib=libc++ -O3 -DNDEBUG -O3 -DNDEBUG    -Wno-overloaded-virtual -Wno-dollar-in-identifier-extension -Wno-four-char-constants  -fcoroutines-ts -Wno-attributes -Wno-implicit-fallthrough -Wno-ambiguous-reversed-operator -std=c++2a -o CMakeFiles/antlr4_static.dir/src/atn/LL1Analyzer.cpp.o -c /workspace/srcdir/qlever/third_party/antlr4/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp
[05:31:11] In file included from /workspace/srcdir/qlever/src/util/HttpServer/MediaTypes.cpp:4:
[05:31:11] /workspace/srcdir/qlever/src/util/HttpServer/MediaTypes.h:53:15: error: no type named 'weak_ordering' in namespace 'std'
[05:31:11]   friend std::weak_ordering operator<=>(const Variant& a, const Variant& b) {
[05:31:11]          ~~~~~^
[05:31:11] /workspace/srcdir/qlever/src/util/HttpServer/MediaTypes.h:61:8: error: no type named 'partial_ordering' in namespace 'std'
[05:31:11]   std::partial_ordering operator<=>(const MediaTypeWithQuality& rhs) const {
[05:31:11]   ~~~~~^
[05:31:11] /workspace/srcdir/qlever/src/util/HttpServer/MediaTypes.h:54:22: error: cannot use builtin operator '<=>' because type 'std::strong_ordering' was not found; include <compare>
[05:31:11]     return a.index() <=> b.index();
[05:31:11]                      ^
[05:31:11] /workspace/srcdir/qlever/src/util/HttpServer/MediaTypes.h:62:34: error: cannot use builtin operator '<=>' because type 'std::partial_ordering' was not found; include <compare>
[05:31:11]     if (auto cmp = _qualityValue <=> rhs._qualityValue; cmp != 0) {
[05:31:11]                                  ^
[05:31:11] /workspace/srcdir/qlever/src/util/HttpServer/MediaTypes.cpp:27:11: error: expected unqualified-id
[05:31:11]     using enum MediaType;
[05:31:11]           ^
[05:31:11] /workspace/srcdir/qlever/src/util/HttpServer/MediaTypes.cpp:28:9: error: use of undeclared identifier 'html'
[05:31:11]     add(html, "text", "html", {".htm", ".html", ".php"});
[05:31:11]         ^
[05:31:11] /workspace/srcdir/qlever/src/util/HttpServer/MediaTypes.cpp:29:9: error: use of undeclared identifier 'css'
[05:31:11]     add(css, "text", "css", {".css"});
[05:31:11]         ^
[05:31:11] /workspace/srcdir/qlever/src/util/HttpServer/MediaTypes.cpp:30:9: error: use of undeclared identifier 'textPlain'
[05:31:11]     add(textPlain, "text", "plain", {".txt"});

@joka921
Copy link
Member

joka921 commented Dec 16, 2021

Thank you for trying this out, it is really interesting to see, what is missing to make QLever work on different platforms.

After looking at those logs for quite some time, I can now say the following:

  • QLever currently officially supports Linux.
  • We always aim to make at least two compiler/toolchains work at the same time (Currently this is g++-11 with libstdc++ and clang++-13 with libc++).
  • We also provide a Dockerfile for the default toolchain, which should run on any reasonably new host system (E.G. a Ubuntu LTS version as the docker host). Internally we use this Dockerfile for most of our productive instances, and also for experimental results which are to be published. This is crucial for reproducitiblity (not only on the "it works" but also on the performance level).
  • In general, we use very new C++ features, as soon as G++ and LLVM support a standardized C++ feature in a stable release version, it is ok to use this feature in QLever without a backwards compatibility layer.
  • This makes it very hard to provide the kind of portability that you want to implement with cross-platform builds (We think of QLever as a software that runs on a large Server, where Linux (and often Docker) are the standard technologies. If developers want to use a different local operating system (e.g. Windows or Mac) there are a lot of ways to make this work (Remote coding, WSL, developing in a local docker).

For your concrete issues this means the following:

  • We cannot support any of the "older" G++ versions provided by the Julia builder, which already somewhat defeats the purpose of this packaging system.

  • On MacOS the main problem is, that Apple doesn't ship the LLVM clang + libc++ but their own implementation, which lacks several features, that are currently used in QLever, because LLVM supports them.

  • If someone really wants build QLever locally on MacOS then they would have to install g++ and libstdc++ or the LLVM
    toolchain (both should be possible, also not necessarily feasible for an "end user", but they should prefer the Docker image).

  • The only way I can think of to make QLever more portable without docker, is to link it statically, at least against the standard library. But this has its own disadvantages, and I am not sure, whether the Julia Packaging supports this.

  • If we could make these builds work, we still would have to maintain them. This would include making sure, that the supported platforms always support the new versions, such that we can update the packages easily. I am not sure we have the capacity and see the need for consistently making sure, that QLever works out of the box on a non-linux system.

  • As for other hardware platforms: We do not officially maintain them, but from small experiments every now and then (and also your PR confirms this) we know, that QLever also works on ARM (e.g. Raspberry Pi) and big-endian machines (e.G. IBM mainframes).

Could you please comment on the possible target group of the builds? It seems to be people who have no problem using the package manager of a rather uncommon program language, but for some reason cannot use a provided Dockerfile, or Docker image. I currently do not see, that this is a large target group.

Best regards
Johannes

@hannahbast
Copy link
Member

@jeremiahpslewis @joka921 Should we still keep this issue open?

@jeremiahpslewis
Copy link
Author

jeremiahpslewis commented Feb 26, 2022

Yes please! We're getting so close to having this done. (I hope.) If you have an Apple Silicon Mac and care to install Julia, you can try out the following:

using Pkg
Pkg.add("https://github.com/jeremiahpslewis/qlever_jll.jl.git")
using QLever_jll
using XZ_jll
using Downloads
using JSON

olympics_data_url = "https://github.com/ad-freiburg/qlever/blob/64eb86f9fa30404df56fdae50475d0eb505cbc26/examples/olympics.nt.xz?raw=true"

mktempdir() do tdir
    olympics_data_path = joinpath(tdir, "olympics.nt.xz")
    Downloads.download(olympics_data_url, olympics_data_path)

    settings_path = joinpath(tdir, "settings.json")
    open(settings_path,"w") do f
        JSON.print(f, Dict("num-triples-per-partial-vocab" => 50000000, "ascii-prefixes-only" => true))
    end
    
    run(pipeline(`$(xz()) -d -c $olympics_data_path`, `$(IndexBuilderMain()) -F ttl -f - -l -i olympics -s $settings_path`))
    run(`$(ServerMain()) -i olympics -p 7001`) # with debug
    # curl -Gs http://localhost:7001 --data-urlencode "query=PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX medal: <http://wallscope.co.uk/resource/olympics/medal/> PREFIX olympics: <http://wallscope.co.uk/ontology/olympics/> SELECT ?athlete (COUNT(?medal) as ?count_medal) WHERE { ?medal olympics:medal medal:Gold .  ?medal olympics:athlete/rdfs:label ?athlete .  } GROUP BY ?athlete ORDER BY DESC(?count_medal) LIMIT 10"

end

This is all that would (will) be necessary to install, build an index, and then spin up a qlever server. Once the remaining issues are ironed out, the same script will work across Mac / linux / windows, no docker required. A further step is then to wrap the qlever_jll binary in a Qlever.jl package (which I would gladly do) and then you'd have something like (very rough, non-idiomatic sketch):

using QLever

d = QLever.load_dataset("olympics")
QLever.build_index(d)
Qlever.run_server(d)

The hope is that this meaningfully changes the degree to which Qlever becomes accessible to a broad group of practitioners. :)

@hannahbast
Copy link
Member

hannahbast commented Feb 26, 2022

@jeremiahpslewis @joka921 Awesome, thanks!

By the way, you can now start up a generic QLever UI with this maximally simple command line. You then have the QLever UI running on port 7000 (you can pick any port you want) sending requests to an arbitrary QLever backend on port 7001.

docker run -p 7000:7000 adfreiburg/qlever-ui

I will work more on making this configurable such that you can specify a different backend port via the command line or a configuration for a few standard datasets (like one that contains all the prefixes for Wikidata).

@jeremiahpslewis
Copy link
Author

@hannahbast Cool! Unfortunately docker on newer Macs is impossibly slow so that's a hurdle specific to my setup which I'm trying to avoid.

But the other idea I'd (personally) like to push is that the 'glue code' which is necessary to orchestrate qlever (download / clean data, trigger index job, perhaps cache an index to the cloud, run queries and load / manipulate results) can be consolidated into a single package.

To be fair, there's no reason that Julia has to be the (only) language for doing this, but the binary build/ship support is pretty darn good.

@hannahbast
Copy link
Member

@jeremiahpslewis The QLever UI isn't really doing anything except serving some pages. The UI code is JavaScript and runs on the client. Can you try whether it works on your MAC? All you need is a running QLever instance and docker installed.

For the glue code, we currently have a Makefile which I use all the time. It contains targets for all the stuff one typically wants to do. So you can just type make index or make start or make log. You can also invoke two targets at once, as in make start log.

@jeremiahpslewis
Copy link
Author

  1. I guess the glue code I'm thinking about is for data pipelines to and from the qlever instance.
  2. I tried the docker image and get an error; but the UI isn't a key use case for me, I'm happier querying the API directly.
  3. Sounds like my idea needs more fleshing out before it's clear whether it's useful, agree that make is a great tool for some tasks :)

@hannahbast
Copy link
Member

Speaking of pipelines, make is quite a congenial tool for that (and the QLever Makefile already provides all kinds of "code" for this).

Which error do you get with the QLever UI command?

@jeremiahpslewis
Copy link
Author

jeremiahpslewis commented Feb 26, 2022

Just reran it and it works.

No objections to make :). But what lang do I do my data wrangling in? Bash / unix tools are performant, but hard to write tests around / turn into robust sw, so I tend to go for Julia.

@donpellegrino
Copy link

donpellegrino commented Jul 26, 2022

@jeremiahpslewis I encountered the "sparqlExpression" "referenced in section"/"defined in discarded section" errors when building qlever with manually built GCC 11 and GCC 12 compilers that I built and ran on Ubuntu 20.04.4 LTS. The system was a cluster and I lacked sudo/root to install the GCC 11 or GCC 12 packages, so I had to build them myself. I built the GCC compilers with the Intel C++ Compiler which is based on clang/LLVM.

...have you ever seen an error like this where everything builds and then the tests fail? Full trace: https://gist.github.com/jeremiahpslewis/5cacd8d25997a59d154a6931524826f1

[01:10:31] `_ZN16sparqlExpression6detail85_ZN16sparqlExpression6detail15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_m.destroyEPZNS0_15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_mE83_ZN16sparqlExpression6detail15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_m.frame' referenced in section `.rodata.cst8' of lib/libparser.a(SparqlParserHelpers.cpp.o): defined in discarded section `.text._ZN16sparqlExpression6detail85_ZN16sparqlExpression6detail15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_m.destroyEPZNS0_15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_mE83_ZN16sparqlExpression6detail15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_m.frame[_ZN16sparqlExpression6detail15resultGeneratorIlEEN7cppcoro9generatorIT_EES4_m]' of lib/libparser.a(SparqlParserHelpers.cpp.o)
[01:10:31] `_ZN16sparqlExpression6detail93_ZN16sparqlExpression6detail15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_m.destroyEPZNS0_15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_mE91_ZN16sparqlExpression6detail15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_m.frame' referenced in section `.rodata.cst8' of lib/libparser.a(SparqlParserHelpers.cpp.o): defined in discarded section `.text._ZN16sparqlExpression6detail93_ZN16sparqlExpression6detail15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_m.destroyEPZNS0_15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_mE91_ZN16sparqlExpression6detail15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_m.frame[_ZN16sparqlExpression6detail15resultGeneratorINS_4BoolEEEN7cppcoro9generatorIT_EES5_m]' of lib/libparser.a(SparqlParserHelpers.cpp.o)

I have not figured out what was causing those errors.

I was able to build the same qlever code using Ubuntu 20.04.4 LTS with the GCC 11 as described in https://github.com/ad-freiburg/qlever/runs/7525347081?check_suite_focus=true using:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test && sudo apt update && sudo apt install -y gcc-11 g++-11

I have still not found a way to build on systems that lack pre-packaged GCC 11 or GCC 12. I assumed it was due to me doing something wrong when building those compilers.

@jeremiahpslewis @joka921, - how did you get past the "sparqlExpression" "referenced in section"/"defined in discarded section" errors? Did you identify a root cause?

@joka921
Copy link
Member

joka921 commented Jul 30, 2022

@donpellegrino We did not actually fix it, but we switched to clang for the respective Platforms which does not have this problem.

I have in the meantime identified how this error is triggered. In happens when compiling these coroutines with G++ with the
-no-pie or -fno-pie flags. Do you use these flags / does your build system set them automatically? And can you disable them?
Alternatively: Can you tell us, which flags your GCC configuration sets (e.g. by compiling with high verbosity and pasting some of the compiler and linker commands here, then we can maybe find a solution/workaround for you.

I have not yet found the time to make a minimal example of this to figure out if this is a bug in G++ which has not yet been reported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants