Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 860828 - tree-sitter-grammar.eclass: ld: unknown option: --soname=libtree-sitter-bash.13.dylib on Darwin (dev-libs/tree-sitter-bash-0.19.0 fails to compile)
Summary: tree-sitter-grammar.eclass: ld: unknown option: --soname=libtree-sitter-bash...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All OS X
: Normal normal (vote)
Assignee: Matthew Smith
URL:
Whiteboard:
Keywords: PATCH, PullRequest
Depends on:
Blocks:
 
Reported: 2022-07-25 05:19 UTC by Sam James
Modified: 2022-07-28 19:59 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (file_860828.txt,3.44 KB, text/plain)
2022-07-25 05:19 UTC, Sam James
Details
0001-tree-sitter-grammar.eclass-use-Wl-install_name-on-Da.patch (0001-tree-sitter-grammar.eclass-use-Wl-install_name-on-Da.patch,1.10 KB, patch)
2022-07-25 06:03 UTC, Sam James
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-25 05:19:20 UTC
Created attachment 794132 [details]
build.log

>>> Compiling source in /Users/sam/Gentoo/var/tmp/portage/dev-libs/tree-sitter-bash-0.19.0/work/tree-sitter-bash-0.19.0/src ...
make SHELL=/Users/sam/Gentoo/usr/bin/bash -j8 parser.o scanner.o
x86_64-apple-darwin21-gcc -march=native -O2 -pipe -fPIC   -c -o parser.o parser.c
x86_64-apple-darwin21-g++ -march=native -O2 -pipe -fPIC   -c -o scanner.o scanner.cc
 * x86_64-apple-darwin21-g++ -march=native -O2 -pipe -fPIC -Wl,-dead_strip_dylibs -shared parser.o scanner.o -Wl,--soname=libtree-sitter-bash.13.dylib -o /Users/sam/Gentoo/var/tmp/portage/dev-libs/tree-sitter-bash-0.19.0/work/libtree-sitter-bash.13.dylib
ld: unknown option: --soname=libtree-sitter-bash.13.dylib
collect2: error: ld returned 1 exit status
 * ERROR: dev-libs/tree-sitter-bash-0.19.0::gentoo_prefix failed (compile phase):
 *   Failed to run command: x86_64-apple-darwin21-g++ -march=native -O2 -pipe -fPIC -Wl,-dead_strip_dylibs -shared parser.o scanner.o -Wl,--soname=libtree-sitter-bash.13.dylib -o /Users/sam/Gentoo/var/tmp/portage/dev-libs/tree-sitter-bash-0.19.0/work/libtree-sitter-bash.13.dylib
 *
 * Call stack:
 *     ebuild.sh, line  122:  Called src_compile
 *   environment, line 1292:  Called tree-sitter-grammar_src_compile
 *   environment, line 2026:  Called edo 'x86_64-apple-darwin21-g++' '-march=native' '-O2' '-pipe' '-fPIC' '-Wl,-dead_strip_dylibs' '-shared' 'parser.o' 'scanner.o' '-Wl,--soname=libtree-sitter-bash.13.dylib' '-o' '/Users/sam/Gentoo/var/tmp/portage/dev-libs/tree-sitter-bash-0.19.0/work/libtree-sitter-bash.13.dylib'
 *   environment, line  534:  Called die
 * The specific snippet of code:
 *       "$@" || die -n "Failed to run command: $@"

