[MacPorts] #54104: gcc6 and libgcc fail to build on Tiger i386 due to -ldylib1.10 not found. Fixes to repair.
MacPorts
noreply at macports.org
Wed May 3 23:31:19 UTC 2017
#54104: gcc6 and libgcc fail to build on Tiger i386 due to -ldylib1.10 not found.
Fixes to repair.
--------------------+-------------------------
Reporter: kencu | Owner:
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Keywords: tiger | Port: gcc6 libgcc
--------------------+-------------------------
I'll start off by admitting up front that this is of interest to very few.
If you have a Tiger VM you might possibly be interested in this. I don't
expect anyone to fix this. My apologies to those who find this noise on
the system.
Tiger PPC builds gcc6 and libgcc without any trouble. However, the build
on Tiger i386 fails with the above error.
It appears that the essential issue is that the environment variables
don't get passed through to all the builds of the libraries and second and
third stages. During the configure and make stages, no `-mmacosx-version-
min` is specified on the compile line. It appears that the logic in the
gcc6 darwin configuration files defaults to putting `-mmacosx-version-
min=10.5` if it sees no other, and so when this builds on Tiger 10.4, the
proper 10.5 libraries are not found. Why this occurs on intel i386 and not
on PPC is a mystery to me at present. I didn't try x86_64 on Tiger.
The fix is to get `-mmacosx-version-min=10.4` onto all the compile lines
somehow. GCC has a lot of tools to do this, and there are variables like
`BOOT_CFLAGS` and `STAGE1_CFLAGS` and many more to help force these
compiles to proceed. I tried adjusting these things in the portfile,
adding them to the build.args in various ways, but in the end, I did not
figure it out. It doesn't help that gcc6 takes hours to build, so test
cycles are long.
I wound up manually editing the Makefile in the build directory, which
works correctly. I'm sure there is a more elegant way to do this, but I
ran out patience after a suitable number of attempts.
To build it, I first ran `sudo port configure libgcc`, and then tried
various things, ultimately editing the work/build/Makefile in four places
like so:
{{{
# Flags to pass to stage2 and later makes. They are defined
# here so that they can be overridden by Makefile fragments.
-BOOT_CFLAGS= -g -O2
+BOOT_CFLAGS= -g -O2 -mmacosx-version-min=10.4
CFLAGS = -pipe -Os
-LDFLAGS = -L/opt/local/lib -Wl,-headerpad_max_install_names
+LDFLAGS = -L/opt/local/lib -Wl,-headerpad_max_install_names -mmacosx-
version-min=10.4
-STAGE1_CFLAGS = -g
+STAGE1_CFLAGS = -g -mmacosx-version-min=10.4
STAGE1_CHECKING = --enable-checking=yes
-CFLAGS_FOR_TARGET = -g -O2 -pipe -Os
-CXXFLAGS_FOR_TARGET = -g -O2 -pipe -Os
+CFLAGS_FOR_TARGET = -g -O2 -pipe -Os -mmacosx-version-min=10.4
+CXXFLAGS_FOR_TARGET = -g -O2 -pipe -Os -mmacosx-version-min=10.4
}}}
After that built, I ran `sudo port configure gcc6`, made the same edits in
work/build/Makefile as above, and gcc6 built through to completion.
You would think that these could have been passed in to the gcc6 build
process without editing the Makefile, and I'm sure it should be able to be
so, but none of what I tried worked.
In addition to these flags, there was one minor patch needed to
`/libcilkrts/runtime/sysdep-unix.c`, to make it work on Tiger Intel, which
I have included here. This patch was not needed on Tiger PPC.
I also made one enhancement to libgcc, to make it default to always
building software that is ABI compatible with the gcc4 ABI, to help make
it less likely to have issues with gcc42's libstdc++ on Tiger. This is
accomplished with the following bit:
{{{
variant usegcc4abi description {default to gcc4-compatible ABI} {
configure.args-append --with-default-libstdcxx-abi=gcc4-compatible
}
}}}
I'll attach the Portfile that worked for gcc 6.02 , and the Tiger
patchfile, for any other intrepid software archeologists. Sorry for any
glaring errors I made.
In the end, gcc and libgcc appear to work as expected. I'm hoping to get
them both built +universal if possible, so that I can compile software on
the VM and use it on Tiger PPC.
--
Ticket URL: <https://trac.macports.org/ticket/54104>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list