Skip to content

Commit

Permalink
build: Support for 32 bit linux builds and gcc 4.9 (getsentry#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
eakoli authored and irov committed Jun 17, 2020
1 parent 0e4a6a6 commit 2a14c24
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions tests/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
"$<$<PLATFORM_ID:Linux>:rt>"
)

if(MINGW)
Expand Down

0 comments on commit 2a14c24

Please sign in to comment.