TuGraph-family / tugraph-db

TuGraph is a high performance graph database.
https://tugraph.org
Apache License 2.0
1.38k stars 183 forks source link

Fails to build with gcc 12.2 – this not specified in enclosing parallel #196

Open jirutka opened 1 year ago

jirutka commented 1 year ago

Describe the bug

Fails to build from source on recent gcc:

ninja: job failed: /usr/bin/g++  -I./include -I./src -I/usr/include/python3.11 -isystem ./deps/install/include -isystem /usr/local/include -fomit-frame-pointer -DNO_STACKTRACE -Wall -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-value -Wno-unused-function -Wno-reorder -DLGRAPH_USE_MOCK_KV=0 -D__STDC_FORMAT_MACROS -fopenmp -std=c++17 -static-libstdc++ -static-libgcc -O3 -DNDEBUG -std=gnu++17 -MD -MT plugins/CMakeFiles/lpa_standalone.dir/cpp/lpa_standalone.cpp.o -MF plugins/CMakeFiles/lpa_standalone.dir/cpp/lpa_standalone.cpp.o.d -o plugins/CMakeFiles/lpa_standalone.dir/cpp/lpa_standalone.cpp.o -c ./plugins/cpp/lpa_standalone.cpp
In file included from ./src/olap/olap_config.h:20,
                 from ./src/olap/olap_io.h:22,
                 from ./src/olap/olap_on_disk.h:17,
                 from ./plugins/cpp/lpa_standalone.cpp:15:
./include/lgraph/olap_base.h: In lambda function:
./include/lgraph/olap_base.h:704:46: error: 'this' not specified in enclosing 'parallel'
  704 |               for (size_t ei = 0; ei < this->num_edges_; ei++) {
      |                                        ~~~~~~^~~~~~~~~~
./include/lgraph/olap_base.h:703:9: note: enclosing 'parallel'
  703 | #pragma omp parallel for default(none)
      |         ^~~
./include/lgraph/olap_base.h: In lambda function:
./include/lgraph/olap_base.h:762:46: error: 'this' not specified in enclosing 'parallel'
  762 |               for (size_t ei = 0; ei < this->num_edges_; ei++) {
      |                                        ~~~~~~^~~~~~~~~~
./include/lgraph/olap_base.h:761:9: note: enclosing 'parallel'
  761 | #pragma omp parallel for default(none)
      |         ^~~
ninja: job failed: /usr/bin/g++  -I./include -I./src -I/usr/include/python3.11 -isystem ./deps/install/include -isystem /usr/local/include -fomit-frame-pointer -DNO_STACKTRACE -Wall -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-value -Wno-unused-function -Wno-reorder -DLGRAPH_USE_MOCK_KV=0 -D__STDC_FORMAT_MACROS -fopenmp -std=c++17 -static-libstdc++ -static-libgcc -O3 -DNDEBUG -std=gnu++17 -MD -MT plugins/CMakeFiles/lcc_standalone.dir/cpp/lcc_standalone.cpp.o -MF plugins/CMakeFiles/lcc_standalone.dir/cpp/lcc_standalone.cpp.o.d -o plugins/CMakeFiles/lcc_standalone.dir/cpp/lcc_standalone.cpp.o -c ./plugins/cpp/lcc_standalone.cpp
In file included from ./src/olap/olap_config.h:20,
                 from ./src/olap/olap_io.h:22,
                 from ./src/olap/olap_on_disk.h:17,
                 from ./plugins/cpp/lcc_standalone.cpp:15:
./include/lgraph/olap_base.h: In lambda function:
./include/lgraph/olap_base.h:704:46: error: 'this' not specified in enclosing 'parallel'
  704 |               for (size_t ei = 0; ei < this->num_edges_; ei++) {
      |                                        ~~~~~~^~~~~~~~~~
./include/lgraph/olap_base.h:703:9: note: enclosing 'parallel'
  703 | #pragma omp parallel for default(none)
      |         ^~~
./include/lgraph/olap_base.h: In lambda function:
./include/lgraph/olap_base.h:762:46: error: 'this' not specified in enclosing 'parallel'
  762 |               for (size_t ei = 0; ei < this->num_edges_; ei++) {
      |                                        ~~~~~~^~~~~~~~~~
./include/lgraph/olap_base.h:761:9: note: enclosing 'parallel'
  761 | #pragma omp parallel for default(none)
      |         ^~~

Environment:

Additional context

knightast commented 1 year ago

It seems openmp is not correctly installed. Maybe you can refer the Dockerfile for compile environment, I haven't tried Alpine.

https://github.com/TuGraph-family/tugraph-db/blob/master/ci/images/tugraph-compile-centos7-Dockerfile#L31 https://github.com/TuGraph-family/tugraph-db/blob/master/ci/images/tugraph-compile-centos7-Dockerfile#L218

qishipengqsp commented 1 year ago

Add this to Good first issue. TODO: support GCC12 compilation