Skip to content

Commit 7251a73

Browse files
committed
Patch macOS Intel GMP
Signed-off-by: Panagiotis Georgiadis <pgeorgia@redhat.com>
1 parent 35a66f6 commit 7251a73

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,11 @@ jobs:
6767
- uses: actions/setup-python@v5
6868
with:
6969
python-version: '3.x'
70-
- name: Install dependencies
71-
run: |
72-
brew install automake texinfo gmp
73-
GMP_PREFIX=$(brew --prefix gmp)
74-
echo "PKG_CONFIG_PATH=$GMP_PREFIX/lib/pkgconfig" >> $GITHUB_ENV
75-
echo "CPPFLAGS=-I$GMP_PREFIX/include" >> $GITHUB_ENV
76-
echo "LDFLAGS=-L$GMP_PREFIX/lib" >> $GITHUB_ENV
7770
- name: Build
7871
run: |
7972
git config --global user.email "builds@travis-ci.com"
8073
git config --global user.name "Travis CI"
74+
brew install automake texinfo
8175
mkdir -p build
8276
cd build
8377
cmake ..

CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,19 +213,21 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi
213213
"CFLAGS=-DYAML_DECLARE_STATIC"
214214
)
215215

216-
# GMP assembly doesn't work on ARM64 macOS - need to disable it
217-
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" AND ${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "arm64")
216+
# GMP assembly causes issues on macOS - need to disable it and use PIC
217+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
218218
set(gmp_asm_flag --disable-assembly)
219+
set(gmp_pic_flags "CFLAGS=-fPIC -fexceptions" "CXXFLAGS=-fPIC")
219220
else()
220221
set(gmp_asm_flag "")
222+
set(gmp_pic_flags "CPPFLAGS=-fexceptions")
221223
endif()
222224

223225
ExternalProject_add(gmp${suffix}
224226
URL https://ftpmirror.gnu.org/gnu/gmp/gmp-${GMP_VERSION}.tar.bz2
225227
URL_HASH ${GMP_HASH}
226228
DOWNLOAD_DIR ${DOWNLOAD_DIR}
227229
PATCH_COMMAND sh ${PROJECT_SOURCE_DIR}/cmake/update_config_files.sh <SOURCE_DIR>
228-
CONFIGURE_COMMAND CPPFLAGS=-fexceptions ${compiler_flags} ${wrapper_command} <SOURCE_DIR>/configure
230+
CONFIGURE_COMMAND ${gmp_pic_flags} ${compiler_flags} ${wrapper_command} <SOURCE_DIR>/configure
229231
--build=${build_native}
230232
--host=${toolchain_host}
231233
--prefix=${toolchain_deps_dir}

0 commit comments

Comments
 (0)