Stuart Henderson <s...@spacehopper.org> wrote:

> On 2025/06/20 10:35, Robert B. Carleton wrote:
> > Stuart Henderson <s...@spacehopper.org> wrote:
> > 
> > > On 2025/06/19 22:29, Janne Johansson wrote:
> > > > >
> > > > > I'm trying to compile gcl-2.7.1 on OpenBSD 7.7 with gcc-11. Configure 
> > > > > seems to
> > > > > be stopping on this particular error:
> > > > >
> > > > > configure:7102: egcc -o conftest   -fsigned-char -pipe -fcommon 
> > > > > -fno-builtin-
> > > > > malloc -fno-builtin-free -std=gnu17 -Wall -Wno-empty-body 
> > > > > -Wno-unused-but-set-
> > > > > variable -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64    -no-pie -Werror -Z
> > > > > conftest.c  >&5
> > > > > ld: error: unknown argument '-Z'
> > > > >
> > > > > I'm not all that strong on the compiler tooling, but it appears that 
> > > > > this -Z
> > > > > argument is either being erroneously passed to the linker, or it's 
> > > > > expecting
> > > > > ln to have a -Z option.
> > > > >
> > > > > To add some additional context I did substitute the gcl config.guess 
> > > > > with the
> > > > > one distributed by OpenBSD. Any suggestions of where to look next? Is 
> > > > > there
> > > > > some linker version that does have a -Z option?
> > > > 
> > > > ld.bfd should have it.
> > > 
> > > ...if on an architecture which has ld.bfd (aarch64 doesn't), and if it
> > > works - it still does on i386; I'm not so sure about amd64, I just tried
> > > some simple cases with ports-gcc and base-clang by adding -fuse-ld=bfd
> > > to the command line when using the compiler to link, and ld.bfd is
> > > segfaulting while trying to print an "unresolvable %s relocation
> > > against symbol `%s'" error.
> > > 
> > 
> > I tried it with clang:
> > 
> > $ export CC="clang -fuse-ld=bfd"
> > $ export CXX="clang++ -fuse-ld=bfd"
> > $ ./configure
> > 
> > Configure ended with:
> > 
> > checking whether we are cross compiling... configure: error: in 
> > '/srv/project/rbc/src/gcl-2.7.1':
> > configure: error: cannot run C compiled programs.
> > If you meant to cross compile, use '--host'.
> > See 'config.log' for more details
> > 
> > Here's an excerpt from config.log:
> > 
> > configure:5086: clang -fuse-ld=bfd -o conftest      conftest.c  >&5
> > /usr/bin/ld.bfd: /tmp/conftest-a86d93.o(.text+0x51): unresolvable 
> > <F3>^O^^<FA>L<8B>^]<B5><F0>^D relocation against symbol `__isthreaded'
> > configure:5090: $? = 0
> > configure:5097: ./conftest
> > Segmentation fault (core dumped) 
> > configure:5101: $? = 139
> > configure:5108: error: in '/srv/project/rbc/src/gcl-2.7.1':
> > configure:5110: error: cannot run C compiled programs.
> > If you meant to cross compile, use '--host'.
> > 
> > This is an amd64 host.
> 
> That looks like it's related to the same failure I saw (though in your
> case the random junk it's trying to print in the error message wasn't
> enough to get the string functions to read inaccessible memory and
> trigger a segfault in the linker, so it did produce a binary, but
> not correctly linked).
> 
> The only ports we build with ld.bfd on amd64 are devel/dtools and
> devel/dub, I suspect these only use older relocation types which base
> ld.bfd can handle, whereas the compilers (certainly gcc 8, gcc 11,
> clang) which run into this problem are probably using a newer reloc
> type which old binutils doesn't handle.
> 
> Fixing this is likely to require newer binutils - this can't go into
> base, and is unlikely to be straightforward.
> 
> I'd probably try looking to see if the -Z can be removed from the
> command line instead.
> 

Got it. Thanks for the insights. I'll see if I can remove -Z somehow.

Reply via email to