Subject: Re: pkgsrc and native gcc
To: None <tech-pkg@NetBSD.org, pkgsrc-users@NetBSD.org,>
From: Gilles Dauphin <Gilles.Dauphin@enst.fr>
List: tech-pkg
Date: 08/17/2006 09:27:41
> 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?

I send you my mk.conf, hope this help, look at 
BUILDLINK_PASSTHRU_RPATHDIRS and in the mk/wrapper ...

-------------------------mk.conf---------------
# Example /usr/pkg/etc/mk.conf file produced by bootstrap-pkgsrc
# Mon Dec 19 17:34:24 CET 2005

# On essaie de compiler en 64bits sur AMD
#ABI?=32
OPENWINABI=	64
LIBABISUFFIX= /64

.ifdef BSD_PKG_MK	# begin pkgsrc settings

ABI=	64
PKG_DBDIR=	/var/db/pkg
LOCALBASE=	/usr/pkg
VARBASE=	/var
PKG_TOOLS_BIN=	/usr/pkg/sbin
PKGMANDIR=	man

TOOLS_PLATFORM.awk?=            /usr/pkg/bin/nawk
TOOLS_PLATFORM.sed?=            /usr/pkg/bin/nbsed
FETCH_CMD=                      /usr/pkg/bin/ftp
TOOLS_PLATFORM.pax?=            /usr/pkg/bin/pax
TOOLS_PLATFORM.tar?=            /usr/pkg/bin/tar
TOOLS_PLATFORM.mtree?=          /usr/pkg/sbin/mtree

PAX=/usr/pkg/bin/pax
SED=/usr/pkg/bin/nbsed

.endif			# end pkgsrc settings

#Automatically build and save binary packages on dependencies.
DEPENDS_TARGET=package

PKG_DEVELOPER?= yes
FAILOVER_FETCH= yes               # insist on the correct checksum

# accept toutes les LICENCES: comercial et autres
_ACCEPTABLE=yes

#ALLOW_VULNERABLE_PACKAGES= yes
ALLOW_VULNERABLE_PACKAGES= gdb

# Pour gcc34
# From: rillig@netbsd.org
#Please set CONFIG_SHELL=/bin/ksh in your mk.conf and try again.
#If that doesn't work, try another shell, maybe bash.
#
#The cause is most probably that some script used $(cat foo), which
#the Solaris shell does not understand.

CONFIG_SHELL?=/bin/bash

# /bin/ksh is buggy in sol10 @ 24 May 2006, waiting for upper patch 118873-02
WRAPPER_SHELL=/bin/bash


# _BLNK_PASSTHRU_DIRS contains the list of directories which we allow in
#       preprocessor's header, linker's library, or the runtime library
#       search paths.  The values of this list represent entire directory
#       trees under each named directory.  Package makefiles may add to
#       its value through ${BUILDLINK_PASSTHRU_DIRS}.
#
# _BLNK_PASSTHRU_RPATHDIRS contains an extra list of directories which we
#       allow in the runtime library search paths.  Package makefiles may
#       add to its value through ${BUILDLINK_PASSTHRU_RPATHDIRS}.
#

#.for _pkg_mk_conf in ${BUILDLINK_PACKAGES}
#BUILDLINK_LIBDIRS.${_pkg_mk_conf}= lib 
#BUILDLINK_LIBDIRS.${_pkg_mk_conf}+= lib/64
#.endfor

# iconv is a system lib on Solaris10
BUILDLINK_RPATHDIRS.iconv= #empty
BUILDLINK_LIBDIRS.iconv= #empty
IS_BUILTIN.iconv=	yes
USE_BUILTIN.iconv=	yes
ICONV_TYPE=		native

# pthread is a system lib on Solaris10
BUILDLINK_RPATHDIRS.pthread= #empty
BUILDLINK_LIBDIRS.pthread= #empty

# dl is a system lib on Solaris10
BUILDLINK_RPATHDIRS.dl= #empty
BUILDLINK_LIBDIRS.dl= #empty

