Date: Fri, 2 Jul 2010 22:54:20 +0100 From: Philip Herron <redbrain@gcc.gnu.org> To: Matthew Fleming <mdf356@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: Using lex in a shared library Message-ID: <AANLkTildN27EcRSXXTpQl5vZD-kczKrIbgERQuiNkiTt@mail.gmail.com> In-Reply-To: <AANLkTilp0zvMRbw96cifhIzmT4YbNVkxgOFZFa_nvl2m@mail.gmail.com> References: <AANLkTilp0zvMRbw96cifhIzmT4YbNVkxgOFZFa_nvl2m@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2 July 2010 22:51, Matthew Fleming <mdf356@gmail.com> wrote: > I have the following Makefile for a shared library at $work: > > ISI_TOP=3D =A0 =A0 =A0 =A0../.. > > LIB=3D =A0 =A0 =A0 =A0 =A0 =A0isi_date > SHLIB_MAJOR=3D =A0 =A01 > SHLIB_MINOR=3D =A0 =A00 > SRCS=3D =A0 =A0 =A0 =A0 =A0 date.c date_parser.new.c lex.yy.c > INCS=3D =A0 =A0 =A0 =A0 =A0 date.h > INCLUDEDIR=3D =A0 =A0 /usr/include/isi_date > > YFLAGS+=3D =A0 =A0 =A0 =A0-vt > FLEX=3D =A0 =A0 =A0 =A0 =A0 /usr/bin/flex > LDADD=3D =A0 =A0 =A0 =A0 =A0-ll > > CLEANFILES+=3D =A0 =A0date_parser.new.c y.tab.h y.tab.c lex.yy.c y.output= \ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0check_date.log test > > lex.yy.c: date_lexer.new.l > =A0 =A0 =A0 =A0${FLEX} $> > > CFLAGS+=3D =A0 =A0 =A0 =A0-I${.CURDIR} > #CFLAGS+=3D =A0 =A0 =A0 -g > > .include "${ISI_TOP}/isi.lib.mk" > > > > This builds fine as on i386. =A0I'm trying to get all our user-space to > be 64-bit clean, and I run into an error when building on amd64: > > /data/sb/BR_MDF_64CLEAN/obj/data/sb/BR_MDF_64CLEAN/src/tmp/usr/bin/ld: > /data/sb/BR_MDF_64CLEAN/obj/data/sb/BR_MDF_64CLEAN/src/tmp/usr/lib/libl.a= (libyywrap.o): > relocation R_X86_64_32 can not be used when making a shared object; > recompile with -fPIC > /data/sb/BR_MDF_64CLEAN/obj/data/sb/BR_MDF_64CLEAN/src/tmp/usr/lib/libl.a= : > could not read symbols: Bad value > > The following diff makes the compile work, but I have no idea (yet) > whether this will run, if it's the right solution, etc. > > > Index: usr.bin/lex/lib/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- usr.bin/lex/lib/Makefile =A0 =A0(revision 153343) > +++ usr.bin/lex/lib/Makefile =A0 =A0(working copy) > @@ -4,11 +4,16 @@ > > =A0LIB=3D =A0 =A0ln > =A0SRCS=3D =A0 libmain.c libyywrap.c > -NO_PIC=3D > +#NO_PIC=3D > > +SHLIB_MAJOR=3D =A0 1 > +SHLIB_MINOR=3D =A0 0 > + > =A0.if ${MK_INSTALLLIB} !=3D "no" > =A0LINKS=3D =A0${LIBDIR}/libln.a ${LIBDIR}/libl.a > =A0LINKS+=3D =A0 =A0 =A0 =A0${LIBDIR}/libln.a ${LIBDIR}/libfl.a > +LINKS+=3D =A0 =A0 =A0 =A0${LIBDIR}/libln.so ${LIBDIR}/libl.so > +LINKS+=3D =A0 =A0 =A0 =A0${LIBDIR}/libln${LIB_SUFFIX}.so ${LIBDIR}/libl$= {LIB_SUFFIX}.so > =A0.endif > > =A0.if ${MK_PROFILE} !=3D "no" > > > Thanks, > matthew > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org= " > Although maybe not helpful but have you considered using automake/libtool instead makes it so much simpler in my opinion. --Phil
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTildN27EcRSXXTpQl5vZD-kczKrIbgERQuiNkiTt>