[patch] databases/db42 clang -fPIC issue

Takeshi Taguchi taguchi at ff.iij4u.or.jp
Thu Nov 15 12:23:16 UTC 2012


Hi,
In CURRENT, clang can not compile database/db42.
here is a error message:

BEGIN>---8<ERROR MESSAGE>8---
/usr/bin/ld: .libs/cxx_db.o: relocation R_X86_64_32S against `_ZTV2Db'
 can not be used when making a shared object; recompile with -fPIC
.libs/cxx_db.o: could not read symbols: Bad value
c++: error: linker command failed with exit code 1 (use -v to see
invocation)
*** [libdb_cxx-4.2.la] Error code 1

Stop in /usr/ports/databases/db42/work/db-4.2.52/build_unix.
*** [do-build] Error code 1

Stop in /usr/ports/databases/db42.
END>---8<ERROR MESSAGE>8---

linker said 'recompile with -fPIC'.
Actualy,
BEGIN>---8<COMPILE LOG>8---
 c++ -c -I. -I./../dist/.. -D_THREAD_SAFE -O2 -fno-strict-aliasing
-pipe -fconserve-space ./../dist/../cxx/cxx_txn.cpp  -DPIC
END>---8<COMPILE LOG>8---

there is a -DPIC flag, but not -fPIC.
Why not?

db42 uses its own libtool rather than FreeBSD's ${LOCALBASE}/bin
/libtool.

configure said:

BEGIN>---8<PART OF configure>8---
LIBTOOL= '$(SHELL) ./libtool'
END>---8<PART OF configure>8---

this libtool compiles c++ source without -fPIC flag if CC is clang.

libtool in ${LOCALBASE} was patched for FreeBSD. but db42
 libtool was NOT. so -fPIC flag was lost.

Here is a patch for fix this issue.

I'd send-pr this issue as ports/173627.
But
  http://www.freebsd.org/cgi/query-pr.cgi?pr=173627
said "No PRs Matched Query"
So I posted it here.
Would you like to review/commit this patch?

Thanks.



-------------- next part --------------
--- files/patch-dist::configure.orig	2012-11-13 06:09:38.000000000 +0900
+++ files/patch-dist::configure	2012-11-13 06:17:55.000000000 +0900
@@ -1,7 +1,16 @@
---- ../dist/configure.orig	Wed Dec  5 13:14:02 2001
-+++ ../dist/configure	Wed Dec  5 13:24:01 2001
-@@ -8794,10 +8794,10 @@
- INSTALLER="\$(LIBTOOL) --mode=install cp"
+--- ../dist/configure.orig	2012-11-13 06:08:49.000000000 +0900
++++ ../dist/configure	2012-11-13 06:16:09.000000000 +0900
+@@ -20046,7 +20046,7 @@
+ 
+ 
+ SOFLAGS="-rpath \$(libdir)"
+-LIBTOOL_PROG="${SHELL} ./libtool"
++LIBTOOL_PROG="$prefix/bin/libtool"
+ 
+ # Set SOSUFFIX and friends
+ 
+@@ -20138,13 +20138,13 @@
+ INSTALLER="\$(LIBTOOL) --mode=install cp -p"
  
  MAKEFILE_CC="\$(LIBTOOL) --mode=compile ${MAKEFILE_CC}"
 -MAKEFILE_SOLINK="\$(LIBTOOL) --mode=link ${MAKEFILE_CCLINK} -avoid-version"
@@ -12,4 +21,8 @@
 +MAKEFILE_XSOLINK="\$(LIBTOOL) --mode=link ${MAKEFILE_CXXLINK} -version-info ${DB_VERSION_MINOR}"
  MAKEFILE_CXXLINK="\$(LIBTOOL) --mode=link ${MAKEFILE_CXXLINK}"
  
- # Configure for shared libraries, static libraries, or both.  If both are
+-LIBTOOL="\$(SHELL) ./libtool"
++LIBTOOL="$prefix/bin/libtool"
+ 
+ case "$host_os" in
+ cygwin*)


More information about the freebsd-ports mailing list