# gettext est construit a partir de pkgsrc
BUILDLINK_LIBDIRS.gettext= lib 
BUILDLINK_LDFLAGS.gettext=  -R/usr/pkg/lib 
BUILDLINK_LDADD.gettext=	-lintl
IS_BUILTIN.gettext=	yes
USE_BUILTIN.gettext=    no # force use of pkgsrc gettext-lib

BUILDLINK_LIBDIRS.gettext-asprintf= lib 
BUILDLINK_LDFLAGS.gettext-asprintf=  -R/usr/pkg/lib -lasprintf

IS_BUILTIN.getopt=     yes
# On force a Solaris , celui de pkgsrc est cadre par des ifdef, ca va pas...
#USE_BUILTIN.getopt=    no # force use of pkgsrc getopt
USE_BUILTIN.getopt=	yes # force use of Solaris getopt
# getopt is a system lib on Solaris10
BUILDLINK_RPATHDIRS.getopt= #empty
BUILDLINK_LIBDIRS.getopt= #empty



#BUILDLINK_LDFLAGS.gettext=  -L/usr/pkg/lib -R/usr/pkg/lib -L/usr/lib/64 
-R/usr/lib/64
#BUILDLINK_LDADD.gettext= -R/usr/pkg/lib -L/usr/pkg/lib -lintl
#BUILDLINK_LDADD.gettext= -lintl
########################################
# Y a un sac de moeud avec gettext et libintl
# gettext exist en Solaris 10 mais pas de la bonne version
# gettext de pkgsrc fou la merde quand o construit gcc,... dilemme!
########################################
#USE_BUILTIN.gettext=	yes
#USE_MSGFMT_PLURALS= yes


#LDFLAGS?= -L/usr/pkg/lib -R/usr/pkg/lib -L/usr/lib/64 -R/usr/lib/64


BUILDLINK_PASSTHRU_DIRS+=	/usr/java
BUILDLINK_PASSTHRU_DIRS+=	/usr/sfw
BUILDLINK_PASSTHRU_RPATHDIRS+=	/usr/sfw/lib/64
#BUILDLINK_PASSTHRU_DIRS+=	/usr/lib/64
#BUILDLINK_PASSTHRU_DIRS+=	/usr/pkg
#BUILDLINK_PASSTHRU_RPATHDIRS+=	/usr/pkg/lib
#BUILDLINK_PASSTHRU_DIRS+=	/usr/openwin
#BUILDLINK_PASSTHRU_RPATHDIRS+=	/usr/openwin/lib


#.ifdef ABI
#.   if ${ABI} == "64"
#MABIFLAG= -m64
#LIBABISUFFIX= /64
#CFLAGS+= -m64
#LDFLAGS+= -m64
#.   else
#ABI=32
#.   endif
#.else	# defined(ABI)
#ABI=64
#MABIFLAG= -m64
#LIBABISUFFIX= /64
#CFLAGS+= -m64
#LDFLAGS+= -m64
#.endif	# defined(ABI)

# Patch pour prendre gawk, le nawk de sun merde pour construire kde
#AWK=/usr/local/bin/awk

#a voir et revoir avec IS_BUILTIN.pkg et USE_BUILTIN.pkg
#PREFER_PKGSRC=yes
#a cause de libiconv et de gcc34 qui ne tourne qu'en 32 bit
PREFER_NATIVE= yes

# mDNSResponder does not compile with that
USE_INET6=	no

# On utilise la zlib native, je ne sais trop pourquoi
IS_BUILTIN.zlib=	yes
USE_BUILTIN.zlib=	no # force use of pkgsrc zlib a cause de -R/usr/lib/64
BUILDLINK_LIBDIRS.zlib= lib 
BUILDLINK_LDFLAGS.zlib=  -R/usr/pkg/lib 
#BUILDLINK_RPATHDIRS.zlib= #empty
BUILDLINK_RPATHDIRS.zlib= lib


# pour que le BUILDLINK_LDFLAGS soit le bon
USE_BUILTIN.bzip2= no
PREFER.bzip2= pkgsrc
USE_BZIP2= yes
#BUILDLINK_LIBDIRS.bzip2= lib 
#BUILDLINK_LDFLAGS.bzip2=  -L/usr/pkg/lib -R/usr/pkg/lib -L/usr/lib/64 
-R/usr/lib/64

