Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Crosscompiling for Android on Windows (MinGW32) #84

Open
romsahel opened this issue Mar 28, 2022 · 2 comments
Open

Crosscompiling for Android on Windows (MinGW32) #84

romsahel opened this issue Mar 28, 2022 · 2 comments

Comments

@romsahel
Copy link

romsahel commented Mar 28, 2022

Hello,

I'm having trouble compiling the app for Android from Windows x64, using MinGW32.
I get an error as soon as compilation starts:

clang++.exe: error: unsupported option '--sysroot C:/AndroidPlayerNDK/toolchains/llvm/prebuilt/windows-x86_64/sysroot -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -Wa -Wformat -Werror=format-security -stdlib=libc++ '
CMakeFiles\cryptopp-object.dir\build.make:74: recipe for target 'CMakeFiles/cryptopp-object.dir/cryptlib.cpp.o' failed

The library does compile with no problem for Windows, MacOS and iOS and I do succeed in cross-compiling other libraries (such as OpenCV) for Android so I don't really know where the problem can come from.
I can also cross-compile the library using the official Makefile (following those instructions) so it really does not seem to be a minGW32 setup problem.

Does anybody have any idea on how to fix this, or any pointer on how to debug this?
Thank you,
PS: I'm not sure if this is the right place to post, I apologize if it's not.

@Vollstrecker
Copy link

As you see the error I would first start to remove options one after another to get the one that is problematic.

@romsahel
Copy link
Author

romsahel commented Mar 31, 2022

Alright, I got some more time to work on this issue and finally found what was causing it. It seems there are two sources of this problem:

  1. When crosscompiling for Android on Windows, the DumpMachine function does not set any CRYPTOPP_ARCH variable (the -dumpmachine return x86_64-w64-windows-gnu)
  2. Using a CMAKE_TOOLCHAIN_FILE causes the compiler option to appear twice, once in a valid form and the second time between quotes, which confuses the compiler.

Hopefully this will help someone who encounters the same issue.

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

No branches or pull requests

3 participants