Bug 264603 - devel/android-tools: build fails if security/openssl is installed
Summary: devel/android-tools: build fails if security/openssl is installed
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-10 21:42 UTC by John Hein
Modified: 2022-06-10 23:19 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Hein 2022-06-10 21:42:55 UTC
'cmake' generates build.ninja such that it looks in /usr/local/include before locations in the working build tree.  If the openssl port is installed, then the build finds those files before the bundled ssl (boringssl).

This triggers a build failure:

FAILED: vendor/CMakeFiles/libadb_tls_connection_defaults.dir/adb/tls/tls_connection.cpp.o
/usr/bin/c++  -I/usr/local/include -I/wrkdirs/usr/ports/devel/android-tools/work/.build/vendor -I/wrkdirs/usr/ports/devel/android-tools/work/freebsd-android-tools-7fa3613259c9c1e4bc4f82af46dfca975e28a930/vendor/adb -I/wrkdirs/usr/ports/devel/android-tools/work/freebsd
-android-tools-7fa3613259c9c1e4bc4f82af46dfca975e28a930/vendor/adb/tls/include -I/wrkdirs/usr/ports/devel/android-tools/work/freebsd-android-tools-7fa3613259c9c1e4bc4f82af46dfca975e28a930/vendor/boringssl/include -I/wrkdirs/usr/ports/devel/android-tools/work/freebsd-a
ndroid-tools-7fa3613259c9c1e4bc4f82af46dfca975e28a930/vendor/libbase/include -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -std=gnu++2a -Wno-attributes -D_FILE_OFFSET_BITS=64 -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -MD -MT vendor/CMakeFiles/l
ibadb_tls_connection_defaults.dir/adb/tls/tls_connection.cpp.o -MF vendor/CMakeFiles/libadb_tls_connection_defaults.dir/adb/tls/tls_connection.cpp.o.d -o vendor/CMakeFiles/libadb_tls_connection_defaults.dir/adb/tls/tls_connection.cpp.o -c /wrkdirs/usr/ports/devel/andr
oid-tools/work/freebsd-android-tools-7fa3613259c9c1e4bc4f82af46dfca975e28a930/vendor/adb/tls/tls_connection.cpp
/wrkdirs/usr/ports/devel/android-tools/work/freebsd-android-tools-7fa3613259c9c1e4bc4f82af46dfca975e28a930/vendor/adb/tls/tls_connection.cpp:55:12: error: use of undeclared identifier 'bssl'
    static bssl::UniquePtr<EVP_PKEY> EvpPkeyFromPEM(std::string_view pem);
           ^
/wrkdirs/usr/ports/devel/android-tools/work/freebsd-android-tools-7fa3613259c9c1e4bc4f82af46dfca975e28a930/vendor/adb/tls/tls_connection.cpp:56:12: error: use of undeclared identifier 'bssl'
    static bssl::UniquePtr<CRYPTO_BUFFER> BufferFromPEM(std::string_view pem);
           ^
/wrkdirs/usr/ports/devel/android-tools/work/freebsd-android-tools-7fa3613259c9c1e4bc4f82af46dfca975e28a930/vendor/adb/tls/tls_connection.cpp:56:28: error: use of undeclared identifier 'CRYPTO_BUFFER'
    static bssl::UniquePtr<CRYPTO_BUFFER> BufferFromPEM(std::string_view pem);
                           ^
/wrkdirs/usr/ports/devel/android-tools/work/freebsd-android-tools-7fa3613259c9c1e4bc4f82af46dfca975e28a930/vendor/adb/tls/tls_connection.cpp:62:12: error: use of undeclared identifier 'bssl'
    static bssl::UniquePtr<X509> X509FromBuffer(bssl::UniquePtr<CRYPTO_BUFFER> buffer);
           ^
 .
 .


Hacky workaround: delete the openssl package when building android-tools.

Better would be to convince cmake to put -I flags for in-tree directories ahead of -I /usr/local/include.  But it is not obvious how to tell cmake to put include paths that it "finds" at the end of the list of include paths.  Or maybe it is obvious to someone.
Comment 1 John Hein 2022-06-10 21:44:38 UTC
Similar problem, but different: bug 264597
Comment 2 Neel Chauhan freebsd_committer freebsd_triage 2022-06-10 23:18:12 UTC
I have some good news: I found out how to fix it. Apparently in CMake I need to do `BEFORE SYSTEM`. Will push a patch shortly.
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-06-10 23:19:34 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=52709fc2c45fe7662dc1278077d763b246c63c0e

commit 52709fc2c45fe7662dc1278077d763b246c63c0e
Author:     Neel Chauhan <nc@FreeBSD.org>
AuthorDate: 2022-06-10 23:18:56 +0000
Commit:     Neel Chauhan <nc@FreeBSD.org>
CommitDate: 2022-06-10 23:18:56 +0000

    devel/android-tools: Updaste to 31.0.3p1r1

    Changes:
     * Fix build when security/openssl and devel/libfmt is installed
     * Don't rely on /proc to resolve pathname

    PR:             264597, 264603
    Reported by:    John Hein and Martin Birgmeier (depencency), Baptiste Daroussin (Linuxism)

 devel/android-tools/Makefile | 4 ++--
 devel/android-tools/distinfo | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)