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/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..20a7f2e2a 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") + 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__))) configcmd.append(cmakelists_dir) 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)