bug-libtool
[Top][All Lists]
Advanced

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

Re: Libtool generating flags incompatible with nvcc


From: Ralf Wildenhues
Subject: Re: Libtool generating flags incompatible with nvcc
Date: Sat, 12 Sep 2009 09:17:15 +0200
User-agent: Mutt/1.5.20 (2009-08-09)

Hello Mahesh,

* Mahesh N wrote on Fri, Sep 04, 2009 at 08:19:55AM CEST:
> As we have discussed earlier about generating appropriate flags for nvcc
> during the linking stage, patching libtool script files, etc - I read in
> nvidia forums that gcc or g++ can be used during the linking stage. Is there
> any Macro which I can set in configure.ac in order to direct the Makefiles
> and libtool to use a particular linker - gcc here instead of nvcc?

Can you try the patch below (against current git Libtool or a nightly
snapshot)?  OK to add your address to THANKS (and can we get a full name)?

Others, any issues with this patch?

> (i.e.) just as in AC_PROG_CC, I can list the preferences for compilers to
> use eg: AC_PROG_CC([gcc mingw nvcc]) can I specify linker options somewhere?
> If such a support is added to Autotools it would be great as I have seen two
> other threads where people are facing similar issues.

BTW, you might need to pass --enable-dependency-tracking to configure if
you want it to work with nvcc.

Thanks,
Ralf

   Initial support for the Cuda Compiler Driver on Linux.

   * libltdl/config/ltmain.m4sh (func_mode_compile): Accept source
   file extensions `.cu' and `.cup'.
   * libltdl/m4/libtool.m4 (_LT_COMPILER_NO_RTTI, _LT_COMPILER_PIC)
   (_LT_LINKER_SHLIBS): Support for `nvcc' compiler driver.
   * THANKS: Update.
   Report by Mahesh N.

diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 4633ff2..eb37e18 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -783,7 +783,7 @@ func_mode_compile ()
     *.[cCFSifmso] | \
     *.ada | *.adb | *.ads | *.asm | \
     *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
-    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
+    *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
       func_xform "$libobj"
       libobj=$func_xform_result
       ;;
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index bebce6b..c3e3c03 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -3287,7 +3287,12 @@ m4_defun([_LT_COMPILER_NO_RTTI],
 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
 
 if test "$GCC" = yes; then
-  _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+  case $cc_basename in
+  nvcc*)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler 
-fno-builtin' ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+  esac
 
   _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
     lt_cv_prog_compiler_rtti_exceptions,
@@ -3939,6 +3944,13 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
       ;;
     esac
+
+    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'
+      ;;
+    esac
   else
     # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
@@ -4424,6 +4436,10 @@ _LT_EOF
        xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal 
with xlf below)
          tmp_sharedflag='-qmkshrobj'
          tmp_addflag= ;;
+       nvcc*)  # Cuda Compiler Driver 2.2
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for 
conv in $convenience\"\"; do test  -n \"$conv\" && 
new_convenience=\"$new_convenience,$conv\"; done; func_echo_all 
\"$new_convenience\"` ${wl}--no-whole-archive'
+         _LT_TAGVAR(compiler_needs_object, $1)=yes
+         ;;
        esac
        case `$CC -V 2>&1 | sed 5q` in
        *Sun\ C*)                       # Sun C 5.9




reply via email to

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