systemed / tilemaker

Make OpenStreetMap vector tiles without the stack
https://tilemaker.org/
Other
1.44k stars 229 forks source link

can't make & sudo make install #518

Closed WHM1 closed 8 months ago

WHM1 commented 1 year ago

PC: macOs Apple M1 Pro I downloaded the tilemaker project and installed all dependencies according to install.md, but there were some errors when executing make and sudo make install. I hope you can help me take a look.

% make Using Lua 5.1 (include path is -I/opt/homebrew/include/lua5.1, library path is -llua5.1) protoc --proto_path=include --cpp_out=include include/osmformat.proto c++ -O3 -Wall -Wno-unknown-pragmas -Wno-sign-compare -std=c++14 -pthread -fPIE -DTM_VERSION=v2.4.0 -o include/osmformat.pb.o -c include/osmformat.pb.cc -I/opt/homebrew/include -isystem ./include -I./src -I/opt/homebrew/include/lua5.1 In file included from include/osmformat.pb.cc:4: In file included from ./include/osmformat.pb.h:24: In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:134: In file included from /opt/homebrew/include/absl/strings/cord.h:78: In file included from /opt/homebrew/include/absl/container/inlined_vector.h:53: In file included from /opt/homebrew/include/absl/container/internal/inlined_vector.h:30: In file included from /opt/homebrew/include/absl/container/internal/compressed_tuple.h:40: /opt/homebrew/include/absl/utility/utility.h:164:12: error: no member named 'in_place_t' in namespace 'std' using std::in_place_t;


/opt/homebrew/include/absl/utility/utility.h:165:12: error: no member named 'in_place' in namespace 'std'
using std::in_place;
      ~~~~~^
/opt/homebrew/include/absl/utility/utility.h:181:12: error: no member named 'in_place_type' in namespace 'std'
using std::in_place_type;
      ~~~~~^
/opt/homebrew/include/absl/utility/utility.h:182:12: error: no member named 'in_place_type_t' in namespace 'std'
using std::in_place_type_t;
      ~~~~~^
/opt/homebrew/include/absl/utility/utility.h:198:12: error: no member named 'in_place_index' in namespace 'std'
using std::in_place_index;
      ~~~~~^
/opt/homebrew/include/absl/utility/utility.h:199:12: error: no member named 'in_place_index_t' in namespace 'std'
using std::in_place_index_t;
      ~~~~~^
In file included from include/osmformat.pb.cc:4:
In file included from ./include/osmformat.pb.h:24:
In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:134:
In file included from /opt/homebrew/include/absl/strings/cord.h:78:
In file included from /opt/homebrew/include/absl/container/inlined_vector.h:53:
In file included from /opt/homebrew/include/absl/container/internal/inlined_vector.h:30:
/opt/homebrew/include/absl/container/internal/compressed_tuple.h:107:36: error: no type named 'in_place_t' in namespace 'absl'
  explicit constexpr Storage(absl::in_place_t, V&& v)
                             ~~~~~~^
/opt/homebrew/include/absl/container/internal/compressed_tuple.h:120:36: error: no type named 'in_place_t' in namespace 'absl'
  explicit constexpr Storage(absl::in_place_t, V&& v)
                             ~~~~~~^
/opt/homebrew/include/absl/container/internal/compressed_tuple.h:143:48: error: no type named 'in_place_t' in namespace 'absl'
  explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args)
                                         ~~~~~~^
/opt/homebrew/include/absl/container/internal/compressed_tuple.h:144:24: error: no member named 'in_place' in namespace 'absl'; did you mean 'isspace'?
      : Storage<Ts, I>(absl::in_place, absl::forward<Vs>(args))... {}
                       ^~~~~~~~~~~~~~
                       isspace
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/_ctype.h:267:1: note: 'isspace' declared here
isspace(int _c)
^
In file included from include/osmformat.pb.cc:4:
In file included from ./include/osmformat.pb.h:24:
In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:134:
In file included from /opt/homebrew/include/absl/strings/cord.h:78:
In file included from /opt/homebrew/include/absl/container/inlined_vector.h:53:
In file included from /opt/homebrew/include/absl/container/internal/inlined_vector.h:30:
/opt/homebrew/include/absl/container/internal/compressed_tuple.h:155:48: error: no type named 'in_place_t' in namespace 'absl'
  explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args)
                                         ~~~~~~^
