tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Using a replacement linker with pkgsrc



On 2020-06-25 13:22, Brook Milligan wrote:
I am trying to build fonts/harfbuzz on a CentOS machine and am running into an issue with the linker.

The problem occurs when the configure scripts checks if the compiler is working; it decides it is not.

Harfbuzz has GCC_REQD=4.9 set, gcc49 is installed as a dependency, and it is run when configure is checking for a working compiler.  However, the following error is in config.log:

configure:4516: checking whether the C compiler works
configure:4538: cc -O2 -I/project/pkgsrc/pkg-2020Q1/include -I/project/pkgsrc/pkg-2020Q1/include/glib-2.0 -I/project/pkgsrc/pkg-2020Q1/include/gio-unix-2.0 -I/project/pkgsrc/pkg-2020Q1/lib/glib-2.0/include -I/usr/include -I/project/pkgsrc/pkg-2020Q1/include/freetype2 -I/project/pkgsrc/pkg-2020Q1/include -I/project/pkgsrc/pkg-2020Q1/include/glib-2.0 -I/project/pkgsrc/pkg-2020Q1/include/gio-unix-2.0 -I/project/pkgsrc/pkg-2020Q1/lib/glib-2.0/include -I/usr/include -I/project/pkgsrc/pkg-2020Q1/include/freetype2 -L/project/pkgsrc/pkg-2020Q1/gcc49/lib/gcc/x86_64-redhat-linux/4.9.4 -Wl,-R/project/pkgsrc/pkg-2020Q1/gcc49/lib/gcc/x86_64-redhat-linux/4.9.4 -L/project/pkgsrc/pkg-2020Q1/lib -Wl,-R/project/pkgsrc/pkg-2020Q1/lib -L/usr/lib64 -Wl,-R/usr/lib64 conftest.c  >&5
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status

It seems that gcc49 is running the native linker in some way that prevents it from finding /usr/lib64/libgcc_s.so.1, which does exist.

What should be done in a situation like this?  Is there a need to use a different linker somehow?  Any advice is welcome.

Thanks.

Cheers,
Brook

This might be the same issue I hit a while back.  My workaround is below, along with another to use a newer gas that can handle the machine code output by more modern GCC.  These hacks are automatically added to mk.conf by auto-pkgsrc-setup on RHEL/CentOS systems.

http://netbsd.org/~bacon/

# Keep this in sync with pbulk-setup
.if exists(/etc/redhat-release) && !empty(PKGPATH:Mlang/gcc*)

# RHEL systems may have an outdated "as" that cannot translate instructions
# from current GCC code generators, so force pkgsrc binutils.
CONFIGURE_ARGS+=        --with-gnu-as --with-as=${PREFIX}/bin/gas
CONFIGURE_ARGS+=        --with-gnu-ld --with-ld=${PREFIX}/bin/gld
BUILDLINK_DEPMETHOD.binutils=   full
.  include "../../devel/binutils/buildlink3.mk"

# pkgsrc gcc packages don't install libgcc_s on some platforms, to
# avoid problems when mixing compiler versions.  This breaks our use
# of pkgsrc gcc on EL.
PKG_DEFAULT_OPTIONS+=   always-libgcc
.endif  # RHEL
.endif  # BSD_PKG_MK




Home | Main Index | Thread Index | Old Index