-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement build for swift 5.7 #1
Comments
StdLibWhile building StdLib I encountered few issues. Issue 1 To solve it, I introduced patches. Before building LibStd I patch repo with these values. Patch looks like this
|
StdLib Build Issue 2 Issue with linker
As I undestood, it is connected to default usage of Patch loks like this
|
libDispatchIssue 1
I added/uncommented verbose options for swift
And it appears that swiftc uses pre-installed apple's clang and linker as result.
Solution |
Issue 2
I can see that files are in NDK folders somehwere, but they are not in the same folder as lld and don't have absolute path, like other object files Here is final command to ld.lld"/Users/${USER}/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/bin/ld.lld" \
--sysroot=/Users/${USER}/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21 \
-EL \
--fix-cortex-a53-843419 \
--warn-shared-textrel \
-z \
now \
-z \
relro \
-z \
max-page-size=4096 \
--hash-style=both \
--enable-new-dtags \
--eh-frame-hdr \
-m \
aarch64linux \
-shared \
-o \
/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64/libswiftDispatch.so \
crtbegin_so.o \
-L/Users/${USER}/ws/SwiftAndroid_working/build/stdlib-aarch64/lib/swift/android \
-L/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64/src/swift \
-L/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64 \
-L/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64 \
-L/Users/${USER}/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/14.0.6/lib/linux/aarch64 \
-L/Users/${USER}/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21 \
-L/Users/${USER}/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android \
-L/Users/${USER}/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib \
-L/Users/${USER}/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/14.0.6/lib/linux/aarch64 \
/Users/${USER}/ws/SwiftAndroid_working/build/stdlib-aarch64/lib/swift/android/aarch64/swiftrt.o \
/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64/src/swift/CMakeFiles/swiftDispatch.dir/Block.swift.o \
/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64/src/swift/CMakeFiles/swiftDispatch.dir/Data.swift.o \
/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64/src/swift/CMakeFiles/swiftDispatch.dir/Dispatch.swift.o \
/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64/src/swift/CMakeFiles/swiftDispatch.dir/IO.swift.o \
/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64/src/swift/CMakeFiles/swiftDispatch.dir/Private.swift.o \
/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64/src/swift/CMakeFiles/swiftDispatch.dir/Queue.swift.o \
/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64/src/swift/CMakeFiles/swiftDispatch.dir/Source.swift.o \
/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64/src/swift/CMakeFiles/swiftDispatch.dir/Time.swift.o \
/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64/src/swift/CMakeFiles/swiftDispatch.dir/Wrapper.swift.o \
/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64/src/swift/libDispatchStubs.a \
/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64/libdispatch.so \
/Users/${USER}/ws/SwiftAndroid_working/build/libDispatch-aarch64/libBlocksRuntime.so \
-ldispatch \
-ldispatch \
-ldispatch \
-ldispatch \
-ldispatch \
-ldispatch \
-ldispatch \
-ldispatch \
-ldispatch \
-lswift_Concurrency \
-lswiftCore \
-lswiftCore \
-lc++ \
-lm \
-l:libunwind.a \
-ldl \
-lc \
-l:libunwind.a \
-ldl \
-soname \
libswiftDispatch.so \
-rpath \
"\$ORIGIN" \
/Users/${USER}/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/14.0.6/lib/linux/libclang_rt.builtins-aarch64-android.a \
-l:libunwind.a \
-ldl \
-lc \
/Users/${USER}/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/14.0.6/lib/linux/libclang_rt.builtins-aarch64-android.a \
-l:libunwind.a \
-ldl \
crtend_so.o I can see that lld was pointed to correct folder to search for those files - Solution I can see that these files passed by clang and I didn't find the way to force clang to pass proper pathes.
If issue repeats in future, might consider other work around proposed in the same issue on StackOverflow, copy files, possible next to lld or in working folder, so it can find them. But this is dirty hack |
libFoundationIssue 1It appears libFoundation require ICU. I heard news that Apple dropped ICU requirement for swift, and assumed that it also included all libs. Apperently not. So I need to implement checkout and build for ICU, which is not ninja, it uses configure + make |
libFoundation Issue 2After building openssl and libxml2, I was able to pass configure command in foundation. And I found other error
Error occurred when we link plutil, which is added to build by default. As I understand here is opposite problem, of what I had before. I need to link with We building executable, and no easy way to disable it. Only way is apply patch, which I would prefer to avoid. |
While compiled shared library I got familiar error about missing
Need to split in 2, so we path
|
After compiling executable binary for test deployment on emulator I run into few issues. Need to copy all dependencies from toolchain
Repeat for every missded .so file Need to copy some libs from NDK
Additional LD path
After this all libraties found but there are some missing symbols. Missing symbol
This happen because of |
I wanted to compile just icu*.so, and not icu*.so.65.1, but this appears to be more complicated than I anticipated.
For now I copy all symlinks and actual file with binary and it works for test purpose. |
This version require installing libxml2 from brew. Looks at |
I will leave this issue not completed. I will create |
Plan:
cmake configure
with need dependencieslibFoundation.so
depends onlibicudataswift.so.65
, but we renamed it to libicudataswift.so, so we need to change building and removeso.65
even before. And make it depends on.so
git diff > patch.patch
--clean
option, to delete build, install and progress files #19The text was updated successfully, but these errors were encountered: