[Bug 220103] devel/glib20: ld-elf.so.1: /usr/local/lib/libglib-2.0.so.0: Undefined symbol "environ" (WITH_LLD_IS_LD)
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Mon Dec 23 16:15:14 UTC 2019
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220103
Frédéric Fauberteau <triaxx at NetBSD.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |triaxx at NetBSD.org
--- Comment #46 from Frédéric Fauberteau <triaxx at NetBSD.org> ---
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 process
produces the followings:
[93/1124] Linking target glib/libglib-2.0.so.0.6200.3.
FAILED: glib/libglib-2.0.so.0.6200.3
clang -o glib/libglib-2.0.so.0.6200.3
'glib/4430778@@glib-2.0 at sha/deprecated_gallocator.c.o'
[...]
'glib/libcharset/6e4c96c@@charset at 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 at sha/genviron.c.o:(g_listenv)
/usr/bin/ld: error: undefined symbol: environ
>>> referenced by genviron.c
>>> glib/4430778@@glib-2.0 at sha/genviron.c.o:(g_listenv)
/usr/bin/ld: error: undefined symbol: environ
>>> referenced by genviron.c
>>> glib/4430778@@glib-2.0 at sha/genviron.c.o:(g_get_environ)
/usr/bin/ld: error: undefined symbol: environ
>>> referenced by gspawn.c
>>> glib/4430778@@glib-2.0 at sha/gspawn.c.o:(fork_exec_with_fds)
clang: 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
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+=
-fuse-ld=/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 at sha/genviron.c.o:(g_listenv)
>>> referenced by genviron.c
>>> glib/4430778@@glib-2.0 at sha/genviron.c.o:(g_listenv)
>>> referenced by genviron.c
>>> glib/4430778@@glib-2.0 at sha/genviron.c.o:(g_get_environ)
>>> referenced by gspawn.c
>>> glib/4430778@@glib-2.0 at 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_unsetenv
19: 0000000000000590 20 FUNC GLOBAL DEFAULT 2 g_get_environ
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
More information about the freebsd-toolchain
mailing list