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

force pkg-config to only use --prefix when cross-compiling #1481

Closed
wants to merge 1 commit into from

Conversation

@eighthave
Copy link
Contributor

eighthave commented Oct 29, 2019

The current pkg-config setup has no sense of whether it is cross-compiling, so it will detect things on the build system that are not present or are wrong for the host system. This forces the cross-compiling build to only look for pkg-config .pc files in --prefix.

A version of this has been the setup for many years with the Android builds.

Fixes #32191

Signed-off-by: Hans-Christoph Steiner hans@eds.org

The current pkg-config setup has no sense of whether it is cross-compiling,
so it will detect things on the build system that are not present or are
wrong for the host system.  This forces the cross-compiling build to only
look for pkg-config .pc files in --prefix.

A version of this has been the setup for many years with the Android builds.

Fixes #32191

Signed-off-by: Hans-Christoph Steiner <hans@eds.org>
@coveralls

This comment has been minimized.

Copy link

coveralls commented Oct 29, 2019

Pull Request Test Coverage Report for Build 6989

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.001%) to 62.016%

Files with Coverage Reduction New Missed Lines %
src/feature/hs/hs_common.c 1 84.27%
Totals Coverage Status
Change from base Build 6988: -0.001%
Covered Lines: 48240
Relevant Lines: 77787

💛 - Coveralls
configure.ac Show resolved Hide resolved
if test "x$PKG_CONFIG_PATH" = "x" && test "x$prefix" != "xNONE" && test "$host" != "$build"; then
export PKG_CONFIG_PATH=$prefix/lib/pkgconfig
AC_MSG_NOTICE([set PKG_CONFIG_PATH=$PKG_CONFIG_PATH to support cross-compiling])
if test -f "$PKG_CONFIG_PATH/libevent.pc"; then

This comment has been minimized.

Copy link
@teor2345

teor2345 Oct 30, 2019

Member

This test is incorrect: we don't require any particular *.pc file, the user can always set the relevant LIBS and CFLAGS env vars instead.

This comment has been minimized.

Copy link
@eighthave

eighthave Oct 30, 2019

Author Contributor

libevent is a hard requirement for building, and the idea here is that this is testing that the user ran make install into prefix for libevent. In that case, libevent.pc will be present. Supporting partial installs i.e. not make install into prefix, will waste a lot of time and only achieve flaky results. Also, If there are no .pc files, then there is no point in setting PKG_CONFIG_PATH. And remember, if pkg-config is not properly setup, then --enable-lzma fails without an error on Android builds, and probably other cases too.

This comment has been minimized.

Copy link
@eighthave

eighthave Oct 30, 2019

Author Contributor

Or in other words, the current tor ./configure setup is a buggy almost unusable mess when it comes to cross-compiling for Android and iOS. There are brittle wrapper build setups that all the related devs are scared to touch at all, so that hinders usage of new functionality like the new modularity. There needs to be one recommended way to build that works reliably, e.g. make install and --prefix on each lib and tor. This is a carefully isolated change that will be easy to avoid for someone who wants to do all sorts of build tricks.

This comment has been minimized.

Copy link
@teor2345

teor2345 Oct 30, 2019

Member

Tor does not use pkg-config to find libevent:
https://github.com/torproject/tor/blob/master/configure.ac#L751

For libraries where tor does use pkg-config, the pkg-config autotools macros allow the user to manually override the (MODULE)_CLFAGS and (MODULE)_LIBS, as documented in configure's failure messages:
https://github.com/torproject/tor/blob/master/configure.ac#L885

Here is the reference documentation for PKG_CHECK_MODULES():
https://autotools.io/pkgconfig/pkg_check_modules.html

@eighthave

This comment has been minimized.

Copy link
Contributor Author

eighthave commented Oct 30, 2019

@eighthave eighthave closed this Oct 30, 2019
@eighthave eighthave deleted the eighthave:pkg-config-prefix branch Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.