Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake cross compile question #183

Open
anakinxc opened this issue Jul 19, 2023 · 1 comment
Open

Cmake cross compile question #183

anakinxc opened this issue Jul 19, 2023 · 1 comment

Comments

@anakinxc
Copy link

Hi,

I'm trying to cross compile mcl for Android from a Linux x64 machine.

Here's the command I run:

cmake -GNinja -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=$ANDROID_NDK_HOME -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DMCL_BUILD_TESTING=OFF -DMCL_TEST_WITH_GMP=OFF ..
ninja

Error message is:

[1/12] Generating bint64.o
warning: overriding the module target triple with x86_64-unknown-linux-gnu [-Woverride-module]
1 warning generated.
[2/12] Generating base64.o
warning: overriding the module target triple with x86_64-unknown-linux-gnu [-Woverride-module]
1 warning generated.
[6/12] Linking CXX shared library lib/libmcl.so
FAILED: lib/libmcl.so
: && /tools/android/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 -fPIC -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++ -O2 -g -DNDEBUG  -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--gc-sections -Qunused-arguments -Wl,--no-undefined -shared -Wl,-soname,libmcl.so -o lib/libmcl.so CMakeFiles/mcl.dir/src/fp.cpp.o  bint64.o  base64.o   -static-libstdc++ -latomic -lm && :
ld: error: bint64.o is incompatible with aarch64linux
ld: error: base64.o is incompatible with aarch64linux
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[9/12] Building CXX object CMakeFiles/mclbn384_256.dir/src/bn_c384_256.cpp.o
ninja: build stopped: subcommand failed.

Looks like in CMakeLists.txt:175 when compile LLVM bitcode target triple is missing.

I noticed you have done something for makefile here. Maybe same fix should apply to CMake build?

Best

@herumi
Copy link
Owner

herumi commented Jul 24, 2023

Is this correct? I'm still determining.
fa65845

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants