Bug 264597 - devel/android-tools fails to install if devel/libfmt is installed
Summary: devel/android-tools fails to install if devel/libfmt 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 Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-10 15:54 UTC by Martin Birgmeier
Modified: 2022-06-11 13:08 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Birgmeier 2022-06-10 15:54:35 UTC
Scenario:
- FreeBSD 12.3 latest patchlevel
- ports latest
- using portmaster to upgrade ports
- comms/scrcpy is installed and pulls in devel/android-tools
- converters/osm2pgsql is installed and needs devel/libfmt for building
- running portmaster -a after the latest ports update

Result:
- The build of devel/android-tools fails with

ld: error: undefined symbol: fmt::v8::vformat(fmt::v8::basic_string_view<char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char> >)

Expected result:
- The build should succeed.

Scenario (continued):
- Removing the installed devel/libfmt (pkg delete ...)

Result (continued):
- The build of devel/android-tools succeeds

-- Martin
Comment 1 Neel Chauhan freebsd_committer freebsd_triage 2022-06-10 18:14:19 UTC
I was able to replicate the issue. Not your ld issue exactly, but something similar (I run 14-CURRENT versus 12.3 like you).

However, the thing is, devel/android-tools has a custom libfmt that's included with android-tools as a static library, mainly due to differences versus the Ports libfmt.

I was unable to make android-tools depend on the Ports libfmt.

It's likely cmake is depending on the ports libfmt instead of the included one as clang/cmake gives precedence to external libraries over build-in ones.

I will still work to figure out what is going wrong.

In the meanwhile, you could also build with poudriere on your local system. That way, while not a "fix", a Ports libfmt is unlikely to conflict with android-tools.
Comment 2 Martin Birgmeier 2022-06-10 18:22:31 UTC
Thank you Neel for looking into this.

I have tried poudriere previously but found that it was too heavy for my environment.

As a workaround I simply deinstall libfmt before running portmaster, and then reinstall again.

-- Martin
Comment 3 John Hein 2022-06-10 21:47:22 UTC
Similar issue if the openssl package is installed: bug 264603
In this case, it triggers a compile error due to searching for headers in /usr/local/include before the headers in the working build area.
Comment 4 Neel Chauhan freebsd_committer freebsd_triage 2022-06-10 23:18:16 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 5 commit-hook freebsd_committer freebsd_triage 2022-06-10 23:19:33 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(-)
Comment 6 Martin Birgmeier 2022-06-11 13:08:16 UTC
Works nicely, thank you!

-- Martin