From c7c2b6bd3f22f19e3fed959381f97ec3bc652bc6 Mon Sep 17 00:00:00 2001 From: Francesco Lannutti Date: Thu, 1 May 2014 21:07:02 +0200 Subject: [PATCH] Fixed a bug in libtool_wrapper_for_cuda.tcl to handle correct compilation of -fPIC objects --- src/libtool_wrapper_for_cuda.tcl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libtool_wrapper_for_cuda.tcl b/src/libtool_wrapper_for_cuda.tcl index 31f0c3886..1e4447d3f 100755 --- a/src/libtool_wrapper_for_cuda.tcl +++ b/src/libtool_wrapper_for_cuda.tcl @@ -1,7 +1,7 @@ #!/usr/bin/tclsh if {$argc == 0} { - puts "Usage: 'libtool_wrapper_for_cuda.tcl' 'filename' 'compilation line'" + puts "Usage: 'libtool_wrapper_for_cuda.tcl' 'filename' '-static | -shared' 'compilation line'" exit 1 } @@ -15,14 +15,15 @@ if {[lindex $argv 1] == "-static"} { set command [lrange $argv 2 end] append command " -o $filename" } else { - file mkdir .libs - set filename ".libs/${filename_o}" + file mkdir [file dirname $filename_o]/.libs + set filename "[file dirname $filename_o]/.libs/[file tail $filename_o]" set command [lrange $argv 2 end] append command " -Xcompiler -fPIC" append command " -o $filename" } # Compile +#puts "Executing: $command" exec /bin/sh -c $command # Determine the libtool version (including compiler version) @@ -36,7 +37,7 @@ foreach elem $output { # Generate the .lo libtool object file set fid [open $filename_lo w] -puts $fid "# $filename_lo - a libtool object file" +puts $fid "# [file tail $filename_lo] - a libtool object file" puts $fid "# Generated by libtool $version" puts $fid "#" puts $fid "# Please DO NOT delete this file!" @@ -50,7 +51,7 @@ if {[lindex $argv 1] == "-static"} { puts $fid "non_pic_object='[file tail $filename]'" } else { puts $fid "# Name of the PIC object." - puts $fid "pic_object='[file tail $filename]'" + puts $fid "pic_object='.libs/[file tail $filename]'" puts $fid "" puts $fid "# Name of the non-PIC object" puts $fid "non_pic_object=none"