Skip to content

Commit

Permalink
Pick correct toolchain for Linux builds (#6094)
Browse files Browse the repository at this point in the history
  • Loading branch information
kneth authored Aug 27, 2023
1 parent 3095fe6 commit b789110
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
* None

### Fixed
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?)
* None
* Fixed toolchain on Linux. On older Linux installations, the error `GLIBC_2.34' not found (required by /home/user/MyProject/node_modules/realm/generated/ts/realm.node)` could be observed. ([#6082](https://github.com/realm/realm-js/issues/6082), since v12.0.0)

### Compatibility
* React Native >= v0.71.4
Expand Down
16 changes: 13 additions & 3 deletions packages/realm/bindgen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,19 @@ if(DEFINED CMAKE_JS_VERSION)
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "")
endif()
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
add_link_options(-fuse-ld=gold)
add_link_options(-Wl,-z,noexecstack)
add_link_options(-Wl,--warn-execstack)
if(NODE_ARCH STREQUAL "arm")
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/vendor/realm-core/tools/cmake/armv7-linux-gnueabihf.toolchain.cmake")
# due to how multiarch works in debian this is needed to link to the correct system libraries
set(CMAKE_IGNORE_PATH "/usr/lib/x86_64-linux-gnu")
elseif(NODE_ARCH STREQUAL "arm64")
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/vendor/realm-core/tools/cmake/aarch64-linux-gnu.toolchain.cmake")
set(CMAKE_IGNORE_PATH "/usr/lib/x86_64-linux-gnu")
elseif(NODE_ARCH STREQUAL "x64")
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/vendor/realm-core/tools/cmake/x86_64-linux-gnu.toolchain.cmake")
endif()
add_link_options(-fuse-ld=gold)
add_link_options(-Wl,-z,noexecstack)
add_link_options(-Wl,--warn-execstack)
endif()
endif()

Expand Down

0 comments on commit b789110

Please sign in to comment.