Opened 22 months ago

Closed 22 months ago

Last modified 22 months ago

#66832 closed defect (fixed)

libgcc12 build fails if libmd is installed

Reported by: nocturne-mit Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: libgcc12 libmd

Description (last modified by nocturne-mit)

I'm migrating to Ventura on an Apple Silicon mac.

After following the standard MacPorts migration doc, libgcc12 fails to build. At the time, there is no gawk available on the system, but the gcc12 Makefile appears to think it should use it anyway, resulting in a gawk invocation failing to create tmp-optionlist, and the build fails.

If I "port clean libgcc12" and then "port install gawk", the libgcc build succeeds.

:info:build checking for gawk... gawk

and later:

:info:build     gawk -f /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/gcc/opt-gather.awk /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/gcc/ada/gcc-interface/lang.opt /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/gcc/d/lang.opt /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/gcc/fortran/lang.opt /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/gcc/go/lang.opt /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/gcc/lto/lang.opt /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/gcc/c-family/c.opt /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/gcc/common.opt /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/gcc/params.opt /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/gcc/analyzer/analyzer.opt /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/gcc/config/aarch64/aarch64.opt /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/gcc/config/rpath.opt /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/gcc/config/darwin.opt > tmp-optionlist
:info:build /bin/sh: gawk: command not found

Attachments (1)

libgcc12-bad.log (1.1 MB) - added by nocturne-mit 22 months ago.
build failure log

Download all attachments as: .zip

Change History (13)

Changed 22 months ago by nocturne-mit

Attachment: libgcc12-bad.log added

build failure log

comment:1 Changed 22 months ago by nocturne-mit

Description: modified (diff)

comment:2 Changed 22 months ago by kencu (Ken)

Although I see your pasted bit, I don't think your build error is primarily due to the lack of "gawk".

Something else has gone on here. This build log is not from a clean build, for one.

Ventura does have "awk"

% ls -la /usr/bin/awk
-rwxr-xr-x  1 root  wheel  351504  2 Dec 03:37 /usr/bin/awk

and the libgcc12 build will use it when it is found, so "gawk" is not required:

checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk

your error seems to have something to do with a failed build of libiberty:

:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/libiberty/sha1.c:57:23: warning: declaration of 'struct sha1_ctx' will not be visible outside of this function [-Wvisibility]
:info:build sha1_init_ctx (struct sha1_ctx *ctx)
:info:build                       ^
:info:build 1 warning generated.
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/libiberty/sha1.c:59:6: error: incomplete definition of type 'struct sha1_ctx'
:info:build   ctx->A = 0x67452301;
:info:build   ~~~^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/libiberty/sha1.c:57:23: note: forward declaration of 'struct sha1_ctx'
:info:build sha1_init_ctx (struct sha1_ctx *ctx)
:info:build                       ^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/libiberty/sha1.c:60:6: error: incomplete definition of type 'struct sha1_ctx'
:info:build   ctx->B = 0xefcdab89;
:info:build   ~~~^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/libiberty/sha1.c:57:23: note: forward declaration of 'struct sha1_ctx'
:info:build sha1_init_ctx (struct sha1_ctx *ctx)
:info:build                       ^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/libiberty/sha1.c:61:6: error: incomplete definition of type 'struct sha1_ctx'
:info:build   ctx->C = 0x98badcfe;
:info:build   ~~~^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/libiberty/sha1.c:57:23: note: forward declaration of 'struct sha1_ctx'
:info:build sha1_init_ctx (struct sha1_ctx *ctx)
:info:build                       ^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/libiberty/sha1.c:62:6: error: incomplete definition of type 'struct sha1_ctx'
:info:build   ctx->D = 0x10325476;
:info:build   ~~~^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/libiberty/sha1.c:57:23: note: forward declaration of 'struct sha1_ctx'
:info:build sha1_init_ctx (struct sha1_ctx *ctx)
:info:build                       ^

please clean your build of libgcc12:

sudo port clean libgcc12

and then try your build again, and see what happens. It is possible some other header is interfering with the libgcc12 build --

comment:3 Changed 22 months ago by kencu (Ken)

Summary: libgcc12 build fails on Ventura with Xcode 14.2 due to new undeclared gawk dependencylibgcc12 build fails on Ventura

comment:4 Changed 22 months ago by kencu (Ken)

Oh, you already said you cleaned, installed gawk, and it built for you.

It installs for me without installing gawk though, so your issue was not the lack of "gawk"... something else happened, possibly can't be sorted out now as the substrate has changed.

My build of the file sha1.c went through without error:

