Hello Paweł, * Paweł Daniluk wrote on Sun, Dec 05, 2010 at 11:16:37PM CET: > I am trying to run nvcc compiler driver through libtool, and I keep > getting errors about compiler flags which are not supported by nvcc: > > pa...@solea:~/sandbox/libdesc/libdesc/trunk$ /opt/local/bin/glibtool > --mode=compile --tag=CC nvcc -c -m64 -arch=sm_11 -g -DTIMER > -Xcompiler -fno-common -I/usr/local/cuda/include/ -o > cliques_cuda_int.lo cliques_cuda_int.cu > glibtool: compile: nvcc -c -m64 -arch=sm_11 -g -fno-common -DTIMER > -I/usr/local/cuda/include/ cliques_cuda_int.cu -fno-common -DPIC -o > .libs/cliques_cuda_int.o > nvcc fatal : Unknown option 'fno-common' > > This is understandable because -fno-common should be prepended with > -Xcompiler in nvcc call. One would expect that libtool should do it > automagically, since it has some kind of CUDA support built in. > > What am I doing wrong? Is there any method to override regular > libtool behavior to put -Xcompiler before flags it adds? > > I'm using libtool 2.4 from MacPorts on Mac OS 10.6.5.
Does this patch fix things for you? As far as I see, you should be getting -fPIC passed instead of -fno-common, so it's not completely clear that this is right, or what other changes MacPorts has done to their glibtool code over upstream Libtool. Please also send 'glibtool --config' output. OK to apply? OK to add you to THANKS, Paweł? Thanks, Ralf Fix nvcc PIC setting on darwin. * libltdl/m4/libtool.m4 (_LT_COMPILER_PIC) <lt_prog_compiler_pic>: Prepend -Xcompiler to nonempty variable setting rather than hard-coding -Xcompiler -fPIC, for darwin. * NEWS, THANKS: Update. Report by Paweł Daniluk. diff --git a/NEWS b/NEWS index 1679c58..d8fc3ea 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,7 @@ New in 2.4.2 2010-12-??: git version 2.4.1a, Libtool team: not available) works again. Regression introduced in v2.2.6-39-g9c3d4d8. - The bug that leaked developer tool paths into the release tarballs from ./bootstrap is fixed. + - Improved support for the Cuda Compiler Driver (nvcc) on Darwin. * Important incompatible changes: diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index 99d66bb..5f18dcb 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -4240,7 +4240,9 @@ m4_if([$1], [CXX], [ case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi ;; esac else