Ultimaker / libArcus

Communication library between internal components for Ultimaker software

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

make error: *** target pattern contains no '%'. Stop.

D1plo1d opened this issue · comments

Trying to build libArcus I get:

$ make
[ 54%] Built target Arcus
examples/CMakeFiles/example.dir/build.make:65: *** target pattern contains no '%'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:127: examples/CMakeFiles/example.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

I'm following the README but I not experienced with make. Is there something I did wrong?

I found an option to disable the examples. Not sure why the problems exists but here's a workaround for anyone else who runs into the same issue:
cmake .. -DBUILD_PYTHON=OFF -DBUILD_EXAMPLES=OFF

Hmm, I'm not able to reproduce that problem. It's building fine for me:

trin@Trinity:~/Gedeeld/Projects/libArcus/build-linux2$ make clean
trin@Trinity:~/Gedeeld/Projects/libArcus/build-linux2$ make
[  4%] Building CXX object CMakeFiles/Arcus.dir/src/Socket.cpp.o
In file included from /home/trin/Gedeeld/Projects/libArcus/src/Socket.cpp:20:
/home/trin/Gedeeld/Projects/libArcus/src/Socket_p.h: In member function ‘void Arcus::Socket::Private::sendMessage(const MessagePtr&)’:
/home/trin/Gedeeld/Projects/libArcus/src/Socket_p.h:365:51: warning: ‘int google::protobuf::MessageLite::ByteSize() const’ is deprecated: Please use ByteSizeLong() instead [-Wdeprecated-declarations]
  365 |         uint32_t message_size = message->ByteSize();
      |                                                   ^
In file included from /home/trin/inst/include/google/protobuf/generated_enum_util.h:36,
                 from /home/trin/inst/include/google/protobuf/generated_enum_reflection.h:44,
                 from /home/trin/inst/include/google/protobuf/generated_message_reflection.h:48,
                 from /home/trin/inst/include/google/protobuf/message.h:122,
                 from /home/trin/Gedeeld/Projects/libArcus/src/Socket_p.h:41,
                 from /home/trin/Gedeeld/Projects/libArcus/src/Socket.cpp:20:
/home/trin/inst/include/google/protobuf/message_lite.h:402:7: note: declared here
  402 |   int ByteSize() const { return internal::ToIntSize(ByteSizeLong()); }
      |       ^~~~~~~~
In file included from /home/trin/Gedeeld/Projects/libArcus/src/Socket.cpp:20:
/home/trin/Gedeeld/Projects/libArcus/src/Socket_p.h: In member function ‘void Arcus::Socket::Private::handleMessage(const std::shared_ptr<Arcus::Private::WireMessage>&)’:
/home/trin/Gedeeld/Projects/libArcus/src/Socket_p.h:551:77: warning: ‘void google::protobuf::io::CodedInputStream::SetTotalBytesLimit(int, int)’ is deprecated: Please use the single parameter version of SetTotalBytesLimit(). The second parameter is ignored. [-Wdeprecated-declarations]
  551 |         stream.SetTotalBytesLimit(message_size_maximum, message_size_warning);
      |                                                                             ^
In file included from /home/trin/inst/include/google/protobuf/message_lite.h:47,
                 from /home/trin/inst/include/google/protobuf/generated_enum_util.h:36,
                 from /home/trin/inst/include/google/protobuf/generated_enum_reflection.h:44,
                 from /home/trin/inst/include/google/protobuf/generated_message_reflection.h:48,
                 from /home/trin/inst/include/google/protobuf/message.h:122,
                 from /home/trin/Gedeeld/Projects/libArcus/src/Socket_p.h:41,
                 from /home/trin/Gedeeld/Projects/libArcus/src/Socket.cpp:20:
