From 44c22e73108c1098582f365be5626add10603feb Mon Sep 17 00:00:00 2001 From: Chris Rudd Date: Tue, 2 Jun 2020 20:51:39 +0000 Subject: [PATCH 1/3] Support for 32 bit linux builds and gcc 4.9 --- CMakeLists.txt | 9 +++++++++ tests/unit/CMakeLists.txt | 1 + 2 files changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 290a6551e..091ef1f9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,15 @@ if(MSVC) option(SENTRY_BUILD_RUNTIMESTATIC "Build sentry-native with static runtime" OFF) endif() +if(LINUX) + option(SENTRY_BUILD_FORCE32 "Force a 32bit compile on a 64bit host" OFF) + if(SENTRY_BUILD_FORCE32) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE") + set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF) + endif() +endif() + # CMAKE_POSITION_INDEPENDENT_CODE must be set BEFORE adding any libraries (including subprojects) if(SENTRY_PIC) set(CMAKE_POSITION_INDEPENDENT_CODE ON) diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 90eb889ad..4cf3d01f2 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -46,6 +46,7 @@ target_include_directories(sentry_test_unit PRIVATE target_link_libraries(sentry_test_unit PRIVATE ${SENTRY_LINK_LIBRARIES} ${SENTRY_INTERFACE_LINK_LIBRARIES} + "$<$:rt>" ) if(MINGW) From 4c36603efbdbe64e42001284d9814c48d976927f Mon Sep 17 00:00:00 2001 From: Chris Rudd Date: Tue, 16 Jun 2020 13:29:12 -0500 Subject: [PATCH 2/3] fixup! Support for 32 bit linux builds and gcc 4.9 --- azure-pipelines.yml | 4 ++-- tests/__init__.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5210d0ece..f389f8117 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -18,8 +18,8 @@ stages: matrix: Linux (gcc 7, 32-bit): vmImage: "ubuntu-18.04" - CC: gcc-7 -m32 - CXX: g++-7 -m32 + CC: gcc-7 + CXX: g++-7 TEST_X86: 1 Linux (gcc 9): vmImage: "ubuntu-latest" diff --git a/tests/__init__.py b/tests/__init__.py index 8d2500e61..66621dbbd 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -102,6 +102,8 @@ def cmake(cwd, targets, options=None): configcmd.append("-D{}={}".format(key, value)) if sys.platform == "win32" and os.environ.get("TEST_X86"): configcmd.append("-AWin32") + else if sys.platform == "linux" and os.environ.get("TEST_X86"): + configcmd.append("-DSENTRY_BUILD_FORCE32=ON") cmakelists_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) configcmd.append(cmakelists_dir) From 751f38cee20fd36abd2041f23889a05f6a554154 Mon Sep 17 00:00:00 2001 From: Chris Rudd Date: Tue, 16 Jun 2020 14:15:54 -0500 Subject: [PATCH 3/3] Update tests/__init__.py Co-authored-by: Arpad Borsos --- tests/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/__init__.py b/tests/__init__.py index 66621dbbd..20a7f2e2a 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -102,7 +102,7 @@ def cmake(cwd, targets, options=None): configcmd.append("-D{}={}".format(key, value)) if sys.platform == "win32" and os.environ.get("TEST_X86"): configcmd.append("-AWin32") - else if sys.platform == "linux" and os.environ.get("TEST_X86"): + elif sys.platform == "linux" and os.environ.get("TEST_X86"): configcmd.append("-DSENTRY_BUILD_FORCE32=ON") cmakelists_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))