Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 09 Mar 2020 04:21:39 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 214404] base/gcc: and base/binutils -r424540 for TARGET_ARCH=powerpc64 example: file placement and gcc/g++ internal file lookups do not match so gcc/g++ do not work
Message-ID:  <bug-214404-7788-azGr8K7Ak9@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-214404-7788@https.bugs.freebsd.org/bugzilla/>
References:  <bug-214404-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D214404

--- Comment #4 from Mark Millard <marklmi26-fbsd@yahoo.com> ---
(In reply to Steve Wills from comment #1)

To test I used a chroot and I did "make package" for
base/gcc6 and then installed it (inside the chroot).
This was without involving base/binutils before or
after that. It did involve:

# make build-depends-list
/usr/ports/ports-mgmt/pkg
/usr/ports/devel/gmake
/usr/ports/print/texinfo

and what they indirectly require. (The run-depends-list
was empty.)

So, for example, the system linker is lld for this
powerpc64 context.

The result of attempting to compile/link main.c was:

# cc -std=3Dc99 -pedantic main.c
ld: error: unable to find library -lgcc
ld: error: unable to find library -lgcc_s
ld: error: unable to find library -lc
ld: error: unable to find library -lgcc
ld: error: unable to find library -lgcc_s
collect2: error: ld returned 1 exit status

The linker ld (really lld) is found and used
but other things are not.

So:

# truss -a -f -o output cc -std=3Dc99 -pedantic main.c
ld: error: unable to find library -lgcc
ld: error: unable to find library -lgcc_s
ld: error: unable to find library -lc
ld: error: unable to find library -lgcc
ld: error: unable to find library -lgcc_s
collect2: error: ld returned 1 exit status

And using libgcc_s as an example:

# grep libgcc_s output | more
96678: open("/lib/libgcc_s.so.1",O_RDONLY|O_CLOEXEC|O_VERIFY,02005070032) =
=3D 3
(0x3)
96679: open("/lib/libgcc_s.so.1",O_RDONLY|O_CLOEXEC|O_VERIFY,02114270032) =
=3D 3
(0x3)
96681: open("/lib/libgcc_s.so.1",O_RDONLY|O_CLOEXEC|O_VERIFY,02003670032) =
=3D 3
(0x3)
96682: open("/lib/libgcc_s.so.1",O_RDONLY|O_CLOEXEC|O_VERIFY,02171470032) =
=3D 3
(0x3)
96682:
access("/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0/libgcc_s.so",F_OK)
ERR#2 'No such file or directory'
96682:
access("/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0/libgcc_s.a",F_OK)
ERR#2 'No such file or directory'
96682:
access("/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0/libgcc_s.so",F_OK)
ERR#2 'No such file or directory'
96682:
access("/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0/libgcc_s.a",F_OK)
ERR#2 'No such file or directory'

It turns out that:

96679 is for:

"/usr/libexec/gcc/powerpc64-unknown-freebsd13.0/6.5.0/cc1", "-quiet", "main=
.c",
"-quiet", "-dumpbase", "main.c", "-auxbase", "main", "-Wpedantic", "-std=3D=
c99",
"-o", "/tmp//cczJu591.s"

96681 is for:

"/usr/libexec/gcc/powerpc64-unknown-freebsd13.0/6.5.0/collect2", "--sysroot=
=3D/",
"--eh-frame-hdr", "-melf64ppc_fbsd", "-dynamic-linker", "/libexec/ld-elf.so=
.1",
"/usr/lib/crt1.o", "/usr/lib/crti.o", "/usr/lib/crtbegin.o",
"-L/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0", "/tmp//ccabilZp.o",
"-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "-lc", "-lgcc",
"--as-needed", "-lgcc_s", "--no-as-needed", "/usr/lib/crtend.o",
"/usr/lib/crtn.o"

Note the -L/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0
Note the lack of some form of -L/lib

96682 is for:

"/usr/bin/ld", "--sysroot=3D/", "--eh-frame-hdr", "-melf64ppc_fbsd",
"-dynamic-linker", "/libexec/ld-elf.so.1", "/usr/lib/crt1.o",
"/usr/lib/crti.o", "/usr/lib/crtbegin.o",
"-L/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0", "/tmp//ccabilZp.o",
"-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "-lc", "-lgcc",
"--as-needed", "-lgcc_s", "--no-as-needed", "/usr/lib/crtend.o",
"/usr/lib/crtn.o"

Note the -L/usr/lib/gcc/powerpc64-unknown-freebsd13.0/6.5.0
Note the lack of some form of -L/lib

Note that:

96682: open("/lib/libgcc_s.so.1",O_RDONLY|O_CLOEXEC|O_VERIFY,02171470032) =
=3D 3
(0x3)

is for lld itself being bound to the library, not for the linking
of main.

The linker (lld) is looking in the wrong places for
various libraries --but based on what it has been told
on its command line.

For reference:

# find /lib*/ /usr/lib*/ -name "libgcc_s*" -print | more
/lib/libgcc_s.so.1
/usr/lib/debug/lib/libgcc_s.so.1.debug
/usr/lib/debug/usr/lib32/libgcc_s.so.1.debug
/usr/lib/libgcc_s.so
/usr/lib32/libgcc_s.so.1
/usr/lib32/libgcc_s.so



Context notes:

The context is head -r538510 based, with ports based on
-r526539 .

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-214404-7788-azGr8K7Ak9>