Skip to content

Commit 0316583

Browse files
authored
Merge pull request #205 from firebase/feature/fix-corrupt-mac-libs
Use an older version of binutils on Mac
2 parents 4f8baa9 + b6280ee commit 0316583

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

.github/workflows/cpp-packaging.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ on:
2121

2222
env:
2323
# Packaging prerequisites
24-
# Binutils 2.35.1 released Sep 19, 2020
25-
binutilsVer: "2.35.1"
2624
# Demumble 1.1.0 released Nov 13, 2018
2725
demumbleVer: "1.1.0"
2826
# Use SHA256 for hashing files.
@@ -67,8 +65,12 @@ jobs:
6765
include:
6866
- os: ubuntu-latest
6967
tools_platform: linux
68+
# Binutils 2.35.1 released Sep 19, 2020
69+
binutils_version: "2.35.1"
7070
- os: macos-latest
7171
tools_platform: darwin
72+
# On Mac, use an older Binutils to avoid corrupted libraries.
73+
binutils_version: "2.28.1"
7274
steps:
7375
- name: setup Xcode version (macos)
7476
if: runner.os == 'macOS'
@@ -81,13 +83,13 @@ jobs:
8183
# Github runners.
8284
for retry in {1..10} error; do
8385
if [[ $retry == "error" ]]; then exit 5; fi
84-
curl -L https://ftpmirror.gnu.org/binutils/binutils-${{ env.binutilsVer }}.tar.xz --output binutils.tar.xz && break
86+
curl -L https://ftpmirror.gnu.org/binutils/binutils-${{ matrix.binutils_version }}.tar.xz --output binutils.tar.xz && break
8587
sleep 300
8688
done
8789
set -e
8890
8991
tar -xf binutils.tar.xz
90-
mv ./binutils-${{ env.binutilsVer }} ./binutils-src
92+
mv ./binutils-${{ matrix.binutils_version }} ./binutils-src
9193
cd binutils-src
9294
./configure --enable-targets=all --prefix=/tmp/binutils
9395
make

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,11 @@ if(DESKTOP)
250250

251251
add_external_library(uWebSockets)
252252

253-
set(websockets_additional_defines "")
253+
# Binutils on Mac doesn't support thread-local storage (required by
254+
# websockets), but because we only use websockets via the scheduler,
255+
# we don't need it.
256+
257+
set(websockets_additional_defines "-D__thread=")
254258

255259
# uWebSockets does not come with a CMakeLists file, so define the target.
256260
# Note that since it depends on OpenSSL, only do so if that was found.

build_scripts/desktop/package.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ readonly rename_string=f_b_
199199

200200
readonly demangle_cmds=${tools_path}/c++filt,${tools_path}/demumble
201201
readonly binutils_objcopy=${tools_path}/objcopy
202-
readonly binutils_nm=${tools_path}/nm
202+
if [[ -x ${tools_path}/nm-new ]] ; then
203+
readonly binutils_nm=${tools_path}/nm-new
204+
else
205+
readonly binutils_nm=${tools_path}/nm
206+
fi
203207
readonly binutils_ar=${tools_path}/ar
204208

205209
cache_file=/tmp/merge_libraries_cache.$$

0 commit comments

Comments
 (0)