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

gtest.h not found on Mac using Conda #287

Open
joansola opened this issue Mar 15, 2024 · 9 comments
Open

gtest.h not found on Mac using Conda #287

joansola opened this issue Mar 15, 2024 · 9 comments

Comments

@joansola
Copy link
Collaborator

joansola commented Mar 15, 2024

Compilation error gtest/gtest.h file not found.

I install my packages using mamba which is a wrapper over conda.

Here's my setup using mamba (with conda would be the same):

mamba create -n manif
mamba activate manif
mamba install eigen ceres-solver gtest autodiff make

The build setup using cmake

mkdir build
cd build
cmake --install-prefix=/Users/xxxx/mambaforge/envs/manif ..

then with ccmake I activate testing and examples. This is the ccmake setup:

 BUILD_BENCHMARKING               OFF                                                                                                        
 BUILD_EXAMPLES                   ON                                                                                                         
 BUILD_PYTHON_BINDINGS            OFF                                                                                                        
 BUILD_TESTING                    ON                                                                                                         
 BUILD_TESTING_PYTHON             OFF                                                                                                        
 CMAKE_BUILD_TYPE                                                                                                                            
 CMAKE_INSTALL_PREFIX             /Users/xxxx/mambaforge/envs/manif                                                                         
 CMAKE_OSX_ARCHITECTURES                                                                                                                     
 CMAKE_OSX_DEPLOYMENT_TARGET                                                                                                                 
 CMAKE_OSX_SYSROOT                /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk                                                    
 Ceres_DIR                        /Users/xxxx/mambaforge/envs/manif/lib/cmake/Ceres                                                         
 ENABLE_CPPCHECK                  OFF                                                                                                        
 Eigen3_DIR                       /Users/xxxx/mambaforge/envs/manif/share/eigen3/cmake                                                      
 GTest_DIR                        /Users/xxxx/mambaforge/envs/manif/lib/cmake/GTest                                                         
 SuiteSparse_DIR                  SuiteSparse_DIR-NOTFOUND                                                                                   
 TBB_DIR                          TBB_DIR-NOTFOUND                                                                                           
 USE_SYSTEM_WIDE_TL_OPTIONAL      OFF                                                                                                        
 autodiff_DIR                     /Users/xxxx/mambaforge/envs/manif/lib/cmake/autodiff                                                      
 gflags_DIR                       /Users/xxxx/mambaforge/envs/manif/lib/cmake/gflags                                                        
 glog_DIR                         /Users/xxxx/mambaforge/envs/manif/lib/cmake/glog                                                          
 tl-optional_DIR                  tl-optional_DIR-NOTFOUND                                                                                   

see that all deps are found, including gtest.

Then compiling fails:

(manif) jsola@travessani build % make
[  1%] Building CXX object examples/CMakeFiles/so2_average.dir/so2_average.cpp.o
[  2%] Linking CXX executable so2_average
[  2%] Built target so2_average
[  3%] Building CXX object examples/CMakeFiles/se2_average.dir/se2_average.cpp.o
[  5%] Linking CXX executable se2_average
[  5%] Built target se2_average
[  6%] Building CXX object examples/CMakeFiles/se2_interpolation.dir/se2_interpolation.cpp.o
[  7%] Linking CXX executable se2_interpolation
[  7%] Built target se2_interpolation
[  8%] Building CXX object examples/CMakeFiles/se2_decasteljau.dir/se2_DeCasteljau.cpp.o
[ 10%] Linking CXX executable se2_decasteljau
[ 10%] Built target se2_decasteljau
[ 11%] Building CXX object examples/CMakeFiles/se2_localization.dir/se2_localization.cpp.o
[ 12%] Linking CXX executable se2_localization
[ 12%] Built target se2_localization
[ 14%] Building CXX object examples/CMakeFiles/se2_localization_ukfm.dir/se2_localization_ukfm.cpp.o
[ 15%] Linking CXX executable se2_localization_ukfm
[ 15%] Built target se2_localization_ukfm
[ 16%] Building CXX object examples/CMakeFiles/se2_sam.dir/se2_sam.cpp.o
[ 17%] Linking CXX executable se2_sam
[ 17%] Built target se2_sam
[ 19%] Building CXX object examples/CMakeFiles/se3_localization.dir/se3_localization.cpp.o
[ 20%] Linking CXX executable se3_localization
[ 20%] Built target se3_localization
[ 21%] Building CXX object examples/CMakeFiles/se3_sam.dir/se3_sam.cpp.o
[ 23%] Linking CXX executable se3_sam
[ 23%] Built target se3_sam
[ 24%] Building CXX object examples/CMakeFiles/se3_sam_selfcalib.dir/se3_sam_selfcalib.cpp.o
[ 25%] Linking CXX executable se3_sam_selfcalib
[ 25%] Built target se3_sam_selfcalib
[ 26%] Building CXX object examples/CMakeFiles/se_2_3_localization.dir/se_2_3_localization.cpp.o
[ 28%] Linking CXX executable se_2_3_localization
[ 28%] Built target se_2_3_localization
[ 29%] Building CXX object examples/CMakeFiles/bundle_sam.dir/bundle_sam.cpp.o
[ 30%] Linking CXX executable bundle_sam
[ 30%] Built target bundle_sam
[ 32%] Building CXX object test/CMakeFiles/gtest_misc.dir/gtest_misc.cpp.o
/Users/xxxx/dev/manif/test/gtest_misc.cpp:1:10: fatal error: 'gtest/gtest.h' file not found
#include <gtest/gtest.h>
         ^~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [test/CMakeFiles/gtest_misc.dir/gtest_misc.cpp.o] Error 1
