rippled icon indicating copy to clipboard operation
rippled copied to clipboard

develop build error: target pattern contains no '%'

Open movitto opened this issue 5 years ago • 16 comments

While attempting to rebase #3197 I am encountered an error in (what I am guessing is) the new GRPC build logic. I switched over to a clean copy of the latest develop branch (commit 90d9ca901d - "Set version to 1.5.0-b3"), deleted all outstanding generated files and tried again to no avail. The complete error is below:

[ 22%] Performing build step for 'grpc_src'
Build output for /home/mmorsi/Workspace/rippled/.nih_c/unix_makefiles/GNU_9.2.1/Release/src/grpc_src-stamp/grpc_src-build : 
[  0%] Built target address_sorting
[  3%] Built target gpr
[  3%] Built target grpc_plugin_support

CMakeFiles/gen_percent_encoding_tables.dir/build.make:82: *** target pattern contains no '%'.  Stop.
gmake[4]: *** [CMakeFiles/Makefile2:257: CMakeFiles/gen_percent_encoding_tables.dir/all] Error 2
gmake[4]: *** Waiting for unfinished jobs....
gmake[3]: *** [Makefile:130: all] Error 2
CMake Error at /home/mmorsi/Workspace/rippled/.nih_c/unix_makefiles/GNU_9.2.1/Release/src/grpc_src-stamp/grpc_src-build-Release-impl.cmake:9 (message):
  Command failed (2):

   '/usr/bin/cmake' '--build' '.' '--config' 'Release' '--parallel' '4' ''

CMake Error at /home/mmorsi/Workspace/rippled/.nih_c/unix_makefiles/GNU_9.2.1/Release/src/grpc_src-stamp/grpc_src-build-Release.cmake:23 (message):
  Command failed: 1

   '/usr/bin/cmake' '-Dmake=' '-Dconfig=' '-P' '/home/mmorsi/Workspace/rippled/.nih_c/unix_makefiles/GNU_9.2.1/Release/src/grpc_src-stamp/grpc_src-build-Release-impl.cmake'

  See above