/home/trin/inst/include/google/protobuf/io/coded_stream.h:397:8: note: declared here
  397 |   void SetTotalBytesLimit(int total_bytes_limit, int) {
      |        ^~~~~~~~~~~~~~~~~~
[  9%] Building CXX object CMakeFiles/Arcus.dir/src/SocketListener.cpp.o
[ 13%] Building CXX object CMakeFiles/Arcus.dir/src/MessageTypeStore.cpp.o
[ 18%] Building CXX object CMakeFiles/Arcus.dir/src/PlatformSocket.cpp.o
[ 22%] Building CXX object CMakeFiles/Arcus.dir/src/Error.cpp.o
[ 27%] Linking CXX shared library libArcus.so
[ 27%] Built target Arcus
[ 31%] Generating python/sipArcuspart0.cpp, python/sipArcuspart1.cpp, python/sipArcuspart2.cpp, python/sipArcuspart3.cpp, python/sipArcuspart4.cpp, python/sipArcuspart5.cpp, python/sipArcuspart6.cpp, python/sipArcuspart7.cpp

Scanning dependencies of target python_module_Arcus
[ 31%] Generating python/sipArcuspart0.cpp, python/sipArcuspart1.cpp, python/sipArcuspart2.cpp, python/sipArcuspart3.cpp, python/sipArcuspart4.cpp, python/sipArcuspart5.cpp, python/sipArcuspart6.cpp, python/sipArcuspart7.cpp

[ 36%] Building CXX object CMakeFiles/python_module_Arcus.dir/python/sipArcuspart0.cpp.o
[ 40%] Building CXX object CMakeFiles/python_module_Arcus.dir/python/sipArcuspart1.cpp.o
[ 45%] Building CXX object CMakeFiles/python_module_Arcus.dir/python/sipArcuspart2.cpp.o
[ 50%] Building CXX object CMakeFiles/python_module_Arcus.dir/python/sipArcuspart3.cpp.o
[ 54%] Building CXX object CMakeFiles/python_module_Arcus.dir/python/sipArcuspart4.cpp.o
[ 59%] Building CXX object CMakeFiles/python_module_Arcus.dir/python/sipArcuspart5.cpp.o
[ 63%] Building CXX object CMakeFiles/python_module_Arcus.dir/python/sipArcuspart6.cpp.o
[ 68%] Building CXX object CMakeFiles/python_module_Arcus.dir/python/sipArcuspart7.cpp.o
[ 72%] Building CXX object CMakeFiles/python_module_Arcus.dir/python/PythonMessage.cpp.o
[ 77%] Linking CXX shared library Arcus.so
[ 77%] Built target python_module_Arcus
[ 81%] Running cpp protocol buffer compiler on example.proto
[ 86%] Running Python protocol buffer compiler on example.proto
[ 90%] Building CXX object examples/CMakeFiles/example.dir/example.cpp.o
[ 90%] Running cpp protocol buffer compiler on example.proto
[ 95%] Building CXX object examples/CMakeFiles/example.dir/example.pb.cc.o
[100%] Linking CXX executable example
[100%] Built target example

Can you see what's happening on line 65 of examples/CMakeFiles/example.dir/build.make?

I am also observing this error, at

[ 77%] Built target python_module_Arcus
examples/CMakeFiles/example.dir/build.make:65: *** target pattern contains no '%'.  Stop.
CMakeFiles/Makefile2:159: recipe for target 'examples/CMakeFiles/example.dir/all' failed
make[1]: *** [examples/CMakeFiles/example.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2

My examples/CMakeFiles/example.dir/build.make file, from lines 64 to line 67:

[64] examples/example.pb.cc: ../examples/example.proto
[65] examples/example.pb.cc: ../examples/protobuf::protoc
[66]	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold --progress-dir=/home/hammond/Documents/cura-building/libArcus/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Running C++ protocol buffer compiler on example.proto"
[67]	cd /home/hammond/Documents/cura-building/libArcus/build/examples && protobuf::protoc --cpp_out=/home/hammond/Documents/cura-building/libArcus/build/examples -I /home/hammond/Documents/cura-building/libArcus/examples /home/hammond/Documents/cura-building/libArcus/examples/example.proto

Like the OP, if I disable building the examples I have no error.

I have noticed this error happening occasionally when building libArcus on Windows, but it usually occurs if I use the standard cmd instead of the "x64 Native Tool Command Prompt for VS 2019.exe" to build it. The error itself is difficult to debug. I will try to reproduce it again and I will see about adding the proposed workaround in the wiki page.

If it helps, I was building it on Ubuntu 18.04.

What is the value of your ${PROTOBUF_PROTOC_EXECUTABLE} variable in CMake?
From that snippet from Kiwih, it sort of looks as if it wrote protobuf::protoc as the executable file, which is not a valid path to an executable file. That may be what it's complaining about.

And if so, the question remains how it got to that variable name. I have not the faintest idea how it could arrive at that path.

I could reproduce the problem in CuraEngine and it went away when I replaced the environmental variables in the cmake arguments with the absolute paths. So instead of running
cmake -DCMAKE_INSTALL_PREFIX=../install_dir -DPROTOBUF_SRC_ROOT_FOLDER=%PROTOBUF_SRC% -DPROTOBUF_LIBRARY=%PROTOBUF_INSTALL%/lib/libprotobuf.lib -DPROTOBUF_INCLUDE_DIR=%PROTOBUF_INSTALL%/include -DPROTOBUF_PROTOC_EXECUTABLE=%PROTOBUF_INSTALL%/bin/protoc.exe -DBUILD_EXAMPLES=OFF -DBUILD_STATIC=ON -DMSVC_STATIC_RUNTIME=ON -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" ..

I run
cmake -DCMAKE_INSTALL_PREFIX=../install_dir -DPROTOBUF_SRC_ROOT_FOLDER=C:/<path>/<to>/protobuf-3.0.0-mingw/ -DPROTOBUF_LIBRARY=C:/<path>/<to>/protobuf-3.0.0-mingw/install_dir/lib/libprotobuf.lib -DPROTOBUF_INCLUDE_DIR=C:/<path>/<to>/protobuf-3.0.0-mingw/install_dir/include -DPROTOBUF_PROTOC_EXECUTABLE=C:/<path>/<to>/protobuf-3.0.0-mingw/install_dir/bin/protoc.exe -DBUILD_EXAMPLES=OFF -DBUILD_STATIC=ON -DMSVC_STATIC_RUNTIME=ON -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" ...

My guess is that it somehow fails to resolve the environmental variables for some reason.

@D1plo1d can you try it and verify whether that fixes the problem? (make sure to replace the paths with your own)

@konskarm Sorry, I've no longer got LibArcus on my computer. Had to focus on other things.

In case anyone comes here with the same question, @Ghostkeeper is correct because protobuf::protoc serves as a placeholder when protoc is not found. Installing that (i.e. sudo apt install protobuf-compiler on Ubuntu) solves the issue.