# Prefer pkgsrc for xpm
IS_BUILTIN.xpm=	yes
USE_BUILTIN.xpm=	no
PREFER.xpm=	pkgsrc
#BUILDLINK_LIBDIRS.xpm= lib 
#BUILDLINK_LDFLAGS.xpm=  -R/usr/pkg/lib -lXpm

# Bug avec db4: il manque -R/usr/pkg/lib
#BUILDLINK_LDFLAGS.db4+= -R/usr/pkg/lib -ldb4

#PKG_OPTIONS=	-oss -nas
### pour SDL
PKG_OPTIONS.SDL=	-arts -nas

PKG_OPTIONS.mplayer=	-oss -nas -mplayer-runtime-cpudetection -mplayer-win32
PKG_OPTIONS.gmplayer=	-oss -nas -mplayer-runtime-cpudetection -mplayer-win32

#### Pour octave###
# l'option hdf5 fait tout merder
########
PKG_OPTIONS.octave= -hdf5

### eviv2 ne compile pas pour le moment###
PKG_OPTIONS.gimp-ufraw=	-exiv2

PKG_OPTIONS.koffice= -koffice-wv2

### problem avec cyrus-sasl de creation de 'users'
#PKG_OPTIONS.kdebase=	-sasl


#### bug solaris avec fixesext.pc
# that is not correct, but work. In solaris10 Xfixes is release 3.0
# The actual pkgsrc release is 2.0 (23 Aug 2005). So, making the lib would 
# work. It install the wanted fixesext.pc in the right place: 
# /usr/pkg/lib/pkgconfig/fixesext.pc
IS_BUILTIN.fixesext=    no
USE_BUILTIN.fixesext=   no
PREFER.fixesext= 	pkgsrc
# change to fixesproto
IS_BUILTIN.fixesproto=    no
USE_BUILTIN.fixesproto=   no
PREFER.fixesproto= 	pkgsrc

########## A revoir #########
IS_BUILTIN.xproto= 	yes
USE_BUILTIN.xproto=	yes
PREFER.xproto=		native

#######################
# dans le package heimdal on a l'option PKG_SUPPORTED_OPTIONS=      
kerberos-prefix-cmds ldap
# on prefere l'implementation mit pour krb5, il a l'air plus simple!
# Pas sur que ce soit la bonne option
# On essaie ... Faut voir a l'usage lequel est le mieux supporte
# et si on a besoin de ldap avec krb5????
# 16 Fev 2006: mit-krb5 est RESTRICTED, zut!
#####################
#KRB5_DEFAULT=	mit-krb5
#PKG_OPTIONS.mit-krb5= kerberos-prefix-cmds
KRB5_DEFAULT= heimdal
PKG_OPTIONS.heimdal= kerberos-prefix-cmds

#########################################
# corrige le bug devel/pkg-config, x11/Xfixes, x11/xextensions,x11/fixesext
#########################################
#
#PKG_CONFIG_LIBDIR=/usr/pkg/lib/pkgconfig
#export PKG_CONFIG_LIBDIR


#######################################################
# for bulk build
#######################################################
# A list of pkgs which we should _never_ delete during a build.  The primary
# use is for digest and also for xpkgwedge.  Add pkgtools/xpkgwedge in
# /etc/mk.conf to do an xpkgwedged bulk build.
BULK_PREREQ+=   devel/libtool-base pkgtools/pkg_install-info devel/gettext-lib 
devel/gmake lang/gawk pkgtools/x11-links pkgtools/xpkgwedge
# Because of bug in bulk build, Solaris bootstrap need lang/nawk
BULK_PREREQ+=	lang/nawk
#BULK_PREREQ+=   pkgtools/x11-links pkgtools/xpkgwedge

BULKFILESDIR=/pkg/bulkfiles

DISTDIR=/home/distfiles
PACKAGES=/pkg/packages
WRKOBJDIR=/pkg/obj

# The fist sourceforge site in MASTER_SITE_SOURCEFORGE is usually down or
# overloaded, select a different one to speed up downloads
MASTER_SITE_SOURCEFORGE+=http://easynews.dl.sourceforge.net/sourceforge/