From owner-freebsd-toolchain@freebsd.org Mon Dec 23 16:15:14 2019 Return-Path: Delivered-To: freebsd-toolchain@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 504B01CB298 for ; Mon, 23 Dec 2019 16:15:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 47hPZp1Y7Zz3Kh9 for ; Mon, 23 Dec 2019 16:15:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 334CC1CB297; Mon, 23 Dec 2019 16:15:14 +0000 (UTC) Delivered-To: toolchain@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 330D81CB296 for ; Mon, 23 Dec 2019 16:15:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47hPZp0dQ3z3Kh8 for ; Mon, 23 Dec 2019 16:15:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 110AD1A4EE for ; Mon, 23 Dec 2019 16:15:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id xBNGFDBn056426 for ; Mon, 23 Dec 2019 16:15:13 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id xBNGFDU0056425 for toolchain@FreeBSD.org; Mon, 23 Dec 2019 16:15:13 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: toolchain@FreeBSD.org Subject: [Bug 220103] devel/glib20: ld-elf.so.1: /usr/local/lib/libglib-2.0.so.0: Undefined symbol "environ" (WITH_LLD_IS_LD) Date: Mon, 23 Dec 2019 16:15:08 +0000 X-Bugzilla-Reason: CC AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: needs-qa X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: triaxx@NetBSD.org X-Bugzilla-Status: Closed X-Bugzilla-Resolution: Unable to Reproduce X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: toolchain@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 16:15:14 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D220103 Fr=C3=A9d=C3=A9ric Fauberteau changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |triaxx@NetBSD.org --- Comment #46 from Fr=C3=A9d=C3=A9ric Fauberteau --- Hi, I am not sure if the bug is really related but I think I have the same symptoms. I am using the pkgsrc framework (from NetBSD) to build glib-2.62.= 3 on FreeBSD 12.0-RELEASE-p12. I configured pkgsrc to use the basesystem Clang compiler: $ /usr/bin/clang --version FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1) Target: x86_64-unknown-freebsd12.0 Thread model: posix InstalledDir: /usr/bin The meson configuration process completes without error. But the build proc= ess produces the followings: [93/1124] Linking target glib/libglib-2.0.so.0.6200.3. FAILED: glib/libglib-2.0.so.0.6200.3=20 clang -o glib/libglib-2.0.so.0.6200.3 'glib/4430778@@glib-2.0@sha/deprecated_gallocator.c.o' [...] 'glib/libcharset/6e4c96c@@charset@sta/localcharset.c.o' -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/python3.8 -L/usr/pkg/lib -L/usr/lib -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,--start-group -Wl,-soname,libglib-2.0.so.0 -O2 -liconv -Wl,-R/usr/pkg/lib -Wl,-R/usr/lib -Wl,-z,nodelete -Wl,-Bsymbolic-functions -Wl,-R/usr/pkg/lib /usr/pkg/lib/libpcre.so -pthread -lintl -Wl,--end-group /usr/bin/ld: error: undefined symbol: environ >>> referenced by genviron.c >>> glib/4430778@@glib-2.0@sha/genviron.c.o:(g_listenv) /usr/bin/ld: error: undefined symbol: environ >>> referenced by genviron.c >>> glib/4430778@@glib-2.0@sha/genviron.c.o:(g_listenv) /usr/bin/ld: error: undefined symbol: environ >>> referenced by genviron.c >>> glib/4430778@@glib-2.0@sha/genviron.c.o:(g_get_environ) /usr/bin/ld: error: undefined symbol: environ >>> referenced by gspawn.c >>> glib/4430778@@glib-2.0@sha/gspawn.c.o:(fork_exec_with_fds) clang: error: linker command failed with exit code 1 (use -v to see invocat= ion) ninja: build stopped: subcommand failed. *** Error code 1 Stop. bmake[1]: stopped in /usr/pkgsrc/devel/glib2 *** Error code 1 Stop. bmake: stopped in /usr/pkgsrc/devel/glib2 I tried to build it using the Clang version provided by pkgsrc: $ /usr/pkg/bin/clang --version clang version 9.0.0 (tags/RELEASE_900/final) Target: x86_64-unknown-freebsd12.0 Thread model: posix InstalledDir: /usr/pkg/bin Since the problem is a linking error, I added LDFLAGS.FreeBSD+=3D -fuse-ld=3D/usr/pkg/bin/ld.lld to use the LLD version provided by pkgsrc: $ /usr/pkg/bin/ld.lld --version LLD 9.0.0 (compatible with GNU linkers) But I get similar errors: ld.lld: error: undefined symbol: environ >>> referenced by genviron.c >>> glib/4430778@@glib-2.0@sha/genviron.c.o:(g_listenv) >>> referenced by genviron.c >>> glib/4430778@@glib-2.0@sha/genviron.c.o:(g_listenv) >>> referenced by genviron.c >>> glib/4430778@@glib-2.0@sha/genviron.c.o:(g_get_environ) >>> referenced by gspawn.c >>> glib/4430778@@glib-2.0@sha/gspawn.c.o:(fork_exec_with_fds) clang-9: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. *** Error code 1 Stop. bmake[1]: stopped in /usr/pkgsrc/devel/glib2 *** Error code 1 Stop. bmake: stopped in /usr/pkgsrc/devel/glib2 By inspecting the object file, I got the following output: $ readelf -s work/glib-2.62.3/output/glib/4430778\@\@glib-2.0\@sha/genviron= .c.o | grep environ 1: 0000000000000000 0 FILE LOCAL DEFAULT ABS genviron.c 7: 0000000000000005 17 OBJECT LOCAL DEFAULT 4 .L__func__.g_environ_getenv 8: 0000000000000027 17 OBJECT LOCAL DEFAULT 4 .L__func__.g_environ_setenv 9: 000000000000006b 19 OBJECT LOCAL DEFAULT 4 .L__func__.g_environ_unsetenv 14: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND environ 15: 0000000000000000 208 FUNC GLOBAL DEFAULT 2 g_environ_getenv 16: 00000000000000d0 424 FUNC GLOBAL DEFAULT 2 g_environ_setenv 17: 0000000000000280 264 FUNC GLOBAL DEFAULT 2 g_environ_unsete= nv 19: 0000000000000590 20 FUNC GLOBAL DEFAULT 2 g_get_environ --=20 You are receiving this mail because: You are on the CC list for the bug. You are the assignee for the bug.=