/usr/bin/clang -arch arm64 -c -DHAVE_CONFIG_H -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I. -I/opt/local/var/macports/build/_opt_macportsofficial_macports-ports_lang_gcc12/libgcc12/work/gcc-12.2.0/libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -pedantic  -D_GNU_SOURCE  /opt/local/var/macports/build/_opt_macportsofficial_macports-ports_lang_gcc12/libgcc12/work/gcc-12.2.0/libiberty/sha1.c -o sha1.o

so I'm guessing you had a conflicting sha1.h header installed from something.

Last edited 22 months ago by kencu (Ken) (previous) (diff)

comment:5 Changed 22 months ago by kencu (Ken)

Resolution: worksforme
Status: newclosed

I just rebuilt libgcc12 again, without gawk installed, with no issues.

I'm going to close this ticket, as we can't make any more headway at present.

If someday we find a port that is installing a header called "sha1.h" then that would probably be the thing to look into, but without more info now, no point leaving this open.

comment:6 Changed 22 months ago by nocturne-mit

I also had trouble installing emacs yesterday because its build failed while libmd was installed - as detailed in #59638.

I see that sha1.h is part of libmd. I'll see if I can wipe my install and reproduce this issue.

$ port contents libmd | grep sha1.h
  /opt/local/include/sha1.h
Last edited 22 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:7 Changed 22 months ago by kencu (Ken)

aha -- that seems very likely to be the port that is messing things up!

comment:8 Changed 22 months ago by kencu (Ken)

if we changed libmd to tuck away it's headers like this:

% git diff
diff --git a/devel/libmd/Portfile b/devel/libmd/Portfile
index 2104e922a12..e57e7e75edd 100644
--- a/devel/libmd/Portfile
+++ b/devel/libmd/Portfile
@@ -5,6 +5,7 @@ PortSystem 1.0
 name                libmd
 epoch               1
 version             1.0.4
+revision            1
 categories          devel
 license             BSD ISC Permissive
 platforms           darwin
@@ -27,3 +28,5 @@ checksums           rmd160  4a47a01fa2e47d3c9c9bd27ebd55780a3d82fe66 \
                     size    264472
 
 patchfiles          patch-symbol-alias.diff
+
+configure.args      --includedir=${prefix}/include/libmd

then these generic headers would not be opportunistically found and wreck builds...

 % port contents libmd
Port libmd contains:
  /opt/local/include/libmd/md2.h
  /opt/local/include/libmd/md4.h
  /opt/local/include/libmd/md5.h
  /opt/local/include/libmd/ripemd.h
  /opt/local/include/libmd/rmd160.h
  /opt/local/include/libmd/sha.h
  /opt/local/include/libmd/sha1.h
  /opt/local/include/libmd/sha2.h
  /opt/local/include/libmd/sha256.h
  /opt/local/include/libmd/sha512.h
  /opt/local/lib/libmd.0.dylib
  /opt/local/lib/libmd.a
  /opt/local/lib/libmd.dylib
  /opt/local/lib/pkgconfig/libmd.pc
...

libmd has very few ports that depend on it:

 % port echo depends:libmd
signing-party          

and building it as above would change the pkg-config file correctly to point to the new headers anyway...

Last edited 22 months ago by kencu (Ken) (previous) (diff)

comment:9 Changed 22 months ago by kencu (Ken)

Keywords: ventura removed
Port: libmd added
Resolution: worksforme
Status: closedreopened
Summary: libgcc12 build fails on Venturalibgcc12 build fails if libmd is installed

yep, that is the issue

comment:10 Changed 22 months ago by nocturne-mit

Agreed and verified.

I completely uninstalled and reinstalled macports itself, and was then able to build libgcc12 just fine, with neither libmd nor gawk installed.

When I then ran port uninstall installed, installed libmd, and attempted to rebuild libgcc12, I saw the same error I saw in my very first failure. The build is now finding awk correctly - the real issue occurs with multiple failures like this when trying to compile libiberty/md5.c:

:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/libiberty/md5.c:67:6: error: incomplete definition of type 'struct md5_ctx'
:info:build   ctx->A = (md5_uint32) 0x67452301;
:info:build   ~~~^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/libiberty/md5.c:65:22: note: forward declaration of 'struct md5_ctx'
:info:build md5_init_ctx (struct md5_ctx *ctx)
:info:build                      ^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/gcc-12.2.0/libiberty/md5.c:67:13: error: use of undeclared identifier 'md5_uint32'
:info:build   ctx->A = (md5_uint32) 0x67452301;
:info:build             ^
Last edited 22 months ago by nocturne-mit (previous) (diff)

comment:12 Changed 22 months ago by kencu (Ken)

Owner: set to kencu
Resolution: fixed
Status: reopenedclosed

In 60ecd97472aa1acb4942b2c2fd8e58ea478874e2/macports-ports (master):

libmd: tuck away headers

these headers are too generically named
causes build errors in other software
that has similarly named headers

closes: #66832

Note: See TracTickets for help on using tickets.