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

build fail with error on Ubuntu20.04 #365

Open
kusa-dowsing opened this issue May 23, 2024 · 7 comments
Open

build fail with error on Ubuntu20.04 #365

kusa-dowsing opened this issue May 23, 2024 · 7 comments

Comments

@kusa-dowsing
Copy link

version: master

os: wsl2 ubuntu20.04

cmake option: cmake -DCMAKE_CXX_STANDARD=17 -DWITH_GFLAGS=ON -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DCMAKE_INSTALL_LIBDIR=${INSTALL_DIR}/lib ..

error: call to non-‘constexpr’ function
/s2geometry/src/s2/s1chord_angle.h:311:43: error: call to non-‘constexpr’ function ‘T util::math::internal_vector::BasicVector<VecTemplate, T, N>::Norm2() const [with VecTemplate = Vector3; T = double; long unsigned int N = 3]’
/s2geometry/src/s2/s1chord_angle.h:311:43: error: call to non-‘constexpr’ function ‘T util::math::internal_vector::BasicVector<VecTemplate, T, N>::Norm2() const [with VecTemplate = Vector3; T = double; long unsigned int N = 3]’
s2geometry/src/s2/s1chord_angle.h:311:43: error: call to non-‘constexpr’ function ‘T util::math::internal_vector::BasicVector<VecTemplate, T, N>::Norm2() const [with VecTemplate = Vector3; T = double; long unsigned int N = 3]’

screenshot-20240523-161927

@jmr
Copy link
Member

jmr commented May 24, 2024

Thanks for the report. We already fixed this in the internal version by removing constexpr from a bunch of functions. I'll do a new code push in the next few weeks.

@kusa-dowsing
Copy link
Author

Thanks for the report. We already fixed this in the internal version by removing constexpr from a bunch of functions. I'll do a new code push in the next few weeks.

A New Error was occurred.
after i removed the constexpr, i built the lib successfully. But when i used the s2 lib, i got A new Error, like:
/home/tsh/workspace/auto_pro/modules/cmake_modules/../../third_party/x86_64/include/s2/base/log_severity.h:27:16: error: ‘constexpr const bool google::DEBUG_MODE’ redeclared as different kind of entity
27 | constexpr bool DEBUG_MODE = true;
| ^~~~~~~~~~
In file included from /usr/include/glog/logging.h:512,
from /home/tsh/workspace/auto_pro/opt/include/openads/modules/ads_common/common/ulog.h:30,
from /home/tsh/workspace/auto_pro/opt/include/openads/modules/ads_common/common/environment.h:25,
from /home/tsh/workspace/auto_pro/modules/applications/ped_trick/src/geo_trajectory.h:6,
from /home/tsh/workspace/auto_pro/modules/applications/ped_trick/src/geo_trajectory.cc:1:
/usr/include/glog/log_severity.h:88:8: note: previous declaration ‘google:: google::DEBUG_MODE’
88 | enum { DEBUG_MODE = 1 };

image
it looks like the s2geometry need the specified version of glog, but i don't know which version would be used for s2, can you show me the right one?

@jmr
Copy link
Member

jmr commented May 28, 2024

In file included from /usr/include/glog/logging.h:512,
from /home/tsh/workspace/auto_pro/opt/include/openads/modules/ads_common/common/ulog.h:30,

We don't use glog anymore. Can you switch to abseil-cpp logging?

S2 should not be defining google::DEBUG_MODE, though. I guess we should call it S2_DEBUG_MODE.

@kusa-dowsing
Copy link
Author

In file included from /usr/include/glog/logging.h:512,
from /home/tsh/workspace/auto_pro/opt/include/openads/modules/ads_common/common/ulog.h:30,

We don't use glog anymore. Can you switch to abseil-cpp logging?

S2 should not be defining google::DEBUG_MODE, though. I guess we should call it S2_DEBUG_MODE.

may be you wanna be compatible with glog?
image

@jmr
Copy link
Member

jmr commented May 29, 2024

The comment is now wrong and this definition is making us incompatible with glog.

@Mechree
Copy link

Mechree commented Jun 13, 2024

version: master

os: wsl2 ubuntu20.04

cmake option: cmake -DCMAKE_CXX_STANDARD=17 -DWITH_GFLAGS=ON -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DCMAKE_INSTALL_LIBDIR=${INSTALL_DIR}/lib ..

error: call to non-‘constexpr’ function /s2geometry/src/s2/s1chord_angle.h:311:43: error: call to non-‘constexpr’ function ‘T util::math::internal_vector::BasicVector<VecTemplate, T, N>::Norm2() const [with VecTemplate = Vector3; T = double; long unsigned int N = 3]’ /s2geometry/src/s2/s1chord_angle.h:311:43: error: call to non-‘constexpr’ function ‘T util::math::internal_vector::BasicVector<VecTemplate, T, N>::Norm2() const [with VecTemplate = Vector3; T = double; long unsigned int N = 3]’ s2geometry/src/s2/s1chord_angle.h:311:43: error: call to non-‘constexpr’ function ‘T util::math::internal_vector::BasicVector<VecTemplate, T, N>::Norm2() const [with VecTemplate = Vector3; T = double; long unsigned int N = 3]’

screenshot-20240523-161927

Hey, I ran into the same issue, and it turned out that the G++ is incompatible with s2geometry. After switching to the Clang compiler, I was able to successfully build and install s2geometry. I had to specify the compiler in the cmake command:

cmake -DWITH_GFLAGS=ON -DWITH_GTEST=ON \
-DGOOGLETEST_ROOT=/home/user/myvenv/Source/googletest \
-DOPENSSL_INCLUDE_DIR=/usr/lib/ssl \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_CXX_COMPILER=clang++ ..

@jmr
Copy link
Member

jmr commented Jun 25, 2024

Could you try with #367 ?

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

3 participants