make[2]: *** [CMakeFiles/grpc_src.dir/build.make:114: ../.nih_c/unix_makefiles/GNU_9.2.1/Release/src/grpc_src-stamp/grpc_src-build] Error 1
make[1]: *** [CMakeFiles/Makefile2:723: CMakeFiles/grpc_src.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

The error seems to indicate the problem is occurring in the build configuration WRT the new GRPC logic, though can't say for sure what the root cause is. Inspecting further, the referenced file CMakeFiles/gen_percent_encoding_tables.dir/build.make does not seem to exist locally. Googling it a bit, it seem to reference a syntax issue in a build target, though perhaps someone "more in the know" w/ recent grpc additions / build modifications could advise further.

Local system: Fedora Linux (version 30) Cmake: Version 3.14.5 Let me know if I can help by providing any more info. Thank you.

movitto avatar Jan 22 '20 05:01 movitto

@movitto When you say you "deleted all outstanding generated files", does that include the .nih_c directory? @mellery451 is our cmake guru. He may have some suggestions as well.

seelabs avatar Jan 22 '20 13:01 seelabs

@seelabs Yes, I deleted the entire .nih_c directory which gets generated under the main project directory in addition to the entire content of the 'builds' subdirectory which I created to run cmake & make in

movitto avatar Jan 22 '20 17:01 movitto

the build.make file you are looking for would be in /home/mmorsi/Workspace/rippled/.nih_c/unix_makefiles/GNU_9.2.1/Release/src/grpc_src-build/CMakeFiles/gen_percent_encoding_tables.dir. That said, this is part of the gRPC build and I don't see any similar issues reported in their repo. I have not been able to repro this problem on mac or linux.

A couple of things to try:

  1. try passing -Dlocal_protobuf=ON when configuring rippled. I want to rule out any undesirable interaction with system installed protobuf tools.
  2. If you just want to get it working and don't mind installing from source, consider: https://github.com/ripple/rippled/blob/eb7c9d96bbf2b13cb6941889f0e7d25613aa706a/Builds/containers/shared/build_deps.sh#L51-L104. This is what we do for our build/test systems. The ExternalProject is supposed to work in general, but it's possible we've missed something.

mellery451 avatar Jan 22 '20 17:01 mellery451

@mellery451 thanks for the quick reply.

  • I don't seem to have that file locally either, this is the contents of the /home/mmorsi/Workspace/rippled/.nih_c/unix_makefiles/GNU_9.2.1/Release/src/grpc_src-stamp/ directory:
$ ls /home/mmorsi/Workspace/rippled/.nih_c/unix_makefiles/GNU_9.2.1/Release/src/grpc_src-stamp/ -l
total 32
-rw-rw-r-- 1 mmorsi mmorsi  606 Jan 22 16:59 grpc_src-build-err.log
-rw-rw-r-- 1 mmorsi mmorsi  100 Jan 22 16:59 grpc_src-build-out.log
-rw-rw-r-- 1 mmorsi mmorsi 1496 Jan 22 00:39 grpc_src-build-Release.cmake
-rw-rw-r-- 1 mmorsi mmorsi  303 Jan 22 00:39 grpc_src-build-Release-impl.cmake
-rw-rw-r-- 1 mmorsi mmorsi    0 Jan 22 16:59 grpc_src-configure
-rw-rw-r-- 1 mmorsi mmorsi    0 Jan 22 16:59 grpc_src-configure-err.log
-rw-rw-r-- 1 mmorsi mmorsi  441 Jan 22 16:59 grpc_src-configure-out.log
-rw-rw-r-- 1 mmorsi mmorsi 2564 Jan 22 00:39 grpc_src-configure-Release.cmake
-rw-rw-r-- 1 mmorsi mmorsi    0 Jan 22 00:44 grpc_src-download
-rw-r--r-- 1 mmorsi mmorsi   63 Jan 22 00:44 grpc_src-gitclone-lastrun.txt
-rw-r--r-- 1 mmorsi mmorsi   63 Jan 22 00:39 grpc_src-gitinfo.txt
-rw-rw-r-- 1 mmorsi mmorsi    0 Jan 22 00:41 grpc_src-mkdir
-rw-rw-r-- 1 mmorsi mmorsi    0 Jan 22 00:44 grpc_src-patch

Note there are no subdirectories under this.

  • Using the -Dlocal_protobuf=ON does not seem to have an effect. Deleting the .nih_c and build directories and trying a fresh build with that flag results in the same error

  • I'll try the building from source commands in a vm but would prefer not do a systemwide make install on my bare-metal machine (primary dev environment). Incidentally I notice your instructions indicating downloading / installing protobuf 3.10.1 where locally I have 3.6.1, perhaps that discrepancy is the cause of the issue?

  • What linux distro / version do you use?

movitto avatar Jan 22 '20 22:01 movitto

I mistyped that path above - sorry. It should be /home/mmorsi/Workspace/rippled/.nih_c/unix_makefiles/GNU_9.2.1/Release/src/grpc_src-build/CMakeFiles (also edited above).

I use ubuntu 18.04 for development. Your toolchain is quite modern and protobuf 3.6 should be fine.

I'm stumped. Since this seems to be a case of an incorrect makefile getting generated, I can suggest two other things to try:

  1. install latest cmake (3.16). I always run the latest release of cmake, FWIW. You can safely have multiple versions of cmake installed, so you don't need to step on the default version installed by your package manager.

  2. try the ninja generator instead of the default (makefiles) by passing -G Ninja during configure. (I also generally use ninja, BUT I did try to repro with makefiles and was not able to)

mellery451 avatar Jan 22 '20 22:01 mellery451

I mistyped that path above - sorry. It should be /home/mmorsi/Workspace/rippled/.nih_c/unix_makefiles/GNU_9.2.1/Release/src/grpc_src-build/CMakeFiles (also edited above).

@mellery451 Line 82 of gen_percent_encoding_tables.dir/build.make under this directory is as follows:

gen_percent_encoding_tables: protobuf::libprotobuf-NOTFOUND

I'm guessing this is probably not right.

I use ubuntu 18.04 for development. Your toolchain is quite modern and protobuf 3.6 should be fine.

I'm stumped. Since this seems to be a case of an incorrect makefile getting generated, I can suggest two other things to try:

1. install latest cmake (3.16). I always run the latest release of cmake, FWIW. You can safely have multiple versions of cmake installed, so you don't need to step on the default version installed by your package manager.

I downloaded the binary cmake 3.16 release for linux and used it to build the project (fresh build, deleting the files again) but again the same error. Same content in gen_percent_encoding_tables.dir/build.make as above.

2. try the ninja generator instead of the default (makefiles) by passing `-G Ninja` during configure. (I also generally use ninja, BUT I did try to repro with makefiles and was _not_ able to)

The ninja build is failing with a similar error:


[82/167] Performing build step for 'grpc_src'
FAILED: ../.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-stamp/grpc_src-build ../.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-build/libgrpc_unsecure.a ../.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-build/libgrpc_unsecure_d.a ../.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-build/libgrpc++_unsecure.a ../.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-build/libgrpc++_unsecure_d.a ../.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-build/libaddress_sorting.a ../.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-build/libaddress_sorting_d.a ../.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-build/libgpr.a ../.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-build/libgpr_d.a ../.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-build/grpc_cpp_plugin 
cd /home/mmorsi/Workspace/rippled/.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-build && /home/mmorsi/Workspace/cmake-3.16.3-Linux-x86_64/bin/cmake -P /home/mmorsi/Workspace/rippled/.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-stamp/grpc_src-build-Release.cmake && /home/mmorsi/Workspace/cmake-3.16.3-Linux-x86_64/bin/cmake -E touch /home/mmorsi/Workspace/rippled/.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-stamp/grpc_src-build
Build output for /home/mmorsi/Workspace/rippled/.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-stamp/grpc_src-build : 

ninja: error: 'protobuf::libprotoc-NOTFOUND', needed by 'grpc_ruby_plugin', missing and no known rule to make it
CMake Error at /home/mmorsi/Workspace/rippled/.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-stamp/grpc_src-build-Release-impl.cmake:9 (message):
  Command failed (1):

   '/home/mmorsi/Workspace/cmake-3.16.3-Linux-x86_64/bin/cmake' '--build' '.' '--config' 'Release' '--parallel' '4' ''

CMake Error at /home/mmorsi/Workspace/rippled/.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-stamp/grpc_src-build-Release.cmake:23 (message):
  Command failed: 1

   '/home/mmorsi/Workspace/cmake-3.16.3-Linux-x86_64/bin/cmake' '-Dmake=' '-Dconfig=' '-P' '/home/mmorsi/Workspace/rippled/.nih_c/ninja/GNU_9.2.1/Release/src/grpc_src-stamp/grpc_src-build-Release-impl.cmake'

  See above

Trying the stock build in a pristine Fedora 31 VM, will let you know the results of that when it completes

movitto avatar Jan 22 '20 23:01 movitto

this is good info - grpc is not finding protobuf. Let me dig a little more in their build files and get back to you...

mellery451 avatar Jan 22 '20 23:01 mellery451

ah - I just remembered...I think grpc has a min protobuf requirement of 3.8. You are going to need to install 3.8+ from source or using packages if you have a repo with an updated version.

mellery451 avatar Jan 22 '20 23:01 mellery451

...that said, -Dlocal_protobuf=ON should have worked in theory, BUT we probably are not able to completely override the grpc package searching. I'll investigate more.

For ongoing development, you are probably going to want to figure out how to install grpc and its prerequisites (c-ares, protobuf 3.8+) in some permanent location (it can be in /usr/local or opt as long as you tell cmake to search there). It's a huge build and you really don't want to rely on our less-than-elegant external project invocation to build it (potentially multiple times)

mellery451 avatar Jan 23 '20 00:01 mellery451

Cool, thanks for the info @mellery451. Fedora 32 which is scheduled to be released early next month will ship with protobuf 3.11.2

Will try to figure out a workaround based on locally installed prereqs in the meantime but may just have to punt until it's available systemwide next month. Will let you know if I make any progress.

Many thanks again for the help.

movitto avatar Jan 23 '20 03:01 movitto

@movitto I'd be interested to know if https://github.com/mellery451/rippled/tree/rocks-6 fixes your issue here. Based on my testing, I believe it might.

mellery451 avatar Feb 04 '20 20:02 mellery451

@mellery451 I gave your branch a test and verified that yes, the build now succeeds on Fedora locally.

movitto avatar Feb 05 '20 00:02 movitto

This issue is still reproducible in Ubuntu if built with cmake -DCMAKE_INSTALL_PREFIX=/usr ..

rustyx avatar Dec 13 '20 10:12 rustyx

@mellery451

It seems this error got back with 1.9.0:

Makefile:135: recipe for target 'all' failed

make[3]: warning: -jN forced in submake: disabling jobserver mode.
CMakeFiles/gen_percent_encoding_tables.dir/build.make:95: *** target pattern contains no '%'.  Stop.
CMakeFiles/gen_legal_metadata_characters.dir/build.make:95: *** target pattern contains no '%'.  Stop.
make[4]: *** [CMakeFiles/gen_percent_encoding_tables.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....
make[4]: *** [CMakeFiles/gen_legal_metadata_characters.dir/all] Error 2
make[3]: *** [all] Error 2
CMake Error at /home/build/ripple/source/.nih_c/unix_makefiles/Clang_9.0.0/Release/src/grpc_src-stamp/grpc_src-build-Release-impl.cmake:9 (message):
  Command failed (2):

   '/usr/bin/cmake' '--build' '.' '--config' 'Release' '--parallel' '8' ''



CMake Error at /home/build/ripple/source/.nih_c/unix_makefiles/Clang_9.0.0/Release/src/grpc_src-stamp/grpc_src-build-Release.cmake:23 (message):
  Command failed: 1

   '/usr/bin/cmake' '-Dmake=' '-Dconfig=' '-P' '/home/build/ripple/source/.nih_c/unix_makefiles/Clang_9.0.0/Release/src/grpc_src-stamp/grpc_src-build-Release-impl.cmake'

  See above



CMakeFiles/grpc_src.dir/build.make:86: recipe for target '../../.nih_c/unix_makefiles/Clang_9.0.0/Release/src/grpc_src-stamp/grpc_src-build' failed
make[2]: *** [../../.nih_c/unix_makefiles/Clang_9.0.0/Release/src/grpc_src-stamp/grpc_src-build] Error 1
CMakeFiles/Makefile2:416: recipe for target 'CMakeFiles/grpc_src.dir/all' failed
make[1]: *** [CMakeFiles/grpc_src.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
make: *** [all] Error 2
Build Failed.

Tried cleaning .nih_c and also setting -Dlocal_protobuf=ON but didn't help.

I'm using cmake:

$ cmake --version
cmake version 3.23.0

CMake suite maintained and supported by Kitware (kitware.com/cmake).

I don't have protobuf installed locally at all.

gituser avatar Apr 11 '22 23:04 gituser

I have this error as well. Happens both with and without a local protobuf install. Tried cleaning .nih_c and also setting -Dlocal_protobuf=ON but didn't help.

After I built and installed a local protobuf from source, and defined -Dlocal_protobuf=ON, got this when running cmake:

-- Found Protobuf: /usr/local/lib/libprotobuf.a;-pthread (found suitable version "3.21.1", minimum required is "3.8")
-- using local protobuf build.

But I still have the following error when building:

[  2%] Built target grpc_plugin_support
[  5%] Built target gpr

CMakeFiles/gen_legal_metadata_characters.dir/build.make:95: *** target pattern contains no '%'.  Stop.
CMakeFiles/gen_percent_encoding_tables.dir/build.make:95: *** target pattern contains no '%'.  Stop.
make[4]: *** [CMakeFiles/Makefile2:712: CMakeFiles/gen_legal_metadata_characters.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....
make[4]: *** [CMakeFiles/Makefile2:738: CMakeFiles/gen_percent_encoding_tables.dir/all] Error 2
make[3]: *** [Makefile:136: all] Error 2
CMake Error at /c/greg/github/ripple/rippled/.nih_c/unix_makefiles/GNU_9.4.0/Release/src/grpc_src-stamp/grpc_src-build-Release-impl.cmake:9 (message):
  Command failed (2):

line 95 of .nih_c/unix_makefiles/GNU_9.4.0/Release/src/grpc_src-build/CMakeFiles/gen_legal_metadata_characters.dir/build.cmake is:

gen_legal_metadata_characters: protobuf::libprotobuf-NOTFOUND

greg7mdp avatar Jun 23 '22 19:06 greg7mdp

OK, so I managed to sidestep the issue by building and installing the latest version of protobuf and doing a clean build (after deleting .nih_c and my build directory. I didn't have to specify -Dlocal_protobuf=ON, just cmake .. was enough.

greg7mdp avatar Aug 10 '22 16:08 greg7mdp