| Tim Windelschmidt | 5d357d8 | 2025-07-10 18:47:15 +0200 | [diff] [blame] | 1 | From 177b4720d6fbaa7fdd17e5e11b2c79ac8f246786 Mon Sep 17 00:00:00 2001 |
| 2 | From: "Wael M. Nasreddine" <wael.nasreddine@gmail.com> |
| 3 | Date: Thu, 27 Jun 2019 21:08:51 -0700 |
| 4 | Subject: [PATCH] Trim last argument to gcc if empty, on Darwin |
| 5 | |
| 6 | On Darwin, the last argument to GCC is coming up as an empty string. |
| 7 | This is breaking the build of proto_library targets. However, I was not |
| 8 | able to reproduce with the example cpp project[0]. |
| 9 | |
| 10 | This commit removes the last argument if it's an empty string. This is |
| 11 | not a problem on Linux. |
| 12 | |
| 13 | [0]: https://github.com/bazelbuild/examples/tree/master/cpp-tutorial/stage3 |
| 14 | --- |
| 15 | tools/cpp/osx_cc_wrapper.sh.tpl | 6 +++++- |
| 16 | 1 file changed, 5 insertions(+), 1 deletion(-) |
| 17 | |
| 18 | diff --git a/tools/cpp/osx_cc_wrapper.sh.tpl b/tools/cpp/osx_cc_wrapper.sh.tpl |
| 19 | index 4c85cd9b6b..6c611e3d25 100644 |
| 20 | --- a/tools/cpp/osx_cc_wrapper.sh.tpl |
| 21 | +++ b/tools/cpp/osx_cc_wrapper.sh.tpl |
| 22 | @@ -53,7 +53,11 @@ done |
| 23 | %{env} |
| 24 | |
| 25 | # Call the C++ compiler |
| 26 | -%{cc} "$@" |
| 27 | +if [[ ${*: -1} = "" ]]; then |
| 28 | + %{cc} "${@:0:$#}" |
| 29 | +else |
| 30 | + %{cc} "$@" |
| 31 | +fi |
| 32 | |
| 33 | function get_library_path() { |
| 34 | for libdir in ${LIB_DIRS}; do |
| 35 | -- |
| 36 | 2.19.2 |
| 37 | |