Subject: pkgsrc and native gcc
To: None <tech-pkg@netbsd.org, pkgsrc-users@netbsd.org>
From: Raymond Meyer <raymond.meyer@rambler.ru>
List: pkgsrc-users
Date: 08/17/2006 04:12:58
Hi, I have a native installation of gcc under /opt/gcc4. I want to use this gcc
for building all packages, instead of building a gcc from pkgsrc. The only
problem I am having is making sure that libraries under /opt/gcc4/lib are found
during run time. Some packages are linked against gcc's libgcc_s.so.1 and
libstdc++.so.6 libraries under /opt/gcc4/lib, however when I run 'ldd' on the
executable those libraries are not found. I don't want to set LD_LIBRARY_PATH,
instead I want to embed that path with -R/opt/gcc4/lib linker flag.

I tried setting the following variables in my mk.conf file:

_NATIVE_GCC_BASE=/opt/gcc4
LDFLAGS+=-L${_NATIVE_GCC_BASE}/lib -R${_NATIVE_GCC_BASE}/lib
CFLAGS=-L${_NATIVE_GCC_BASE}/lib -Wl,-R${_NATIVE_GCC_BASE}/lib
CXXFLAGS=-L${_NATIVE_GCC_BASE}/lib -Wl,-R${_NATIVE_GCC_BASE}/lib

however it doesn't seem to help, i.e. running 'ldd' on executable shows that
gcc libraries are not found.

Does anyone know how to ensure that the path to gcc libraries is recorded in
the output object file?