autoconf
[Top][All Lists]
Advanced

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

autoconf check for building shared library


From: Will Parsons
Subject: autoconf check for building shared library
Date: Sat, 2 Apr 2016 03:23:03 +0000 (UTC)
User-agent: slrn/1.0.2 (FreeBSD)

During the course of attempting to develop a ruby gem C extension, I
came upon the following error trying to build a simple C library on a
FreeBSD system:

linking shared-object gdi.so
/usr/bin/ld: /home/william/lib/libWinspool.a(winspool.o): relocation 
R_X86_64_PC32 against `memset@@FBSD_1.0' can not be used when making a shared 
object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value

>From googling, what I *think* that what this means is that I have to
use -fPIC flag to the compiler when building the shared library using
GCC.  Presumably, -fPIC is a GCC-only flag, so if I want to maintain
portability I need to build that into my configure.ac somehow.  I have
so far been unable to discover a means to do so in autoconf.  Ideally,
I'd like a macro that would translate "I'm building shared library" to
"CFLAGS += -fPIC", or something similar if GCC is being used.  Failing
that, can I test for whether GCC is being used and add "-fPIC" to the
compile flags if it is?

I amm interested in an autoconf solution, not involving e.g., automake
or libtool.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]