swift-everywhere-toolchain
swift-everywhere-toolchain copied to clipboard
Where is concurrency lib?
Where is _concurrency lib :-)
See discussion section!
Happy Holidays!
I wasn't used "new concurrency" on Android yet. For example, in this project - https://github.com/vgorloff/swift-everywhere-samples. I conducted few examples on macOS 12 / Xcode 13.1, but not yet used "new concurrency" in production or commercial apps.
Will try to use few "new concurrency" examples on Android.
Thanks!
Happy Holidays !
On Dec 29, 2021, at 10:02 AM, Vlad Gorlov @.***> wrote:
I wasn't used "new concurrency" on Android yet. For example, in this project - https://github.com/vgorloff/swift-everywhere-samples https://github.com/vgorloff/swift-everywhere-samples. I conducted few examples on macOS 12 / Xcode 13.1, but not yet used "new concurrency" in production or commercial apps.
Will try to use few "new concurrency" examples on Android.
— Reply to this email directly, view it on GitHub https://github.com/vgorloff/swift-everywhere-toolchain/issues/138#issuecomment-1002664585, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC5F3PMCVFAWMUERQZ2XWOTUTMWK5ANCNFSM5K57HZOQ. You are receiving this because you authored the thread.
Oh, and we use the new concurrency on iOS/macOS/Linux and its good now for normal operations.
On Dec 29, 2021, at 1:15 PM, John Burkey @.***> wrote:
Thanks!
Happy Holidays !
On Dec 29, 2021, at 10:02 AM, Vlad Gorlov @.*** @.***>> wrote:
I wasn't used "new concurrency" on Android yet. For example, in this project - https://github.com/vgorloff/swift-everywhere-samples https://github.com/vgorloff/swift-everywhere-samples. I conducted few examples on macOS 12 / Xcode 13.1, but not yet used "new concurrency" in production or commercial apps.
Will try to use few "new concurrency" examples on Android.
— Reply to this email directly, view it on GitHub https://github.com/vgorloff/swift-everywhere-toolchain/issues/138#issuecomment-1002664585, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC5F3PMCVFAWMUERQZ2XWOTUTMWK5ANCNFSM5K57HZOQ. You are receiving this because you authored the thread.
Building Concurrency example (https://github.com/vgorloff/swift-everywhere-toolchain/commit/645e75d91bcb423a6b349678820bf3cf756a6ebb) gives me the following error:
{0}vova@MacBook-Pro:sample-package$ swift-build-arm-linux-androideabi
<unknown>:0: warning: unable to perform implicit import of "_Concurrency" module: no such module found
<unknown>:0: warning: unable to perform implicit import of "_Concurrency" module: no such module found
<unknown>:0: warning: unable to perform implicit import of "_Concurrency" module: no such module found
/Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/Tests/sample-package/Sources/SAConcurrency/SAConcurrencyMain.swift:18:7: error: cannot find 'Task' in scope
Task {
^~~~
Seems the Concurrency
feature wasn't build when building Android toolchain.
The Concurrency
feature wasn't enabled during build.
# File CMakeCache.txt
//Enable build of the Swift concurrency module
SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY:BOOL=OFF
There is a chicken-egg problem "dispatch needs stdlib" and, at the same time, "stdlib needs dispatch".
# File: stdlib/public/Concurrency/CMakeLists.txt
if(SWIFT_CONCURRENCY_USES_DISPATCH)
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
include_directories(AFTER
${SWIFT_PATH_TO_LIBDISPATCH_SOURCE})
# FIXME: we can't rely on libdispatch having been built for the
# target at this point in the process. Currently, we're relying
# on soft-linking.
list(APPEND swift_concurrency_link_libraries
dispatch)
endif()
endif()
To build Concurrency
feature the Dispatch
subproject needs to be build during stdlib build. It is configured via cmake/modules/Libdispatch.cmake
.
Dispatch
subproject fails to build due compiler flag -Werror
:)
:-)
Sent from my iPhone
On Jan 1, 2022, at 8:40 AM, Vlad Gorlov @.***> wrote:
Dispatch subproject fails to build due compiler flag -Werror :)
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.
does it build?
I will try to figure out in coming days how to pass arguments to external project (dispatch in our case). After quick search I didn't managed to find "who" is passing that -Werror
flag. Maybe it is a CMake default.
Maybe ping compnerd on slack channel for swift on android ? He’s awesome and very aquatinted with stuff like this as he’s the windows build champ on top of all of his other magic.
On Jan 5, 2022, at 2:50 AM, Vlad Gorlov @.***> wrote:
I will try to figure out in coming days how to pass arguments to external project (dispatch in our case). After quick search I didn't managed to find "who" is passing that -Werror flag. Maybe it is a CMake default.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.
https://join.slack.com/t/swift-android/shared_invite/zt-11grcjtps-UHeM3etApuYdayxAKv436A
Sounds like they want to do a strategy discussion with you too - Nice folks .
Building of "libdispatch" is not a problem. There is already builder for it (https://github.com/vgorloff/swift-everywhere-toolchain/blob/master/lib/Builders/DispatchBuilder.js). Issue that CMake is a functional-programming thing which consumes time to figure out needed options to pass :)
Compnerd knows the swift builds super well just thinking he could save you time ;-)
On Jan 5, 2022, at 4:14 PM, Vlad Gorlov @.***> wrote:
Building of "libdispatch" is not a problem. There is already builder for it (https://github.com/vgorloff/swift-everywhere-toolchain/blob/master/lib/Builders/DispatchBuilder.js). Issue that CMake is a functional-programming thing which consumes time to figure out needed options to pass :)
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.
Seems "libDispatch" itself defined compiler flags here: https://github.com/apple/swift-corelibs-libdispatch/blob/swift-5.5.2-RELEASE/cmake/modules/DispatchCompilerWarnings.cmake
Strange why I don't have this issue when building libdispatch standalone. Maybe because i am passing C/CXX flags explicitly.
The issue with -Werror
is fixed by adding code below:
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-unused-command-line-argument>)
endif()
The next error seems due minSDKVersion 21 (https://stackoverflow.com/a/53217341/1418981):
/Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Sources/swift-corelibs-libdispatch/src/event/event_epoll.c:460:33: error: use of undeclared identifier 'EPOLL_CLOEXEC'
_dispatch_epfd = epoll_create1(EPOLL_CLOEXEC);
^
1 error generated.
Cmake uses SDK 16 by default:
-- ANDROID_PLATFORM not set. Defaulting to minimum supported version
16.
Passing -DANDROID_PLATFORM=${ANDROID_PLATFORM}
in cmake/modules/Libdispatch.cmake
helped to build libswift_Concurrency.so
for armv7.
Next error when building for aarch64
:
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
-- Check for working C compiler: /Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - broken
CMake Error at /usr/local/Cellar/cmake/3.22.0/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang"
is not able to compile a simple test program.
Configure
is not finished successfully :0
When I am building libdispatch as standalone, the CMAKE_C_FLAGS
defined as empty string. When building libdispatch via stdlib, then CMAKE_C_FLAGS
defined as CMAKE_C_FLAGS:STRING=-g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -L/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -Wno-comment -fdiagnostics-color
Thus the following configure error seems due unneeded flag -L/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
-- Check for working C compiler: /Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - broken
CMake Error at /usr/local/Cellar/cmake/3.22.0/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-aarch64/swift-stdlib/libdispatch-android-aarch64-prefix/src/libdispatch-android-aarch64-build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/local/bin/ninja cmTC_06ead && [1/2] Building C object CMakeFiles/cmTC_06ead.dir/testCCompiler.c.o
clang: warning: argument unused during compilation: '-L/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21' [-Wunused-command-line-argument]
[2/2] Linking C executable cmTC_06ead
FAILED: cmTC_06ead
: && /Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=armv7-none-linux-androideabi21 --gcc-toolchain=/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -L`/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21` -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -Wno-comment -fdiagnostics-color -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -Wl,--gc-sections CMakeFiles/cmTC_06ead.dir/testCCompiler.c.o -o cmTC_06ead -latomic -lm && :
/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21/libm.so while searching for m
/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21/libdl.so while searching for dl
/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21/libdl.so while searching for dl
/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21/libc.so while searching for c
/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21/libdl.so while searching for dl
/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21/libdl.so while searching for dl
/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: treating warnings as errors
When building stdlib, I am passing manually the C flag -L/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21
. And then Cmake picks it and passes to the libdispatch
subproject. Maybe I just need not to pass it.
Next error:
FAILED: lib/swift/android/aarch64/libswift_Concurrency.so
: && /Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=aarch64-none-linux-android21 --gcc-toolchain=/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -L/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -Wno-comment -fdiagnostics-color -O2 -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libswift_Concurrency.so -target aarch64-unknown-linux-android21 --sysroot=/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -B /Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/aarch64-linux-android/bin -lm -fuse-ld=gold -shared -o lib/swift/android/aarch64/libswift_Concurrency.so stdlib/public/Concurrency/ANDROID/aarch64/_Concurrency.o lib/swift/android/aarch64/swiftrt.o stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/__/CompatibilityOverride/CompatibilityOverride.cpp.o stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/Actor.cpp.o stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/AsyncLet.cpp.o stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/Error.cpp.o stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/LinkCompatibilityShims.cpp.o stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/Task.cpp.o stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/TaskAlloc.cpp.o stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/TaskStatus.cpp.o stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/TaskGroup.cpp.o stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/TaskLocal.cpp.o stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/ThreadSanitizer.cpp.o stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/Mutex.cpp.o stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/AsyncStream.cpp.o stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/linker-support/magic-symbols-for-install-name.c.o -L/Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-host/llvm-project/./lib -L/Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-aarch64/swift-stdlib/./lib/swift/android/aarch64 -L/Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-host/swift/bin/../lib/swift/android/aarch64 -L/Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-host/swift/bin/../lib/swift/android -L/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/swift -L/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/../lib/gcc/aarch64-linux-android/4.9.x -L/Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Install/darwin-aarch64/icu/lib -L/Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-aarch64/swift-stdlib/libdispatch-android-aarch64-prefix/lib -ldispatch -ldl -llog /Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++abi.a /Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so /Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Install/darwin-aarch64/icu/lib/libicui18nswift.so /Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Install/darwin-aarch64/icu/lib/libicuucswift.so lib/swift/android/aarch64/libswiftGlibc.so lib/swift/android/aarch64/libswiftCore.so -latomic -lm && :
/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/aarch64-linux-android/bin/ld.gold: warning: skipping incompatible /Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-aarch64/swift-stdlib/./lib/swift/android/aarch64/libdispatch.so while searching for dispatch
/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/aarch64-linux-android/bin/ld.gold: warning: skipping incompatible /Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-aarch64/swift-stdlib/libdispatch-android-aarch64-prefix/lib/libdispatch.so while searching for dispatch
/Volumes/Shared/Data/Android/sdk/ndk/21.4.7075529/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/aarch64-linux-android/bin/ld.gold: error: cannot find -ldispatch
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueGlobalImpl(swift::Job*): error: undefined reference to '_dispatch_queue_attr_concurrent'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueGlobalImpl(swift::Job*): error: undefined reference to '_dispatch_queue_attr_concurrent'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueGlobalImpl(swift::Job*): error: undefined reference to 'dispatch_queue_attr_make_with_qos_class'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueGlobalImpl(swift::Job*): error: undefined reference to 'dispatch_queue_create'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueGlobalImpl(swift::Job*): error: undefined reference to 'dispatch_queue_set_width'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueGlobalImpl(swift::Job*): error: undefined reference to 'dispatch_release'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to 'dispatch_time'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to 'dispatch_after_f'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to '_dispatch_queue_attr_concurrent'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to '_dispatch_queue_attr_concurrent'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to 'dispatch_queue_attr_make_with_qos_class'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to 'dispatch_queue_create'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to 'dispatch_queue_set_width'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to 'dispatch_release'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueMainExecutor: error: undefined reference to '_dispatch_main_q'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueMainExecutor: error: undefined reference to '_dispatch_main_q'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueMainExecutorImpl(swift::Job*): error: undefined reference to '_dispatch_main_q'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function swift_task_enqueueMainExecutorImpl(swift::Job*): error: undefined reference to '_dispatch_main_q'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/GlobalExecutor.cpp.o:GlobalExecutor.cpp:function dispatchEnqueueDispatchAsync(dispatch_queue_s*, void*, unsigned int): error: undefined reference to 'dispatch_async_f'
stdlib/public/Concurrency/CMakeFiles/swift_Concurrency-android-aarch64.dir/Task.cpp.o:Task.cpp:function swift_task_asyncMainDrainQueueImpl(): error: undefined reference to 'dispatch_main'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Obviously because libdispatch for some reason was built for armv7 instead for aarch64 :)
{0}vova@MacBook-Pro:swift-everywhere-toolchain$ file /Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-aarch64/swift-stdlib/lib/swift/android/aarch64/libswiftCore.so
/Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-aarch64/swift-stdlib/lib/swift/android/aarch64/libswiftCore.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=994cfd8863a2c520eb9e21ff8538133e63c478ca, with debug_info, not stripped
{0}vova@MacBook-Pro:swift-everywhere-toolchain$ file /Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-aarch64/swift-stdlib/lib/swift/android/aarch64/libdispatch.so
/Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-aarch64/swift-stdlib/lib/swift/android/aarch64/libdispatch.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=b8dfcdb8a04a347ce81569ad7dcec4457acf3e8f, with debug_info, not stripped
{0}vova@MacBook-Pro:swift-everywhere-toolchain$
For some reason the option CMAKE_SYSTEM_PROCESSOR
set as armv7-a
in file /.../CMakeFiles/3.22.0/CMakeSystem.cmake
for libdispatch
subproject. At the same time stdlib
itself has value for the same option set as aarch64
. Which is correct one.
The above issue fixed by passing Cmake flag -DANDROID_ABI=${ANDROID_ABI}
to the libdispatch
subproject.
Ok. I am able to build stdlib
with libswift_Concurrency.so
for all 4 Android archs: arm 32/64 bit and x86 32/64 bit.
Now it is time to make clean rebuild of Swift, stdlib, libDispatch, libFoundation and then try Async/Await example again.
Yay!
On Jan 6, 2022, at 4:13 AM, Vlad Gorlov @.***> wrote:
Ok. I am able to build stdlib with libswift_Concurrency.so for all 4 Android archs: arm 32/64 bit and x86 32/64 bit.
Now it is time to make clean rebuild of Swift, stdlib, libDispatch, libFoundation and then try Async/Await example again.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.
But sample code which works on macOS crashes with Segmentation fault
on Android :0
Getting closer!
On Jan 6, 2022, at 8:55 AM, Vlad Gorlov @.***> wrote:
But sample code which works on macOS crashes with Segmentation fault on Android :0
— Reply to this email directly, view it on GitHub https://github.com/vgorloff/swift-everywhere-toolchain/issues/138#issuecomment-1006654303, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC5F3PIP2MVFZVD6ODCD4J3UUWUONANCNFSM5K57HZOQ. You are receiving this because you authored the thread.
I will try one idea, but if it won't work, then I will come back to troubleshooting after next major release of Swift - Swift 5.5.3 or Swift 5.6.0.
The Swift Concurrency is experimental thing.
Even Cmake option, which is used to activate this feature, defined as following -D SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY=TRUE/FALSE
I think that flag is the old flag when it was experimental - i haven’t had any issues with the feature since they fixed the bugs just post 5.5.
I’m sure compnerd has good advice on this - find him in the slack channel ?
On Jan 6, 2022, at 9:11 AM, Vlad Gorlov @.***> wrote:
I will try one idea, but if it won't work, then I will come back to troubleshooting after next major release of Swift - Swift 5.5.3 or Swift 5.6.0.
The Swift Concurrency is experimental thing. Even Cmake option, which is used to activate this feature, defined as following -D SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY=TRUE/FALSE
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.