Le 07/01/2013 13:00, Kalle Raiskila a écrit :
> I partially reverted this in 511, as it broke the build on all my 
> machines (most of which are debian, btw ;) ), as libLLVM.so "is not found".
> 
> What was the original issue with having these flags in in the first place?
> 
> For me, 'llvm-config --ldflags' prints out:
>   '-L/opt/llvm/3.1/lib  -lpthread -ldl -lm'
> 
> I.e. the flags to pass to the linker. Why it also links in math, 
> pthreads and dl - I don't know.

As said, "llvm-config --ldflags" are flags required to build llvm,
not the flags required to link against llvm.
pthread, dl and math are probably libraries required by llvm itself.

However, both llvmopencl and pocl-llvm-ld were using symbols from
libLLVM. It was working because libLLVM was linked indirectly but
it is more correct to link it directly.
  So, I added -llibLLVM but I do not add a -L because, on Debian,
with llvm packages, llvm shared libraries are in standard paths.

  Can you try this updated version of my patch that also add
-L paths ?
  If it still fails, can you send me the exact error message
and command line ?

  Regards,
    Vincent

> kalle
Description: remove most of superflous linkage
 Several binaries and libraries are linked with uneeded libraries. This patch
 remove most of them.
Author: Vincent Danjean <[email protected]>
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/lib/poclu/Makefile.am
+++ b/lib/poclu/Makefile.am
@@ -29,3 +29,4 @@
 
 libpoclu_la_CPPFLAGS = -I$(top_srcdir)/fix-include -I$(top_srcdir)/include 
 libpoclu_la_LDFLAGS = --version-info ${LIB_VERSION}
+libpoclu_la_LIBADD = ../CL/libpocl.la
--- a/lib/llvmopencl/Makefile.am
+++ b/lib/llvmopencl/Makefile.am
@@ -25,7 +25,9 @@
 pkglib_LTLIBRARIES = llvmopencl.la
 
 AM_CXXFLAGS = -I@top_srcdir@/fix-include -I@top_srcdir@/include `@LLVM_CONFIG@ --cxxflags`
-AM_LDFLAGS = -module -export-dynamic -version-info ${KERNEL_COMPILER_LIB_VERSION} `@LLVM_CONFIG@ --ldflags` 
+AM_LDFLAGS = -module -export-dynamic -version-info ${KERNEL_COMPILER_LIB_VERSION}
+AM_LDFLAGS += -L${LLVM_LIBDIR}
+llvmopencl_la_LIBADD = -lLLVM-${LLVM_VERSION}
 
 llvmopencl_la_SOURCES = Barrier.h						\
                         BarrierBlock.h BarrierBlock.cc				\
@@ -45,4 +47,4 @@
 						BreakConstantGEPs.h BreakConstantGEPs.cpp \
 						WorkitemHandlerChooser.h WorkitemHandlerChooser.cc
 
-#llvmopencl_la_LIBADD = @LIBS_LLVMTRANSFORMUTILS@
+#llvmopencl_la_LIBADD += @LIBS_LLVMTRANSFORMUTILS@
--- a/tools/llvm-ld/Makefile.am
+++ b/tools/llvm-ld/Makefile.am
@@ -1,6 +1,7 @@
 bin_PROGRAMS = pocl-llvm-ld
 pocl_llvm_ld_SOURCES = llvm-ld.cpp Optimize.cpp
-pocl_llvm_ld_LDFLAGS = `@LLVM_CONFIG@ --ldflags` -lLLVM-`@LLVM_CONFIG@ --version`
+pocl_llvm_ld_LDFLAGS = -L${LLVM_LIBDIR}
+pocl_llvm_ld_LDADD = -lLLVM-${LLVM_VERSION}
 pocl_llvm_ld_CXXFLAGS = `@LLVM_CONFIG@ --cxxflags`
 
 
--- a/configure.ac
+++ b/configure.ac
@@ -79,6 +79,7 @@
 LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
 
 AC_SUBST([LLVM_VERSION], [$LLVM_VERSION])
+AC_SUBST([LLVM_LIBDIR], [$LLVM_LIBDIR])
 
 AM_CONDITIONAL([LLVM_3_1], test "$LLVM_VERSION" == "3.1")
 
@@ -460,9 +461,14 @@
 AM_CONDITIONAL([TCE_AVAILABLE], test ! -z $TCE_AVAILABLE)
 
 # libtool dynamic library handling library
+old_LIBS="$LIBS"
+LIBS=
 AC_SEARCH_LIBS([lt_dlsym], [ltdl], [], [
 AC_MSG_ERROR([unable to find the libtool dl library (usually libltdl-dev)])
 ])
+LTDL_LIBS="$LIBS"
+AC_SUBST([LTDL_LIBS])
+LIBS="$old_LIBS"
 
 # Following checks are related to the build system for devices (clang and so),
 # and not for building the host code.
--- a/lib/CL/Makefile.am
+++ b/lib/CL/Makefile.am
@@ -135,7 +135,8 @@
 libpocl_la_LDFLAGS += -lstdc++ `@TCE_CONFIG@ --libs`
 endif
 
-libpocl_la_LIBADD = devices/libpocl-devices.la 
+libpocl_la_LIBADD = devices/libpocl-devices.la
+libpocl_la_LIBADD += ${LTDL_LIBS}
 
 if BUILD_SPU
 libpocl_la_LIBADD += -lspe2
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
pocl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pocl-devel

Reply via email to