Skip to content

Commit

Permalink
remove link_prefix from linker arguments (pytorch#395)
Browse files Browse the repository at this point in the history
  • Loading branch information
soumith authored Jan 2, 2017
1 parent a0c614e commit 6a2785a
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,19 @@ def run(self):
extra_link_args.append('-L' + lib_path)

# we specify exact lib names to avoid conflict with lua-torch installs
link_prefix='-l:'
TH_LIB = os.path.join(lib_path, 'libTH.so.1')
THC_LIB = os.path.join(lib_path, 'libTHC.so.1')
THNN_LIB = os.path.join(lib_path, 'libTHNN.so.1')
THCUNN_LIB = os.path.join(lib_path, 'libTHCUNN.so.1')
if platform.system() == 'Darwin':
link_prefix=''
TH_LIB = os.path.join(lib_path, 'libTH.1.dylib')
THC_LIB = os.path.join(lib_path, 'libTHC.1.dylib')
THNN_LIB = os.path.join(lib_path, 'libTHNN.1.dylib')
THCUNN_LIB = os.path.join(lib_path, 'libTHCUNN.1.dylib')

main_compile_args = ['-D_THP_CORE']
main_libraries = ['shm']
main_link_args = [link_prefix + TH_LIB]
main_link_args = [TH_LIB]
main_sources = [
"torch/csrc/Module.cpp",
"torch/csrc/Generator.cpp",
Expand Down Expand Up @@ -222,7 +220,7 @@ def run(self):
extra_link_args.append('-Wl,-rpath,' + cuda_lib_path)
extra_compile_args += ['-DWITH_CUDA']
extra_compile_args += ['-DCUDA_LIB_PATH=' + cuda_lib_path]
main_link_args += [link_prefix + THC_LIB]
main_link_args += [THC_LIB]
main_sources += [
"torch/csrc/cuda/Module.cpp",
"torch/csrc/cuda/Storage.cpp",
Expand Down Expand Up @@ -287,8 +285,8 @@ def make_relative_rpath(path):
extra_compile_args=extra_compile_args,
include_dirs=include_dirs,
extra_link_args=extra_link_args + [
link_prefix + TH_LIB,
link_prefix + THNN_LIB,
TH_LIB,
THNN_LIB,
make_relative_rpath('../lib'),
]
)
Expand All @@ -301,9 +299,9 @@ def make_relative_rpath(path):
extra_compile_args=extra_compile_args,
include_dirs=include_dirs,
extra_link_args=extra_link_args + [
link_prefix + TH_LIB,
link_prefix + THC_LIB,
link_prefix + THCUNN_LIB,
TH_LIB,
THC_LIB,
THCUNN_LIB,
make_relative_rpath('../lib'),
]
)
Expand Down

0 comments on commit 6a2785a

Please sign in to comment.