Skip to content

Commit

Permalink
ok, now it works on linux again too
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed Jun 2, 2018
1 parent 35bacb5 commit 2fdc906
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
20 changes: 18 additions & 2 deletions src/python/pants/backend/native/subsystems/native_toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,15 @@ def select_c_compiler(platform, native_toolchain):
if platform.normalized_os_name == 'darwin':
c_compiler = yield Get(CCompiler, XCodeCLITools, native_toolchain._xcode_cli_tools)
else:
c_compiler = yield Get(CCompiler, LLVM, native_toolchain._llvm)
# FIXME: gcc needs binutils so it can have 'as'. this should probably be a subsystem dependency
# in gcc on binutils.
c_compiler_no_tools = yield Get(CCompiler, GCC, native_toolchain._gcc)
binutils_linker = yield Get(Linker, Binutils, native_toolchain._binutils)
all_path_entries = c_compiler_no_tools.path_entries + native_toolchain._binutils.path_entries()
c_compiler = CCompiler(
path_entries=all_path_entries,
exe_filename=c_compiler_no_tools.exe_filename,
platform=platform)
yield c_compiler


Expand All @@ -101,7 +109,15 @@ def select_cpp_compiler(platform, native_toolchain):
if platform.normalized_os_name == 'darwin':
cpp_compiler = yield Get(CppCompiler, XCodeCLITools, native_toolchain._xcode_cli_tools)
else:
cpp_compiler = yield Get(CppCompiler, LLVM, native_toolchain._llvm)
# FIXME: gcc needs binutils so it can have 'as'. this should probably be a subsystem dependency
# in gcc on binutils.
cpp_compiler_no_tools = yield Get(CppCompiler, GCC, native_toolchain._gcc)
binutils_linker = yield Get(Linker, Binutils, native_toolchain._binutils)
all_path_entries = cpp_compiler_no_tools.path_entries + native_toolchain._binutils.path_entries()
cpp_compiler = CppCompiler(
path_entries=all_path_entries,
exe_filename=cpp_compiler_no_tools.exe_filename,
platform=platform)
yield cpp_compiler


Expand Down
3 changes: 2 additions & 1 deletion src/python/pants/backend/native/tasks/c_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def _execute_compile_request(self, compile_request):
c_compiler = compile_request.c_compiler
err_flags = ['-Werror'] if compile_request.fatal_warnings else []
# We are executing in the results_dir, so get absolute paths for everything.
cmd = [c_compiler.exe_filename] + err_flags + ['-c'] + [
# TODO: -fPIC all the time???
cmd = [c_compiler.exe_filename] + err_flags + ['-c', '-fPIC'] + [
'-I{}'.format(os.path.abspath(inc_dir)) for inc_dir in compile_request.include_dirs
] + [os.path.abspath(src) for src in sources]

Expand Down
3 changes: 2 additions & 1 deletion src/python/pants/backend/native/tasks/cpp_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def _execute_compile_request(self, compile_request):
cpp_compiler = compile_request.cpp_compiler
err_flags = ['-Werror'] if compile_request.fatal_warnings else []
# We are executing in the results_dir, so get absolute paths for everything.
cmd = [cpp_compiler.exe_filename] + err_flags + ['-c'] + [
# TODO: -fPIC all the time???
cmd = [cpp_compiler.exe_filename] + err_flags + ['-c', '-fPIC'] + [
'-I{}'.format(os.path.abspath(inc_dir)) for inc_dir in compile_request.include_dirs
] + [os.path.abspath(src) for src in sources]

Expand Down

0 comments on commit 2fdc906

Please sign in to comment.