Fixes for --out-path and --no-sysroot This is a followup to [1]. Adds the build dir to the include path so the compiler can find last_commit_position.h when the build dir is not "out". Adds the necessary libs back on Linux when using --no-sysroot. [1] https://gn.googlesource.com/gn/+/0e4f3935ee53741240a69b877a6a9aed78f62950 BUG=chromium:863460 R=brettw Change-Id: Id76e88245d7b0a2489205700964d657e63acb59e Reviewed-on: https://gn-review.googlesource.com/2180 Reviewed-by: Brett Wilson <brettw@chromium.org> Commit-Queue: Brett Wilson <brettw@chromium.org>
diff --git a/build/gen.py b/build/gen.py index fd0fa48..9dda914 100755 --- a/build/gen.py +++ b/build/gen.py
@@ -249,7 +249,7 @@ cflags_cc = os.environ.get('CXXFLAGS', '').split() ldflags = os.environ.get('LDFLAGS', '').split() libflags = os.environ.get('LIBFLAGS', '').split() - include_dirs = [REPO_ROOT] + include_dirs = [REPO_ROOT, os.path.dirname(path)] libs = [] if is_posix: @@ -269,16 +269,16 @@ ]) cflags_cc.extend(['-std=c++14', '-Wno-c++11-narrowing']) - if linux_sysroot: - # Use the sid sysroot that UpdateLinuxSysroot() downloads. We need to - # force the used of libstdc++ for now because libc++ is not in that - # sysroot and we don't currently have a local build of that. We should - # probably resolve this and (re-)add a way to build against libc++. - cflags.extend(['--sysroot=' + linux_sysroot, - '-stdlib=libstdc++', - ]) - ldflags.extend(['--sysroot=' + linux_sysroot, - '-static-libstdc++', + if is_linux: + if linux_sysroot: + # Use the sid sysroot that UpdateLinuxSysroot() downloads. We need to + # force the used of libstdc++ for now because libc++ is not in that + # sysroot and we don't currently have a local build of that. We should + # probably resolve this and (re-)add a way to build against libc++. + cflags.append('--sysroot=' + linux_sysroot) + ldflags.append('--sysroot=' + linux_sysroot) + cflags.append('-stdlib=libstdc++') + ldflags.extend(['-static-libstdc++', '-stdlib=libstdc++', '-Wl,--as-needed', ])
diff --git a/tools/gn/gn_main.cc b/tools/gn/gn_main.cc index b18c211..a61a752 100644 --- a/tools/gn/gn_main.cc +++ b/tools/gn/gn_main.cc
@@ -16,7 +16,7 @@ #include "util/msg_loop.h" #include "util/sys_info.h" -#include "out/last_commit_position.h" +#include "last_commit_position.h" namespace {