Skip to content
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

[SR-5885] build libdispatch for android error 'sys/sdt.h' file not found #680

Closed
swift-ci opened this issue Sep 15, 2017 · 6 comments
Closed

Comments

@swift-ci
Copy link

Previous ID SR-5885
Radar None
Original Reporter amraboelela (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s libdispatch
Labels Bug, Android
Assignee None
Priority Medium

md5: 4a136b2576174433ec60ce3acb97291c

Issue Description:

I run script:

env \
CC="$SWIFT_ANDROID_BUILD_PATH/llvm-linux-x86_64/bin/clang" \
CXX="$SWIFT_ANDROID_BUILD_PATH/llvm-linux-x86_64/bin/clang++" \
SWIFTC="$SWIFT_ANDROID_BUILD_PATH/swift-linux-x86_64/bin/swiftc" \
CFLAGS="" \
./configure \
--with-swift-toolchain="$SWIFT_ANDROID_TOOLCHAIN_PATH" \
--with-build-variant=release \
--enable-android \
--host=arm-linux-androideabi \
--with-android-ndk=$ANDROID_NDK_PATH \
--with-android-api-level=21 \
--disable-build-tests \
--prefix=$SWIFT_ANDROID_TOOLCHAIN_PATH/usr

I got error:

...

libtool: compile: /home/amr/swift/build/Ninja-ReleaseAssert/llvm-linux-x86_64/bin/clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -I../private -Wall -fvisibility=hidden -momit-leaf-frame-pointer -fblocks -I../src/BlocksRuntime -target arm-linux-androideabi --sysroot=/home/amr/android/android-ndk-r14b/platforms/android-21/arch-arm -B/home/amr/android/android-ndk-r14b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin -c allocator.c -fPIC -DPIC -o .libs/allocator.o
In file included from allocator.c:21:
In file included from ./internal.h:743:
./provider.h:10:10: fatal error: 'sys/sdt.h' file not found
#include <sys/sdt.h>
^~~~~~~~~~~
1 error generated.

@swift-ci
Copy link
Author

Comment by Amr Aboelela (JIRA)

@johnno1962 I was trying your script when I got this error, any idea?

Thanks

@swift-ci
Copy link
Author

Comment by Amr Aboelela (JIRA)

I passed this error by adding this line before running ./configure:

CPPFLAGS="-DTARGET_OS_EMBEDDED" \

@swift-ci
Copy link
Author

Comment by Amr Aboelela (JIRA)

Now I am getting this error:

/home/amr/swift/swift-corelibs-libdispatch/dispatch/dispatch.h:30:10: note: in file included from /home/amr/swift/swift-corelibs-libdispatch/dispatch/dispatch.h:30:
#include <os/linux_base.h>
^
/home/amr/swift/swift-corelibs-libdispatch/os/linux_base.h:17:10: note: in file included from /home/amr/swift/swift-corelibs-libdispatch/os/linux_base.h:17:
#include <sys/sysmacros.h>
^
/home/amr/android/android-ndk-r14b/platforms/android-21/arch-arm/usr/include/sys/sysmacros.h:41:23: error: redefinition of 'minor'
static inline int minor(dev_t _dev)
^
/home/amr/android/android-ndk-r14b/platforms/android-21/arch-arm/usr/include/sys/sysmacros.h:41:23: note: previous definition is here
static inline int minor(dev_t _dev)
^
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "dispatch.h"
^
/home/amr/swift/swift-corelibs-libdispatch/dispatch/dispatch.h:30:10: note: in file included from /home/amr/swift/swift-corelibs-libdispatch/dispatch/dispatch.h:30:
#include <os/linux_base.h>
^
/home/amr/swift/swift-corelibs-libdispatch/os/linux_base.h:17:10: note: in file included from /home/amr/swift/swift-corelibs-libdispatch/os/linux_base.h:17:
#include <sys/sysmacros.h>
^
/home/amr/android/android-ndk-r14b/platforms/android-21/arch-arm/usr/include/sys/sysmacros.h:46:25: error: redefinition of 'makedev'
static inline dev_t makedev(int __ma, int __mi)
^
/home/amr/android/android-ndk-r14b/platforms/android-21/arch-arm/usr/include/sys/sysmacros.h:46:25: note: previous definition is here
static inline dev_t makedev(int __ma, int __mi)
^
/home/amr/swift/swift-corelibs-libdispatch/src/swift/Block.swift:13:8: error: could not build C module 'CDispatch'
import CDispatch

@swift-ci
Copy link
Author

Comment by Amr Aboelela (JIRA)

+ das (JIRA User)

@swift-ci
Copy link
Author

Comment by Amr Aboelela (JIRA)

I fixed this error by doing the following in os/linux_base.h:

#ifndef ANDROID
#if __has_include(<sys/sysmacros.h>)
#include <sys/sysmacros.h>
#endif
#endif

@compnerd
Copy link
Collaborator

I believe that the current state of the world has libdispatch building successfully for android. Please re-open if that is not the case.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants