Bug 277508 - lang/gnat12: make install fails on linker error (file in wrong format)
Summary: lang/gnat12: make install fails on linker error (file in wrong format)
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm64 Any
: --- Affects Some People
Assignee: Thierry Thomas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-05 17:02 UTC by ckenna
Modified: 2024-04-03 14:42 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (thierry)


Attachments
config.log (81.99 KB, text/plain)
2024-03-18 15:59 UTC, Robert William Vesterman
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description ckenna 2024-03-05 17:02:06 UTC
When running a `make install` on the lastest lang/gnat12 from the ports tree with the default configuration, the build eventually fails at this step:


/usr/ports/lang/gnat12/work/.build/./gcc/xgcc -B/usr/ports/lang/gnat12/work/.build/./gcc/ -B/usr/local/gnat12/x86_64-portbld-freebsd14.0/bin/ -B/usr/local/gnat12/x86_64-portbld-freebsd14.0/lib/ -isystem /usr/local/gnat12/x86_64-portbld-freebsd14.0/include -isystem /usr/local/gnat12/x86_64-portbld-freebsd14.0/sys-include    -O2  -g -O2 -pipe  -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DIN_GCC -fPIC   -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fpic -pthread -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map  -o ./libgcc_s.so.1.tmp -g -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _divmoddi4_s.o _udivdi3_s.o _umoddi3_s.o _udivmoddi4_s.o _udiv_w_sdiv_s.o cpuinfo_s.o sfp-exceptions_s.o _divhc3_s.o _mulhc3_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendhfsf2_s.o extendhfdf2_s.o extendhftf2_s.o extendhfxf2_s.o extendsfdf2_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfhf2_s.o truncxfhf2_s.o truncdfhf2_s.o truncsfhf2_s.o trunctfsf2_s.o truncdfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o fixhfti_s.o fixunshfti_s.o floattihf_s.o floatuntihf_s.o eqhf2_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/usr/local/bin/ld: skipping incompatible /lib/libc.so.7 when searching for /lib/libc.so.7
/usr/local/bin/ld: cannot find /lib/libc.so.7: file in wrong format
/usr/local/bin/ld: skipping incompatible /lib/libc.so.7 when searching for /lib/libc.so.7
/usr/local/bin/ld: skipping incompatible /usr/lib/libc_nonshared.a when searching for /usr/lib/libc_nonshared.a
/usr/local/bin/ld: cannot find /usr/lib/libc_nonshared.a: file in wrong format
/usr/local/bin/ld: skipping incompatible /usr/lib/libc_nonshared.a when searching for /usr/lib/libc_nonshared.a
collect2: error: ld returned 1 exit status
gmake[4]: *** [Makefile:995: libgcc_s.so] Error 1
gmake[4]: Leaving directory '/usr/ports/lang/gnat12/work/.build/x86_64-portbld-freebsd14.0/32/libgcc'
gmake[3]: *** [Makefile:1211: multi-do] Error 1
gmake[3]: Leaving directory '/usr/ports/lang/gnat12/work/.build/x86_64-portbld-freebsd14.0/libgcc'
gmake[2]: *** [Makefile:127: all-multi] Error 2
gmake[2]: *** Waiting for unfinished jobs....
gmake[2]: Leaving directory '/usr/ports/lang/gnat12/work/.build/x86_64-portbld-freebsd14.0/libgcc'
gmake[1]: *** [Makefile:14059: all-target-libgcc] Error 2
gmake[1]: Leaving directory '/usr/ports/lang/gnat12/work/.build'
gmake: *** [Makefile:1030: all] Error 2
===> Compilation failed unexpectedly.


I tried toggling several options around how to bootstrap the install, but was unable to get it to work. Also did the "make jobs unsafe" flag set to yes, and same failure.
Comment 1 Thierry Thomas freebsd_committer freebsd_triage 2024-03-05 17:36:33 UTC
This ports builds fine in poudriere, and a package for x86_64-portbld-freebsd14.0 is available from the compilation farm...

I do not know this error, and I have to investigate.

Just to check: could you please add the output of `file /lib/libc.so.7' ?
Comment 2 ckenna 2024-03-05 18:09:49 UTC
Hi Thierry,

Certainly. Here is the output you requested:

file /lib/libc.so.7 :
/lib/libc.so.7: ELF 64-bit LSB shared object, x86-64, version 1 (FreeBSD), dynamically linked, for FreeBSD 14.0 (1400097), stripped

Let me know how I can help further.
Comment 3 Thierry Thomas freebsd_committer freebsd_triage 2024-03-05 18:15:20 UTC
Well, it's OK. Let me think...
Comment 4 Robert William Vesterman 2024-03-16 22:33:05 UTC
I've also been unable to build this port since about the same time (sorry, not sure exactly, but almost certainly early March, and late February at the latest). However, for me, it fails with a different error. I use synth to build ports; here's the end of its log for this one:

--------------------------------------------------------------------------------
--  Phase: configure
--------------------------------------------------------------------------------
===>  Configuring for gnat12-12.2.0_7
/usr/bin/find /construction/xports/lang/gnat12/work/gcc-12.2.0/gcc/config -name "*freebsd.h" |  /usr/bin/xargs /usr/bin/sed -i.bak -e 's|!static:[[:blank:]]|!static: --hash-style=gnu -rpath /usr/local/gnat12/lib |'
echo "-=> GNAT [FreeBSD64]" > /construction/xports/lang/gnat12/work/gcc-12.2.0/gcc/REVISION
echo "release" > /construction/xports/lang/gnat12/work/gcc-12.2.0/gcc/DEV-PHASE
configure: loading site script /xports/Templates/config.site
checking build system type... x86_64-portbld-freebsd13.2
checking host system type... x86_64-portbld-freebsd13.2
checking target system type... x86_64-portbld-freebsd13.2
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for gawk... (cached) /usr/bin/awk
checking for libatomic support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... no
checking for libphobos support... yes
checking for gcc... /construction/xports/lang/gnat12/work/gnat-x86_64-freebsd.13-12.2.0_6/bin/gcc
checking whether the C compiler works... no
configure: error: in `/construction/xports/lang/gnat12/work/.build':
configure: error: C compiler cannot create executables
See `config.log' for more details
===>  Script "configure" failed unexpectedly.
Please report the problem to thierry@FreeBSD.org [maintainer] and attach the
"/construction/xports/lang/gnat12/work/.build/config.log" including the output
of the failure of your make command. Also, it might be a good idea to provide
an overview of all packages installed on your system (e.g. a
/usr/local/sbin/pkg-static info -g -Ea).
*** Error code 1

Stop.
make: stopped in /xports/lang/gnat12
Comment 5 Thierry Thomas freebsd_committer freebsd_triage 2024-03-17 14:59:56 UTC
In order to let lang/gcc12 and lang/gnat12 share the same distfile, I have just upgraded this port to 12.3.0 - with the same assets for the moment.

Could you please tell me if your issue still exists with this version?
Comment 6 Robert William Vesterman 2024-03-18 03:23:24 UTC
(In reply to Thierry Thomas from comment #5)

Sorry, it still happens. Or at least something that looks at a glance like the same thing happens; I haven't pored over it to know that it's exactly the same or not.

Honestly I'm not even sure why Synth wants to build this. It's not one of the things that I've explicitly asked it to build, it's not installed on my system, and the fact that it fails doesn't cause any other ports to fail or to be skipped.

Anyway, here's the end of the log from this attempt:

  --------------------------------------------------------------------------------
  --  Phase: configure
  --------------------------------------------------------------------------------
  ===>  Configuring for gnat12-12.3.0
  /usr/bin/find /construction/xports/lang/gnat12/work/gcc-12.3.0/gcc/config -name "*freebsd.h" |  /usr/bin/xargs /usr/bi  n/sed -i.bak -e 's|!static:[[:blank:]]|!static: --hash-style=gnu -rpath /usr/local/gnat12/lib |'
  echo "-=> GNAT [FreeBSD64]" > /construction/xports/lang/gnat12/work/gcc-12.3.0/gcc/REVISION
  echo "release" > /construction/xports/lang/gnat12/work/gcc-12.3.0/gcc/DEV-PHASE
  configure: loading site script /xports/Templates/config.site
  checking build system type... x86_64-portbld-freebsd13.2
  checking host system type... x86_64-portbld-freebsd13.2
  checking target system type... x86_64-portbld-freebsd13.2
  checking for a BSD-compatible install... /usr/bin/install -c
  checking whether ln works... yes
  checking whether ln -s works... yes
  checking for a sed that does not truncate output... (cached) /usr/bin/sed
  checking for gawk... (cached) /usr/bin/awk
  checking for libatomic support... yes
  checking for libitm support... yes
  checking for libsanitizer support... yes
  checking for libvtv support... no
  checking for libphobos support... yes
  checking for gcc... /construction/xports/lang/gnat12/work/gnat-x86_64-freebsd.13-12.2.0_6/bin/gcc
  checking whether the C compiler works... no
  configure: error: in `/construction/xports/lang/gnat12/work/.build':
  configure: error: C compiler cannot create executables
  See `config.log' for more details
  ===>  Script "configure" failed unexpectedly.
  Please report the problem to thierry@FreeBSD.org [maintainer] and attach the
  "/construction/xports/lang/gnat12/work/.build/config.log" including the output
  of the failure of your make command. Also, it might be a good idea to provide
  an overview of all packages installed on your system (e.g. a
  /usr/local/sbin/pkg-static info -g -Ea).
  *** Error code 1

  Stop.
  make: stopped in /xports/lang/gnat12
Comment 7 Thierry Thomas freebsd_committer freebsd_triage 2024-03-18 07:27:05 UTC
This is very strange! Could you please attach the config.log?
Comment 8 Robert William Vesterman 2024-03-18 14:26:05 UTC
I'm not sure... I believe the /construction path is something that's generated automatically by Synth when needed and destroyed automatically by Synth when it's done (perhaps via zfs? not sure). In any case, I don't have a /construction path on my machine right now.

I don't see any obvious configuration options to keep the directory, or anything like that. I'll ask on the Synth forums, and I'll keep poking around myself too.
Comment 9 Robert William Vesterman 2024-03-18 15:59:56 UTC
Created attachment 249270 [details]
config.log
Comment 10 Robert William Vesterman 2024-03-18 16:09:41 UTC
I notice that the immediate issue seems to be this:

ld-elf.so.1: Shared object "libintl.so.8" not found, required by "gcc"

I don't know much about this stuff, but I think that has something to do with NLS? So I should probably mention that I compile everything with OPTIONS_UNSET+=NLS.
Comment 11 Thierry Thomas freebsd_committer freebsd_triage 2024-03-18 16:56:45 UTC
(In reply to Robert William Vesterman from comment #10)
> I compile everything with OPTIONS_UNSET+=NLS

Yes, this is surely the problem!

In Makefile (line #91), there is "NLS_USES=	gettext-runtime", but without NLS you don't get it.

This means that gettext might be required in all cases.

Could you please modify line #24 and add gettext-runtime?
It will become:
USES=	bison gmake iconv libtool localbase tar:xz gettext-runtime
Comment 12 Robert William Vesterman 2024-03-18 19:27:11 UTC
(In reply to Thierry Thomas from comment #11)

That seems to have worked. Thank you!
Comment 13 Thierry Thomas freebsd_committer freebsd_triage 2024-03-18 20:35:44 UTC
Thanks for the feedback.

ckenna@hey.com does it solve your issue too?
Comment 14 commit-hook freebsd_committer freebsd_triage 2024-03-18 21:03:42 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8d9daace01d0b71130cd0e8fbfcf4dc987ff756c

commit 8d9daace01d0b71130cd0e8fbfcf4dc987ff756c
Author:     Thierry Thomas <thierry@FreeBSD.org>
AuthorDate: 2024-03-18 20:32:22 +0000
Commit:     Thierry Thomas <thierry@FreeBSD.org>
CommitDate: 2024-03-18 20:32:22 +0000

    lang/gnat1?: force the usage of gettext

    It appears that gettext is required even when NLS is disabled (surely
    because the compiler used for bootstrap has been built with NLS).

    No bump of PORTREVISION needed.

    PR:             277508
    Reported by:    bob (at) vesterman.com

 lang/gnat12/Makefile | 3 +--
 lang/gnat13/Makefile | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
Comment 15 Robert William Vesterman 2024-03-18 23:37:53 UTC
Just to follow up thoroughly: I tried with the updated port (as opposed to with manual modification of the Makefile), and that worked fine too. Thanks again!
Comment 16 Robert William Vesterman 2024-04-03 14:42:22 UTC
That machine (which had the issue that was then fixed) is running 13.2. On a different machine, which is running 14.0, I'm now getting the same issue that the OP got ("cannot find /lib/libc.so.7: file in wrong format" and so forth).