<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi @zhuowei. I have been (somewhat verbosely) documenting my progress getting your SwiftAndroid build working on the reddit thread here <a href="https://www.reddit.com/r/swift/comments/3w0xrd/im_patching_the_opensource_swift_compiler_to/" class="">https://www.reddit.com/r/swift/comments/3w0xrd/im_patching_the_opensource_swift_compiler_to/</a> (as ephemer9). Given that I’ve now worked through a lot of issues, I think together we can make this build repeatable for everyone (that is if you need my help at all - you seem to be doing a mighty fine job yourself so far). What I’d like to do is work on the JNI integration part of this. Before I can though, I have to get through a few problems here still:</div><div class=""><br class=""></div><div class="">After dealing with the dependency issues (see reddit), the SwiftAndroid build finally completed. It had plenty of warnings along the way, but in the end I was left with binaries that seemed to do something. I was then able to use swiftc to compile for linux x86_64 as usual. I couldn't figure out how to cross-compile to armv7 though. This is what I tried:<br class=""><br class=""> swiftc -target armv7-none-linux-androideabi -target-cpu armv7 test.swift<br class=""><br class="">This unfortunately produces a segfault on my machine: "<unknown>:0: error: the clang compiler does not support '-mcpu=armv7'"<br class=""><br class="">Removing -target-cpu from the `swiftc` call leads to an error about missing `swift.ld` for architecture x86_64. It is looking under android/x86_64 - I symlinked the linker file from android/armv7 into that path and got this instead:<br class=""><br class=""> me@linuxbox:~# swiftc -target armv7-none-linux-androideabi test.swift -vSwift version 2.2-dev (LLVM 7bae82deaa, Clang 53d04af5ce, Swift 65921fc110)<br class=""> Target: armv7-none-linux-android<br class=""> /me/swift/build/Ninja-Release/swift-linux-x86_64/bin/swift -frontend -c -primary-file test.swift -target armv7-none-linux-android -disable-objc-interop -color-diagnostics -module-name test -o /tmp/test-706f67.o<br class=""> /me/swift/build/Ninja-Release/swift-linux-x86_64/bin/swift-autolink-extract /tmp/test-706f67.o -o /tmp/test-58bef6.autolink<br class=""> /usr/bin/clang++ /tmp/test-706f67.o -L /me/swift/build/Ninja-Release/swift-linux-x86_64/lib/swift/android -Xlinker -rpath -Xlinker /me/swift/build/Ninja-Release/swift-linux-x86_64/lib/swift/android -lswiftCore @/tmp/test-58bef6.autolink -Xlinker -T /me/swift/build/Ninja-Release/swift-linux-x86_64/lib/swift/android/x86_64/swift.ld -o test<br class=""> /usr/bin/ld: /tmp/test-706f67.o: Relocations in generic ELF (EM: 40)<br class=""> /usr/bin/ld: /tmp/test-706f67.o: Relocations in generic ELF (EM: 40)<br class=""> /tmp/test-706f67.o: error adding symbols: File in wrong format<br class=""> clang: error: linker command failed with exit code 1 (use -v to see invocation)<br class=""> <unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)<br class=""><br class=""></div><div class="">I’m assuming this is because it’s trying to link the armv7 binary with the x86_64 standard library or something illogical like that. In any case I’m a little stuck now as to how to proceed. Given that clang is telling me it doesn’t support armv7, I imagine I’m just entering the wrong arguments for swiftc. Or do I have to make LLVM-IR first and link using the android toolchain for now? Can you or anyone else give me an idea as to how to cross-compile using swiftc?</div><div class=""><br class=""></div><div class="">Many thanks,</div><div class="">Geordie</div></body></html>