/opt/homebrew/include/absl/container/internal/compressed_tuple.h:156:31: error: no member named 'in_place' in namespace 'absl'; did you mean 'isspace'?
      : Storage<Ts, I, false>(absl::in_place, absl::forward<Vs>(args))... {}
                              ^~~~~~~~~~~~~~
                              isspace
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/_ctype.h:267:1: note: 'isspace' declared here
isspace(int _c)
^
In file included from include/osmformat.pb.cc:4:
In file included from ./include/osmformat.pb.h:24:
In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:134:
In file included from /opt/homebrew/include/absl/strings/cord.h:78:
In file included from /opt/homebrew/include/absl/container/inlined_vector.h:53:
In file included from /opt/homebrew/include/absl/container/internal/inlined_vector.h:30:
/opt/homebrew/include/absl/container/internal/compressed_tuple.h:242:46: error: no member named 'in_place' in namespace 'absl'; did you mean 'isspace'?
      : CompressedTuple::CompressedTupleImpl(absl::in_place, base...) {}
                                             ^~~~~~~~~~~~~~
                                             isspace
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/_ctype.h:267:1: note: 'isspace' declared here
isspace(int _c)
^
In file included from include/osmformat.pb.cc:4:
In file included from ./include/osmformat.pb.h:24:
In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:134:
In file included from /opt/homebrew/include/absl/strings/cord.h:78:
In file included from /opt/homebrew/include/absl/container/inlined_vector.h:53:
In file included from /opt/homebrew/include/absl/container/internal/inlined_vector.h:30:
/opt/homebrew/include/absl/container/internal/compressed_tuple.h:254:46: error: no member named 'in_place' in namespace 'absl'; did you mean 'isspace'?
      : CompressedTuple::CompressedTupleImpl(absl::in_place,
                                             ^~~~~~~~~~~~~~
                                             isspace
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/_ctype.h:267:1: note: 'isspace' declared here
isspace(int _c)
^
In file included from include/osmformat.pb.cc:4:
In file included from ./include/osmformat.pb.h:24:
In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:134:
In file included from /opt/homebrew/include/absl/strings/cord.h:98:
/opt/homebrew/include/absl/types/optional.h:48:12: error: no member named 'optional' in namespace 'std'
using std::optional;
      ~~~~~^
/opt/homebrew/include/absl/types/optional.h:49:12: error: no member named 'make_optional' in namespace 'std'
using std::make_optional;
      ~~~~~^
/opt/homebrew/include/absl/types/optional.h:50:12: error: no member named 'nullopt_t' in namespace 'std'; did you mean 'nullptr_t'?
using std::nullopt_t;
      ~~~~~^~~~~~~~~
           nullptr_t
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/c++/v1/__nullptr:56:31: note: 'nullptr_t' declared here
    typedef decltype(nullptr) nullptr_t;
                              ^
In file included from include/osmformat.pb.cc:4:
In file included from ./include/osmformat.pb.h:24:
In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:134:
In file included from /opt/homebrew/include/absl/strings/cord.h:98:
/opt/homebrew/include/absl/types/optional.h:51:12: error: no member named 'nullopt' in namespace 'std'
using std::nullopt;
      ~~~~~^
In file included from include/osmformat.pb.cc:4:
In file included from ./include/osmformat.pb.h:24:
In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:134:
/opt/homebrew/include/absl/strings/cord.h:719:9: error: no template named 'optional' in namespace 'absl'
  absl::optional<absl::string_view> TryFlat() const;
  ~~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [include/osmformat.pb.o] Error 1
rm include/osmformat.pb.cc

% sudo make install
Password:
Using Lua 5.1 (include path is -I/opt/homebrew/include/lua5.1, library path is -llua5.1)
install -m 0755 -d /usr/local/bin/
install -m 0755 tilemaker /usr/local/bin/
install: tilemaker: No such file or directory
make: *** [install] Error 71
systemed commented 1 year ago

This is the same as #502 - Google appear to have broken protobuf. If you can install an earlier version of the protobuf library it may work.

Unfortunately I’m away from my development machine for a few weeks and unlikely to be able to address this though someone else may have a solution. But you could try uninstalling the version of protobuf that’s been installed, and then brew install protobuf@21.

WHM1 commented 1 year ago

I tried the old version protobuf@21, but it seems that there are new issues % make Using Lua 5.1 (include path is -I/opt/homebrew/include/lua5.1, library path is -llua5.1) protoc --proto_path=include --cpp_out=include include/osmformat.proto make: protoc: No such file or directory make: *** [include/osmformat.pb.cc] Error 1

systemed commented 1 year ago

Maybe it installs protoc under a different name - protoc21 or something. If you type proto into Terminal then press tab, what does it autocomplete with?

WHM1 commented 1 year ago

protoc % protoc protoc protoc-23.4.0

glenselle commented 1 year ago

Running brew install protobuf@21 is keg only. This means it does not symlink into /opt/homebrew/include so the compiler cannot locate the files. When you run make the c++ command it runs is printed:

c++ -O3 -Wall -Wno-unknown-pragmas -Wno-sign-compare -std=c++14 -pthread -fPIE -DTM_VERSION=v2.4.0  -o include/osmformat.pb.o -c include/osmformat.pb.cc -I/opt/homebrew/include -isystem ./include -I./src -I/opt/homebrew/include/lua5.1

Notice how it includes from /opt/homebrew/include but the keg-only version of protobuf@21 specifically says (after installation):

For compilers to find protobuf@21 you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/protobuf@21/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/protobuf@21/include"

If you modify line 82 and 83 of the Makefile you can add the protobuf library and include paths:

LIB := -L$(PLATFORM_PATH)/lib -L/opt/homebrew/opt/protobuf@21/lib -lz $(LUA_LIBS) -lboost_program_options -lsqlite3 -lboost_filesystem -lboost_system -lboost_iostreams -lprotobuf -lshp -pthread
INC := -I$(PLATFORM_PATH)/include -I/opt/homebrew/opt/protobuf@21/include -isystem ./include -I./src $(LUA_CFLAGS)

Re-run make and compilation will succeed. @systemed Would it make sense to add $(LDFLAGS) and $(CPPFLAGS) to the Makefile? Mac users would just need to export those two directories per the Homebrew installation note and they would be all set. Makefile would look like this:

LIB := -L$(PLATFORM_PATH)/lib $(LDFLAGS) -lz $(LUA_LIBS) -lboost_program_options -lsqlite3 -lboost_filesystem -lboost_system -lboost_iostreams -lprotobuf -lshp -pthread
INC := -I$(PLATFORM_PATH)/include $(CPPFLAGS) -isystem ./include -I./src $(LUA_CFLAGS)

I'm also willing to submit a PR to do this and a little note in the install docs for Mac users to export those following brew install of protobuf.

systemed commented 1 year ago

That’s really helpful - thank you. A PR to do that would be excellent.

jesperp commented 1 year ago

Thanks for these instructions @glenselle! It was one thing that tripped me up still that others might encounter too. I was running the newer protoc binary with the protobuf@21 headers. To run the old binary as well, simply do:

export PATH="/opt/homebrew/opt/protobuf@21/bin:$PATH

...before running make

systemed commented 8 months ago

Fixed in v3.0.