Hi Ralf,
On 12/6/10 4:34 AM, Ralf Wildenhues wrote:
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 for your prompt reply. Unfortunately the patch doesn't seem to
change anything. Perhaps I'm doing something completely wrong. I expect
that libtool after invoking in compile mode with nvcc instead of gcc
should add -Xcompiler where needed, but I get:
pa...@solea:~/sandbox/libdesc/libdesc/trunk$ /opt/local/bin/glibtool -n
--mode=compile --tag=CC nvcc foo.cu -o foo.lo
glibtool: compile: nvcc foo.cu -fno-common -DPIC -o .libs/foo.o
glibtool: compile: nvcc foo.cu -o foo.o >/dev/null 2>&1
I also get the same behavior on Linux, but in this case I didn't install
libtool-2.4, just downloaded and compiled in temp directory.
pa...@ubuntu:~/tmp/libtool-2.4$ ./libtool -n --mode=compile --tag=CC
nvcc foo.cu -o foo.lo
libtool: compile: nvcc foo.cu -fPIC -DPIC -o .libs/foo.o
libtool: compile: nvcc foo.cu -o foo.o >/dev/null 2>&1
I have always treated libtool as a black box which just works, and know
very little about its internals. Nevertheless libtool doesn't seem to
depend on any external files, and contains no "nvcc" string. Maybe I
miss something during the compilation phase.
Below you will find output of libtool -config.
Thanks,
Paweł
pa...@solea:~/sandbox/libdesc/libdesc/trunk$ /opt/local/bin/glibtool
--config
# Which release of libtool.m4 was used?
macro_version=2.4
macro_revision=1.3293
# Assembler program.
AS="as"
# DLL creation program.
DLLTOOL="false"
# Object dumper program.
OBJDUMP="false"
# Whether or not to build shared libraries.
build_libtool_libs=yes
# Whether or not to build static libraries.
build_old_libs=yes
# What type of objects to build.
pic_mode=default
# Whether or not to optimize for fast installation.
fast_install=needless
# Shell to use when invoking shell scripts.
SHELL="/bin/sh"
# An echo program that protects backslashes.
ECHO="printf %s\\n"
# The host system.
host_alias=
host=x86_64-apple-darwin10.5.0
host_os=darwin10.5.0
# The build system.
build_alias=
build=x86_64-apple-darwin10.5.0
build_os=darwin10.5.0
# A sed program that does not truncate output.
SED="/usr/bin/sed"
# Sed that helps us avoid accidentally triggering echo(1) options like -n.
Xsed="$SED -e 1s/^X//"
# A grep program that handles long lines.
GREP="/usr/bin/grep"
# An ERE matcher.
EGREP="/usr/bin/grep -E"
# A literal string matcher.
FGREP="/usr/bin/grep -F"
# A BSD- or MS-compatible name lister.
NM="/usr/bin/nm"
# Whether we need soft or hard links.
LN_S="ln -s"
# What is the maximum length of a command?
max_cmd_len=196608
# Object file suffix (normally "o").
objext=o
# Executable file suffix (normally "").
exeext=
# whether the shell understands "unset".
lt_unset=unset
# turn spaces into newlines.
SP2NL="tr \\040 \\012"
# turn newlines into spaces.
NL2SP="tr \\015\\012 \\040\\040"
# convert $build file names to $host format.
to_host_file_cmd=func_convert_file_noop
# convert $build files to toolchain format.
to_tool_file_cmd=func_convert_file_noop
# Method to check whether dependent libraries are shared objects.
deplibs_check_method="pass_all"
# Command to use when deplibs_check_method = "file_magic".
file_magic_cmd="\$MAGIC_CMD"
# How to find potential files when deplibs_check_method = "file_magic".
file_magic_glob=""
# Find potential files using nocaseglob when deplibs_check_method =
"file_magic".
want_nocaseglob="no"
# Command to associate shared and link libraries.
sharedlib_from_linklib_cmd="printf %s\\n"
# The archiver.
AR="ar"
# Flags to create an archive.
AR_FLAGS="cru"
# How to feed a file listing to the archiver.
archiver_list_spec=""
# A symbol stripping program.
STRIP="strip"
# Commands used to install an old-style archive.
RANLIB="ranlib"
old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
old_postuninstall_cmds=""
# Whether to use a lock for old archive extraction.
lock_old_archive_extraction=yes
# A C compiler.
LTCC="/usr/bin/gcc-4.2"
# LTCC compiler flags.
LTCFLAGS="-O2 -arch x86_64"
# Take the output of nm and produce a listing of raw symbols and C names.
global_symbol_pipe="sed -n -e 's/^.*[ ]\\([BCDEGRST][BCDEGRST]*\\)[
][ ]*_\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 _\\2 \\2/p' | sed '/
__gnu_lto/d'"
# Transform the output of nm in a proper C declaration.
global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int
\\1();/p' -e 's/^[BCDEGRST]* .* \\(.*\\)\$/extern char \\1;/p'"
# Transform the output of nm in a C name address pair.
global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/
{\\\"\\1\\\", (void *) 0},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\([^
]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
# Transform the output of nm in a C name address pair when lib prefix is
needed.
global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\)[
]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\)
\\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[BCDEGRST]*
\\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'"
# Specify filename containing input files for $NM.
nm_file_list_spec=""
# The root where to search for dependent libraries,and in which our
libraries should be installed.
lt_sysroot=
# The name of the directory that contains temporary libtool files.
objdir=.libs
# Used to examine libraries when file_magic_cmd begins with "file".
MAGIC_CMD=file
# Must we lock files when doing compilation?
need_locks="no"
# Manifest tool.
MANIFEST_TOOL=":"
# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
DSYMUTIL="dsymutil"
# Tool to change global to local symbols on Mac OS X.
NMEDIT="nmedit"
# Tool to manipulate fat objects and archives on Mac OS X.
LIPO="lipo"
# ldd/readelf like tool for Mach-O binaries on Mac OS X.
OTOOL="otool"
# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
OTOOL64=":"
# Old archive suffix (normally "a").
libext=a
# Shared library suffix (normally ".so").
shrext_cmds="\`test .\$module = .yes && echo .so || echo .dylib\`"
# The commands to extract the exported symbol list from a shared archive.
extract_expsyms_cmds=""
# Variables whose values should be saved in libtool wrapper scripts and
# restored at link time.
variables_saved_for_relink="PATH DYLD_LIBRARY_PATH GCC_EXEC_PREFIX
COMPILER_PATH LIBRARY_PATH"
# Do we need the "lib" prefix for modules?
need_lib_prefix=no
# Do we need a version for libraries?
need_version=no
# Library versioning type.
version_type=darwin
# Shared library runtime path variable.
runpath_var=
# Shared library path variable.
shlibpath_var=DYLD_LIBRARY_PATH
# Is shlibpath searched before the hard-coded library search path?
shlibpath_overrides_runpath=yes
# Format of library name prefix.
libname_spec="lib\$name"
# List of archive names. First name is the real one, the rest are links.
# The last name is the one that the linker finds with -lNAME
library_names_spec="\${libname}\${release}\${major}\$shared_ext
\${libname}\$shared_ext"
# The coded name of the library, if different from the real name.
soname_spec="\${libname}\${release}\${major}\$shared_ext"
# Permission mode override for installation of shared libraries.
install_override_mode=""
# Command to use after installation of a shared archive.
postinstall_cmds=""
# Command to use after uninstallation of a shared archive.
postuninstall_cmds=""
# Commands used to finish a libtool library installation in a directory.
finish_cmds=""
# As "finish_cmds", except a single script fragment to be evaled but
# not shown.
finish_eval=""
# Whether we should hardcode library paths into libraries.
hardcode_into_libs=no
# Compile-time system search path for libraries.
sys_lib_search_path_spec="/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64
/usr/lib/i686-apple-darwin10/4.2.1 /usr/lib /opt/local/lib /usr/local/lib"
# Run-time system search path for libraries.
sys_lib_dlsearch_path_spec="/usr/local/lib /lib /usr/lib"
# Whether dlopen is supported.
dlopen_support=yes
# Whether dlopen of programs is supported.
dlopen_self=yes
# Whether dlopen of statically linked programs is supported.
dlopen_self_static=yes
# Commands to strip libraries.
old_striplib="strip -S"
striplib="strip -x"
# The linker used to build libraries.
LD="/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld"
# How to create reloadable object files.
reload_flag=" -r"
reload_cmds="\$LTCC \$LTCFLAGS -nostdlib \${wl}-r -o \$output\$reload_objs"
# Commands used to build an old-style archive.
old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
# A language specific compiler.
CC="/usr/bin/gcc-4.2"
# Is the compiler the GNU compiler?
with_gcc=yes
# Compiler flag to turn off builtin functions.
no_builtin_flag=" -fno-builtin"
# Additional compiler flags for building library objects.
pic_flag=" -fno-common -DPIC"
# How to pass a linker flag through the compiler.
wl="-Wl,"
# Compiler flag to prevent dynamic linking.
link_static_flag=""
# Does compiler simultaneously support -c and -o options?
compiler_c_o="yes"
# Whether or not to add -lc for building shared libraries.
build_libtool_need_lc=no
# Whether or not to disallow shared libs when runtime libs are static.
allow_libtool_libs_with_static_runtimes=no
# Compiler flag to allow reflexive dlopens.
export_dynamic_flag_spec=""
# Compiler flag to generate shared objects directly from archives.
whole_archive_flag_spec="\`for conv in \$convenience\\\"\\\"; do test
-n \\\"\$conv\\\" && new_convenience=\\\"\$new_convenience
\${wl}-force_load,\$conv\\\"; done; func_echo_all
\\\"\$new_convenience\\\"\`"
# Whether the compiler copes with passing no objects directly.
compiler_needs_object="no"
# Create an old-style archive from a shared archive.
old_archive_from_new_cmds=""
# Create a temporary old-style archive to link instead of a shared archive.
old_archive_from_expsyms_cmds=""
# Commands used to build a shared archive.
archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs
\$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring
\$single_module"
archive_expsym_cmds="sed 's,^,_,' < \$export_symbols >
\$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib
\$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags
-install_name \$rpath/\$soname \$verstring \$single_module
\${wl}-exported_symbols_list,\$output_objdir/\${libname}-symbols.expsym"
# Commands used to build a loadable module if different from building
# a shared archive.
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs
\$deplibs \$compiler_flags"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols >
\$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag
-o \$lib -bundle \$libobjs \$deplibs \$compiler_flags
\${wl}-exported_symbols_list,\$output_objdir/\${libname}-symbols.expsym"
# Whether we are building with GNU ld or not.
with_gnu_ld="no"
# Flag that allows shared libraries with undefined symbols to be built.
allow_undefined_flag="\${wl}-undefined \${wl}dynamic_lookup"
# Flag that enforces no undefined symbols.
no_undefined_flag=""
# Flag to hardcode $libdir into a binary during linking.
# This must work even if $libdir does not exist
hardcode_libdir_flag_spec=""
# If ld is used when linking, flag to hardcode $libdir into a binary
# during linking. This must work even if $libdir does not exist.
hardcode_libdir_flag_spec_ld=""
# Whether we need a single "-rpath" flag with a separated argument.
hardcode_libdir_separator=""
# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
# DIR into the resulting binary.
hardcode_direct=no
# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
# DIR into the resulting binary and the resulting library dependency is
# "absolute",i.e impossible to change by setting ${shlibpath_var} if the
# library is relocated.
hardcode_direct_absolute=no
# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
# into the resulting binary.
hardcode_minus_L=no
# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
# into the resulting binary.
hardcode_shlibpath_var=unsupported
# Set to "yes" if building a shared library automatically hardcodes DIR
# into the library and all subsequent libraries and executables linked
# against it.
hardcode_automatic=yes
# Set to yes if linker adds runtime paths of dependent libraries
# to runtime path list.
inherit_rpath=no
# Whether libtool must link a program against all its dependency libraries.
link_all_deplibs=yes
# Set to "yes" if exported symbols are required.
always_export_symbols=no
# The commands to list exported symbols.
export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe
| \$SED 's/.* //' | sort | uniq > \$export_symbols"
# Symbols that should not be listed in the preloaded symbols.
exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
# Symbols that must always be exported.
include_expsyms=""
# Commands necessary for linking programs (against libraries) with
templates.
prelink_cmds=""
# Commands necessary for finishing linking programs.
postlink_cmds=""
# Specify filename containing input files.
file_list_spec=""
# How to hardcode a shared library path into an executable.
hardcode_action=immediate
# The directories searched by this compiler when creating a shared library.
compiler_lib_search_dirs=""
# Dependencies to place before and after the objects being linked to
# create a shared library.
predep_objects=""
postdep_objects=""
predeps=""
postdeps=""
# The library search path used internally by the compiler when linking
# a shared library.
compiler_lib_search_path=""
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
_______________________________________________
http://lists.gnu.org/mailman/listinfo/libtool