Skip to content
This repository was archived by the owner on Feb 26, 2020. It is now read-only.

Conversation

@andresilva
Copy link

This PR fixes some build issues introduced with the migration to CMake.

  • Windows - The CMake build defaults to dynamically linking the Windows CRT, although in parity we set it to link statically. The build.rs now check the crt-static feature to configure CMake accordingly.
  • ARM - The CMake build defaults to setting -march=native which doesn't work when cross-compiling. Defining PORTABLE=ON makes sure the RocksDB build doesn't set -march=native.

this makes sure that the RocksDB build won't set -march=native
which doesn't work when cross-compiling
@andresilva andresilva requested review from debris and dvdplm August 28, 2018 19:00
@andresilva
Copy link
Author

Copy link

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.


// NOTE: the cfg! macro doesn't work when cross-compiling, it would return values for the host
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();
if target_arch == "arm" || target_arch == "aarch64" {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, we assume that the host arch is x86_64? And, ideally, we should check for host_arch != target_arch? But I'm not sure if there is a simple way to find out the value of the host_arch.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I think -march=native would work if the host was ARM and it was building for ARM, but the crate should build on ARM nonetheless with the current changes.
The current build file isn't terribly portable and yes it makes some assumptions regarding the build environment, i.e. my priority was to make it work on parity-ethereum's CI.

@debris debris merged commit 3d96d68 into master Aug 29, 2018
@debris debris deleted the andre/support-windows-build-static-crt branch August 29, 2018 12:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants