List:MySQL++« Previous MessageNext Message »
From:Adrian Cornish Date:October 17 2011 11:52pm
Subject:Re: [PATCH] for 'can not be used when making a shared object;
recompile with -fPIC' error
View as plain text  
On Sat, Oct 15, 2011 at 6:13 PM, Warren Young <mysqlpp@stripped> wrote:
> On 10/14/2011 8:43 AM, Adrian Cornish wrote:
>>
>> -<cxxflags>@PTHREAD_CFLAGS@</cxxflags>
>> +<cxxflags>@PTHREAD_CFLAGS@ -fPIC</cxxflags>
>
> Doesn't that tie us to GCC?  Certainly that is by far the most common
> compiler for the autoconf case, but we've had reports on list in the past
> from AIX and Solaris native compiler users.
>
> You should turn this into an autoconf test.  See config/socket_nsl.m4. It
> shows how to conditionally figure out if certain compiler flags are needed.
>  Linker flags in that case, but the availability of -fPIC can be detected
> the same way.

I did some reading and it seems the best way to do this is with
libtool. Bakefile is supposed to set PIC flags when the target is a
DLL - which it is - so I am not sure why that is not working. The
variables are there in the Makefile.in

I modified configure.ac to use libtool - tested on Fedora 15 and it
works. It correctly adds -fPIC and -DPIC to compile lines

Also fixes a lot of autoconf warning by moving the bakefile.m4 file further down

The changes to bootstrap are to make sure autoconf links in copies of
all required files.


Adrian

Index: configure.ac
===================================================================
--- configure.ac        (revision 2698)
+++ configure.ac        (working copy)
@@ -18,6 +18,9 @@
 AC_CONFIG_HEADER(config.h)
 AC_CANONICAL_SYSTEM

+# Enable libtool to decide shared library compile flags (ie -fPIC)
+LT_INIT([disable-static])
+AC_SUBST([LIBTOOL_DEPS])

 # Break package version up into major, minor and bugfix components.
 MYSQLPP_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -f1 -d.`
@@ -27,11 +30,9 @@
 MYSQLPP_VERSION_BUGFIX=`echo $PACKAGE_VERSION | cut -f3 -d.`
 AC_SUBST(MYSQLPP_VERSION_BUGFIX)

+# Recommended by libtoolize
+AC_CONFIG_MACRO_DIR([m4])

-# Include Bakefile macros
-AC_BAKEFILE([m4_include(config/autoconf_inc.m4)])
-
-
 # Check for Standard C support
 AC_PROG_CC
 AC_HEADER_STDC
@@ -98,6 +99,8 @@
 AC_LANG_CPLUSPLUS
 STL_SLIST_EXTENSION

+# Include Bakefile macros
+AC_BAKEFILE([m4_include(config/autoconf_inc.m4)])

 #
 # Configure process complete; write out files generated from *.in.
Index: bootstrap
===================================================================
--- bootstrap   (revision 2698)
+++ bootstrap   (working copy)
@@ -80,9 +80,7 @@
        rm -f config.cache
        mv autoconf_inc.m4 config > /dev/null 2>&1      # don't care if it fails
        set -x &&
-               aclocal -I config -I $BAKEFILE_M4 &&
-               autoheader &&
-               autoconf &&
+               autoreconf --install -I config -I $BAKEFILE_M4 &&
                ./configure $MAINT_FLAGS $* &&
                make lib/querydef.h lib/ssqls.h &&
                set +x &&
Thread
[PATCH] for 'can not be used when making a shared object; recompilewith -fPIC' errorAdrian Cornish14 Oct
  • Re: [PATCH] for 'can not be used when making a shared object; recompilewith -fPIC' errorWarren Young16 Oct
    • Re: [PATCH] for 'can not be used when making a shared object;recompile with -fPIC' errorAdrian Cornish18 Oct
      • Re: [PATCH] for 'can not be used when making a shared object; recompile with -fPIC' errorWarren Young27 Oct