----
Portage 3.0.34 (python 3.10.4-final-0, prefix/darwin/macos/12.0/x64/gcc, gcc-12.1.0, unavailable, 21.6.0 x86_64)
=================================================================
System uname: macOS-12.5-x86_64-i386-64bit
Timestamp of repository gentoo_prefix: Mon, 25 Jul 2022 00:57:18 +0000
Head commit of repository gentoo_prefix: 32a4721f0f3891663540ad831c3c6923cafed8c4
sh bash 5.1_p16
ld xtools-2.2.4 ld (Gentoo binutils-apple-8.2.1-r101)
app-misc/pax-utils:        1.3.4::gentoo_prefix
app-shells/bash:           5.1_p16::gentoo_prefix
dev-lang/perl:             5.36.0::gentoo_prefix
dev-lang/python:           3.9.12::gentoo_prefix, 3.10.4::gentoo_prefix
dev-util/cmake:            3.23.2::gentoo_prefix
dev-util/meson:            0.63.0::gentoo_prefix
sys-apps/baselayout:       2.8-r2::gentoo_prefix
sys-devel/autoconf:        2.71-r1::gentoo_prefix
sys-devel/automake:        1.16.5::gentoo_prefix
sys-devel/binutils-config: 5.1-r4::gentoo_prefix
sys-devel/clang:           14.0.6::gentoo_prefix
sys-devel/gcc:             12.1.0::gentoo_prefix
sys-devel/gcc-config:      1.9.1::gentoo_prefix
sys-devel/libtool:         2.4.7::gentoo_prefix
sys-devel/llvm:            14.0.6-r1::local
sys-devel/make:            4.3::gentoo_prefix
Repositories:

gentoo_prefix
    location: /Users/sam/Gentoo/var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.prefix.bitzolder.nl/gentoo-portage-prefix
    priority: -1000
    aliases: gentoo
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: no
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts:

local
    location: /Users/sam/Gentoo/var/db/repos/local
    masters: gentoo_prefix

ACCEPT_KEYWORDS="~x64-macos"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-apple-darwin21"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-apple-darwin21"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/terminfo"
CONFIG_SHELL="/Users/sam/Gentoo/bin/bash"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/Users/sam/Gentoo/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS=""
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live case-insensitive-fs config-protect-if-modified distlocks ebuild-locks fixlafiles force-prefix ipc-sandbox merge-sync multilib-strict network-sandbox news nostrip parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sfperms strict unknown-features-warn unmerge-logs unmerge-orphans unprivileged"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distfiles.prefix.bitzolder.nl/prefix"
LDFLAGS="-Wl,-dead_strip_dylibs"
MAKEOPTS="-j8"
PKGDIR="/Users/sam/Gentoo/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/Users/sam/Gentoo/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/Users/sam/Gentoo/var/tmp"
SHELL="/Users/sam/Gentoo/bin/zsh"
USE="aqua coreaudio emacs ipv6 libglvnd ncurses objc objc++ prefix prefix-guest readline ssl x64-macos zlib" ABI_X86="64" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="Darwin" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="Darwin" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby27" USERLAND="GNU" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LANG, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-25 05:21:53 UTC
We need to pass e.g. -Wl,-install_name,${EPREFIX}/usr/$(get_libdir)/libtree-sitter.0.dylib for Darwin (adapt as needed, but you get the idea).

We can either use [[ ${CHOST} == *darwin* ]] or [[ $(get_libname) == .dylib ]].
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-25 05:24:33 UTC
(In reply to Sam James from comment #1)
> We need to pass e.g.
> -Wl,-install_name,${EPREFIX}/usr/$(get_libdir)/libtree-sitter.0.dylib for
> Darwin (adapt as needed, but you get the idea).
> 
> We can either use [[ ${CHOST} == *darwin* ]] or [[ $(get_libname) == .dylib
> ]].

This worked fine for me, fwiw:
        edo ${link} ${LDFLAGS} \
                        -shared \
                        *.o \
                        -Wl,-install_name,${EPREFIX}/usr/$(get_libdir)/${soname} \
                        -o "${WORKDIR}"/${soname} || die
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-25 06:03:14 UTC
Created attachment 794135 [details, diff]
0001-tree-sitter-grammar.eclass-use-Wl-install_name-on-Da.patch
Comment 4 Larry the Git Cow gentoo-dev 2022-07-28 19:59:14 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=46b41f8f6121022d3e1d70f687580a1bcb32f6c7

commit 46b41f8f6121022d3e1d70f687580a1bcb32f6c7
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-07-25 06:00:46 +0000
Commit:     Matthew Smith <matthew@gentoo.org>
CommitDate: 2022-07-28 19:51:07 +0000

    tree-sitter-grammar.eclass: use -Wl,-install_name on Darwin
    
    Closes: https://bugs.gentoo.org/860828
    Signed-off-by: Sam James <sam@gentoo.org>
    Signed-off-by: Matthew Smith <matthew@gentoo.org>

 eclass/tree-sitter-grammar.eclass | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)