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

Improve make error message when pkg-config is not installed #10058

Closed
jacobvosmaer opened this issue Mar 9, 2017 · 9 comments
Closed

Improve make error message when pkg-config is not installed #10058

jacobvosmaer opened this issue Mar 9, 2017 · 9 comments

Comments

@jacobvosmaer
Copy link

I recently got to blunder my way through compiling gRPC from source. To be more specific, I was running gem install grpc --platform=ruby, which kicks into the top-level Makefile. This message had me confused for quite some time:

make: Entering directory '/var/lib/gems/2.3.0/gems/grpc-1.1.2'

DEPENDENCY ERROR
Makefile:932: recipe for target 'stop' failed
make: *** [stop] Error 1
make: *** Waiting for unfinished jobs....

The target you are trying to run requires an OpenSSL implementation.
Your system doesn't have one, and either the third_party directory
doesn't have it, or your compiler can't build BoringSSL.
Please consult INSTALL to get more information.
If you need information about why these tests failed, run:

  make run_dep_checks

make: Leaving directory '/var/lib/gems/2.3.0/gems/grpc-1.1.2'
*** extconf.rb failed ***

Now if I look in INSTALL.md I don't see pkg-config listed as a Linux pre-requisite. https://github.com/grpc/grpc/blob/master/INSTALL.md#linux At least in Ubuntu 16.04, build-essential does not include pkg-config.

The only way I was able to find the problem was by trying to read the Makefile (which is a bit over my head) until I saw that the OpenSSL test variables depend on an invocation of pkg-config, which led me to the lucky guess of apt-get install pkg-config.

Long story short I think it would help if the Makefile prints an accurate error message if pkg-config cannot be found at all, instead of the current generic one. I will submit a PR to add pkg-config to INSTALL.md.

@jacobvosmaer
Copy link
Author

To be clear: besides #10059 I think it would also be an improvement to detect pkg-config in the Makefile. But I lack the expertise and time to add that check to the Makefile, hence this issue and no PR for that.

@murgatroid99
Copy link
Member

We do detect pkg-config in the Makefile, right here: https://github.com/grpc/grpc/blob/master/Makefile#L446. And we do check for a system OpenSSL even if you don't have pkg-config. One possible explanation for the error you're seeing is that OpenSSL is installed in an unusual location, and that pkg-config was able to find it, but it wasn't in the default include or link path.

@jacobvosmaer
Copy link
Author

I see that there is a check there but it is not used for reporting a problem to the user; it seems to be part of a cross-compilation workflow.

The problem is not just with pkg-config. Here is what happens if I run make with protoc and pkg-config available:

root@ubuntu1604-test:~/grpc-1.1.4# make
[MAKE]    Generating cache.mk

DEPENDENCY ERROR

The target you are trying to run requires an OpenSSL implementation.
Your system doesn't have one, and either the third_party directory
doesn't have it, or your compiler can't build BoringSSL.

Please consult INSTALL to get more information.

If you need information about why these tests failed, run:

  make run_dep_checks

Makefile:932: recipe for target 'stop' failed
make: *** [stop] Error 1

But INSTALL (which is INSTALL.md to be precise) does not tell me what else to install. And make run_dep_checks passes.

root@ubuntu1604-test:~/grpc-1.1.4# make run_dep_checks
pkg-config --atleast-version=1.0.2 openssl || true
pkg-config --atleast-version=1.0.1 openssl || true
pkg-config --exists zlib || true
cc -Ithird_party/googletest/include -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -O2 -fPIC -I. -Iinclude -I/root/grpc-1.1.4/gens -DNDEBUG -DINSTALL_PREFIX=\"/usr/local\" -DGRPC_HAVE_PERFTOOLS    -std=c99 -Wsign-conversion -Wconversion -Wshadow    -o /dev/null test/build/perftools.c -lprofiler -g  -fPIC -Llibs/opt -pthread    || true
pkg-config --atleast-version=3.0.0 protobuf || true
protoc --version | grep -q libprotoc.3 || true
root@ubuntu1604-test:~/grpc-1.1.4# echo $?
0

This is actually a different problem from what I started this issue with but it is part of the overall challenging installation experience. And right now I don't have any clue how to move along make considering there are no errors, and run_dep_checks passes.

@AspirinSJL
Copy link
Member

Given that #10059 was closed by @mehrdada because installation doesn't rely on pkg-config, I'm going to close this issue too.

@mattolson
Copy link
Contributor

I ran into the same problem today install the gem (version 1.7.3) on a Debian container that did not have the pkg-config package installed. The error message was:

DEPENDENCY ERROR

The target you are trying to run requires an OpenSSL implementation.
Your system doesn't have one, and either the third_party directory
doesn't have it, or your compiler can't build BoringSSL.

Please consult INSTALL to get more information.

If you need information about why these tests failed, run:

  make run_dep_checks

@irinakhismatullina
Copy link

Same error message while installing python grpcio package on OS X. Solved by installing pkg-config package after reading this thread.

@AspirinSJL AspirinSJL reopened this Jul 10, 2018
@AspirinSJL
Copy link
Member

@mehrdada Reopened because of multiple new occurrences.

@mehrdada
Copy link
Member

Assigning to @jtattermusch as the C/Make UX expert.

@stale
Copy link

stale bot commented Sep 5, 2019

This issue/PR has been automatically marked as stale because it has not had any update (including commits, comments, labels, milestones, etc) for 180 days. It will be closed automatically if no further update occurs in 1 day. Thank you for your contributions!

@stale stale bot closed this as completed Sep 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Dec 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants