Open dhimasya opened 2 weeks ago
This is a compiler error, so a linker flag wouldn't fix it.
The surrounding code is:
# if defined(JEMALLOC_HAVE_SCHED_SETAFFINITY)
sched_getaffinity(0, sizeof(set), &set);
# else /* !JEMALLOC_HAVE_SCHED_SETAFFINITY */
pthread_getaffinity_np(pthread_self(), sizeof(set), &set);
# endif /* JEMALLOC_HAVE_SCHED_SETAFFINITY */
From searching the Android headers ($ANDROID_HOME/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include), I see that Android does have sched_setaffinity
, but it doesn't have pthread_getaffinity_np
. So the fix is to define JEMALLOC_HAVE_SCHED_SETAFFINITY
.
This can be done by editing duckdb_build/extension/jemalloc/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h to replace /* #undef JEMALLOC_HAVE_SCHED_SETAFFINITY */
with #define JEMALLOC_HAVE_SCHED_SETAFFINITY
.
For how to apply and save this edit, see the build-wheel README under "If any changes are needed to make the build work".
The build then fails with these errors:
In file included from duckdb_build/ub_src_main_extension.cpp:5:
In file included from duckdb_build/src/main/extension/extension_install.cpp:14:
duckdb_build/third_party/httplib/httplib.hpp:2687:2: error: use of undeclared identifier 'getifaddrs'; did you mean 'ifaddrs'?
getifaddrs(&ifap);
^
/home/smith/android-sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/ifaddrs.h:45:8: note: 'ifaddrs' declared here
struct ifaddrs {
^
In file included from duckdb_build/ub_src_main_extension.cpp:5:
In file included from duckdb_build/src/main/extension/extension_install.cpp:14:
duckdb_build/third_party/httplib/httplib.hpp:2694:6: error: use of undeclared identifier 'freeifaddrs'
freeifaddrs(ifap);
^
duckdb_build/third_party/httplib/httplib.hpp:2700:2: error: use of undeclared identifier 'freeifaddrs'
freeifaddrs(ifap);
^
3 errors generated.
Searching the sysroot/usr/include directory again, I found that these functions were added to Android in API level 24, so you can work around this by passing --api-level 24
to build-wheel. To use the resulting wheels, you'll also have to make sure the minSdk
of your app is 24 or higher.
There may be other issues; I haven't tested any further.
already check some issue, but unable to understand how to solve this error when try to prebuild python package for "duckdb" here is my package meta.yaml
here is the build command that i run python build-wheel.py --python 3.11 --abi arm64-v8a duckdb
look closer that the error happend here
after looking for a while, i found that i need to set -lpthread on gcc command, how to achieve this and how to suppress some of the warning?