From nobody Thu Dec 22 22:26:52 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NdQ0F0tcqz1J49L for ; Thu, 22 Dec 2022 22:26:53 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NdQ0D4QqMz3ngH for ; Thu, 22 Dec 2022 22:26:52 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671748012; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xT/dw3Bap4DCjlA0k9aLisuF7eukL0+vH74EHDZi7pU=; b=Qmvykdv3lFYlCvRTBFgT+49GN66sWrCgfQ5ggB/rdmQ8hiN/50gm8q8iWRqyfRr5ecOz3p EoOSA0ryaCnjMXAFkV272vDXUJ5eu4rJzdCSuU0fhDN6nFUT/gbzh013LkdvvvQLpUCHDV KcQoBfv2zv9MpF25q2tjzENlV9xA517hkAoWbQKNtcCFBCabUH3tOTsbKfApJWC7IIR6Lk aZpqaX0j8tRtlx65GgVvsqJ37zZHkbHurKWnbeKKd+OmVytXY2SnsIb8SRiXdcsIVzXSgG Fzd26eG9UY1Vdp/2FTnES/Vf7p5M9avU8fRy0L79SsdnGbaRSsZdKLTQ4vCwjQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1671748012; a=rsa-sha256; cv=none; b=iJ9FAka5vUKw5eCg5WnHbcAU/6WC1ZfkE//L1W+P0xXm85H9qW2tpB78nWSVpokbWMHgzf CzL4RTL13UNvCmxN/LnedenyeeeXP5d0y3B8TJPTa9tREyGhJf2G2saPNezW4IBdyTUfv6 tYEUKbhob3ESCCBLLfnOYgEO/4IIa6KhKVMPb0V/c6IkVS3HMbRvvmienAiFr0X16iU/nD anF46LyEzl9laV/XCq1z7diSUYuc32w168p1X+fm+qmPOZUHoeM0O1OKHshjXDYms7uOc4 pVoDvOt+ZqpVBAR3uYzwH55DDnh7WF/VMyhYxZPUS64uUW4ID96rOC75UXrmwg== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NdQ0D3TkPz1B3M for ; Thu, 22 Dec 2022 22:26:52 +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 2BMMQqKu020856 for ; Thu, 22 Dec 2022 22:26:52 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 2BMMQqDR020855 for bugs@FreeBSD.org; Thu, 22 Dec 2022 22:26:52 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: bugs@FreeBSD.org Subject: [Bug 268518] Undefined symbol error when building shared library with environ(7) Date: Thu, 22 Dec 2022 22:26:52 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 13.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: triaxx@NetBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268518 Bug ID: 268518 Summary: Undefined symbol error when building shared library with environ(7) Product: Base System Version: 13.1-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: triaxx@NetBSD.org Considering the simple 'foo.c' file: | extern char **environ; |=20 | int foo(int a) | { | if (environ) | { | return 1; | } | return 0; | } and a Makefile to build a shared library from it: | CC=3Dclang -v |=20 | foo.o: foo.c | $(CC) -c -Wall -Werror -fPIC -o $@ $? |=20 | libfoo.so: foo.o | $(CC) -Wl,--no-undefined -shared -o $@ $? The following error occurs: | $ make libfoo.so | clang -v -c -Wall -Werror -fPIC -o foo.o foo.c | FreeBSD clang version 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-| gd7b669b3a303) | Target: x86_64-unknown-freebsd13.1 | Thread model: posix | InstalledDir: /usr/bin | (in-process) | "/usr/bin/clang" -cc1 -triple x86_64-unknown-freebsd13.1 -emit-obj -mrelax-all --mrelax-relocations -disable-free -disable-llvm-verifier -discard-value-names -main-file-name foo.c -mrelocation-model pic -pic-leve= l 2 -fhalf-no-semantic-interposition -mframe-pointer=3Dall -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debugger-tuning=3Dgdb -v -fcoverage-compilation-dir=3D/home/triaxx -resour= ce-dir /usr/lib/clang/13.0.0 -Wall -Werror -fdebug-compilation-dir=3D/home/triaxx -ferror-limit 19 -fgnuc-version=3D4.2.1 -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=3D1 -o foo.o -x c foo.c | clang -cc1 version 13.0.0 based upon LLVM 13.0.0 default target x86_64-unknown-freebsd13.1 | #include "..." search starts here: | #include <...> search starts here: | /usr/lib/clang/13.0.0/include | /usr/include | End of search list. | clang -v -Wl,--no-undefined -shared -o libfoo.so foo.o | FreeBSD clang version 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303) | Target: x86_64-unknown-freebsd13.1 | Thread model: posix | InstalledDir: /usr/bin | "/usr/bin/ld" --eh-frame-hdr -Bshareable --hash-style=3Dboth --enable-new-dtags -o libfoo.so /usr/lib/crti.o /usr/lib/crtbeginS.o -L/usr= /lib --no-undefined foo.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtendS.o /usr/lib/crtn.o | ld: error: undefined symbol: environ | >>> referenced by foo.c | >>> foo.o:(foo) | clang: error: linker command failed with exit code 1 (use -v to see invocation) | *** Error code 1 |=20 | Stop. | make: stopped in /home/triaxx I noticed that environ symbol seems to be undefined in libc: | $ readelf -s /lib/libc.so.7 | grep environ | 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND environ while it seems to be present on other systems like Linux or NetBSD. This issue produces a build error for Pulseaudio 16.1. --=20 You are receiving this mail because: You are the assignee for the bug.=