make[1]: *** [test/CMakeFiles/gtest_misc.dir/all] Error 2
make: *** [all] Error 2
@joansola
Copy link
Collaborator Author

The end of the cmake command gives us a clue of what is possibly going on:

 CMake Warning (dev) at test/CMakeLists.txt:37 (add_dependencies):
   Policy CMP0046 is not set: Error on non-existent dependency in
   add_dependencies.  Run "cmake --help-policy CMP0046" for policy details.
   Use the cmake_policy command to set the policy and suppress this warning.

   The dependency target "gtest" of target "gtest_misc" does not exist.
 Call Stack (most recent call first):
   test/CMakeLists.txt:53 (manif_add_gtest)
 This warning is for project developers.  Use -Wno-dev to suppress it.
 CMake Warning (dev) at test/CMakeLists.txt:37 (add_dependencies):
   Policy CMP0046 is not set: Error on non-existent dependency in
   add_dependencies.  Run "cmake --help-policy CMP0046" for policy details.
   Use the cmake_policy command to set the policy and suppress this warning.

   The dependency target "gtest" of target "gtest_rn" does not exist.
 Call Stack (most recent call first):
   test/rn/CMakeLists.txt:3 (manif_add_gtest)
 This warning is for project developers.  Use -Wno-dev to suppress it.
 CMake Warning (dev) at test/CMakeLists.txt:37 (add_dependencies):
   Policy CMP0046 is not set: Error on non-existent dependency in
   add_dependencies.  Run "cmake --help-policy CMP0046" for policy details.
   Use the cmake_policy command to set the policy and suppress this warning.

[...] // one block of this ^^^ for each target

@artivis
Copy link
Owner

artivis commented Mar 15, 2024

Could you try to also install gmock alongside gtest?

@joansola
Copy link
Collaborator Author

OK what I did is uninstall gtest and run ccmake again. the option INSTALL_GTEST was then ON,, and now it works. Also, BUILD_GMOCK is now ON

@joansola
Copy link
Collaborator Author

I however now have trouble with autodiff. I will also uninstall it and proceed with this minimal setup

@artivis
Copy link
Owner

artivis commented Mar 15, 2024

Don't bother with the autodiff library for now, I haven't added sgal to that set of tests. Ceres auto diff only at the moment.

@joansola
Copy link
Collaborator Author

Oh, the autodiff issue is probably because I need an old version of ceres-solver, since local_parametrization is deprecated in ceres in favor of teh new Manifold class.

@artivis
Copy link
Owner

artivis commented Mar 15, 2024

Oh, the autodiff issue is probably because I need an old version of ceres-solver, since local_parametrization is deprecated in ceres in favor of teh new Manifold class.

Right, I haven't ported manif to the new Ceres framework yet.

@joansola
Copy link
Collaborator Author

OK now I have it.

Pre-installed gtest did not work -- maybe this could be fixed

Uninstalled ceres-solver, autodiff, gtest

cmake --> make --> OK !

All tests pass except for sgal3 which is the one I wanted to check.

Thanks.

@artivis
Copy link
Owner

artivis commented Mar 15, 2024

again, I think it's a ceres version issue related to local_parametrization being obsolete. What do you think?

Yeah manif doesn't support the 'new' Ceres yet (#288). If you can install an older Ceres version that would work.
Otherwise I'll see to add support for autodiff.

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

2 participants