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

Failing to compile libosmium: 'protozero/types.hpp' file not found #342

Closed
Selina22 opened this issue Nov 29, 2021 · 5 comments
Closed

Failing to compile libosmium: 'protozero/types.hpp' file not found #342

Selina22 opened this issue Nov 29, 2021 · 5 comments

Comments

@Selina22
Copy link

Hi, I'm using the latest version of libosmium and protozero, and am currently trying to set up everything. I tried to run osmium_read.cpp under the examples directory and receive the error:

In file included from osmium_read.cpp:19:
In file included from /usr/local/include/osmium/io/any_input.hpp:48:
In file included from /usr/local/include/osmium/io/o5m_input.hpp:42:
/usr/local/include/osmium/io/detail/o5m_input_format.hpp:56:10: fatal error: 'protozero/exception.hpp' file not found
#include <protozero/exception.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

I followed through the guide and set up everything properly. I also saw this ticket here (osmcode/osmium-tool#127) and manually edited the protozero include path, but I still get this error. How can I resolve this issue?

@joto
Copy link
Member

joto commented Nov 29, 2021

Looks like there is an error somewhere in what you did but from your vague description ("latest version of libosmium and protozero", "set up everything properly", "manually edited the protozero include path") we can't figure out what that is. Show us all the commands you used and their output. Maybe we can figure it out then.

@Selina22
Copy link
Author

I cloned the latest version of libosmium and protozero from GitHub, and they are saved in the same directory. Then in the libosmium directory, I created the build directory and ran cmake .. and make within, and here is the output result from ccmake .. under the build directory:

 BUILD_BENCHMARKS                 OFF                                                                                                               
 BUILD_DATA_TESTS                 OFF                                                                                                               
 BUILD_EXAMPLES                   ON                                                                                                                
 BUILD_HEADERS                    OFF                                                                                                               
 BUILD_TESTING                    ON                                                                                                                
 BUILD_WITH_CCACHE                OFF                                                                                                               
 CLANG_TIDY                       CLANG_TIDY-NOTFOUND                                                                                               
 CMAKE_BUILD_TYPE                 RelWithDebInfo                                                                                                    
 CMAKE_CONFIGURATION_TYPES        Debug;Release;RelWithDebInfo;MinSizeRel;Dev;Coverage                                                              
 CMAKE_CXX_FLAGS_COVERAGE         -g -O0 -fno-inline-functions -fno-inline --coverage                                                               
 CMAKE_EXECUTABLE_FORMAT          MACHO                                                                                                             
 CMAKE_EXE_LINKER_FLAGS_COVERAG   --coverage                                                                                                        
 CMAKE_INSTALL_PREFIX             /usr/local                                                                                                        
 CMAKE_OSX_ARCHITECTURES                                                                                                                            
 CMAKE_OSX_DEPLOYMENT_TARGET                                                                                                                        
 CMAKE_OSX_SYSROOT                /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk                                                           
 CPPCHECK                         CPPCHECK-NOTFOUND                                                                                                 
 EXAMPLES                         amenity_list;area_test;change_tags;convert;count;create_pois;debug;dump_internal;filter_discussions;index_lookup;l
 GDAL_CONFIG                      GDAL_CONFIG-NOTFOUND                                                                                              
 GDAL_INCLUDE_DIR                 GDAL_INCLUDE_DIR-NOTFOUND                                                                                         
 GDAL_LIBRARY                     GDAL_LIBRARY-NOTFOUND                                                                                             
 GEOS_INCLUDE_DIR                 GEOS_INCLUDE_DIR-NOTFOUND                                                                                         
 GEOS_LIBRARY                     GEOS_LIBRARY-NOTFOUND                                                                                             
 INSTALL_GDALCPP                  OFF                                                                                                               
 MEMORYCHECK_COMMAND              MEMORYCHECK_COMMAND-NOTFOUND                                                                                      
 OSMIUM_SKIPPED_TESTS              geom/test_crs                                                                                                    
 OSMIUM_WARNING_OPTIONS           -Wall -Wextra -pedantic -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloa
 PROJ_INCLUDE_DIR                 PROJ_INCLUDE_DIR-NOTFOUND                                                                                         
 PROJ_LIBRARY                     PROJ_LIBRARY-NOTFOUND                                                                                             
 PROTOZERO_INCLUDE_DIR            /Users/selinawan/work/protozero/include                                                                           
 WITH_PROFILING                   OFF                                                                                                               
 WITH_PROJ                        ON   

After that, I compiled the script under examples (g++ examples/osmium_read.cpp -std=c++11) and got the file not found error; however, I did clone protozero and the PROTOZERO_INCLUDE_DIR is correct.

That's pretty much all the steps I took just to try running osmium_read.cpp under the examples directory. Here is the version of GCC and Clang that I have:

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

I'm not sure where I messed up, and I hope that's enough information.

@joto
Copy link
Member

joto commented Nov 29, 2021

You can't just compile a program using g++ examples/osmium_read.cpp -std=c++11, because that way it will not use the configuration you created with cmake. Simply call make in your build directory to compily everything. Or, if you only want to compile one part of the whole thing, use that as parameter to make: make osmium_read in this case.

@Selina22
Copy link
Author

Ok I see. That works for me now, thanks!

Now, I still have the same file not found problem when I try to create my own project using osmium. I simply just inserted #include <osmium/io/any_input.hpp> in one of my .hpp files just to make sure everything is set up properly. I downloaded FindOsmium.cmake and FindProtozero.cmake and saved them to the project cmake directory. Here is my ccmake output:

 CMAKE_BUILD_TYPE                                                                
 CMAKE_EXECUTABLE_FORMAT          MACHO                                          
 CMAKE_INSTALL_PREFIX             /usr/local                                     
 CMAKE_OSX_ARCHITECTURES                                                         
 CMAKE_OSX_DEPLOYMENT_TARGET                                                     
 CMAKE_OSX_SYSROOT                /Library/Developer/CommandLineTools/SDKs/MacOSX
 OSMIUM_INCLUDE_DIR               /Users/selinawan/work/libosmium/include        
 OSMIUM_WARNING_OPTIONS           -Wall -Wextra -pedantic -Wredundant-decls -Wdis
 PROTOZERO_INCLUDE_DIR            /Users/selinawan/work/protozero/include  

When I compiled with make, I still got the file not found error:

/Users/selinawan/work/libosmium/include/osmium/io/detail/o5m_input_format.hpp:56:10: fatal error: 
      'protozero/exception.hpp' file not found
#include <protozero/exception.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

@joto
Copy link
Member

joto commented Nov 29, 2021

Sorry, this isn't a C++ help line, but a bug tracker for Osmium. Help on how to set up your own CMake configuration is waay beyond what we can provide here.

@joto joto closed this as completed Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants