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-3751] libdispatch build script error on Linux (Gentoo and LFS) #701

Closed
swift-ci opened this issue Jan 26, 2017 · 10 comments
Closed

[SR-3751] libdispatch build script error on Linux (Gentoo and LFS) #701

swift-ci opened this issue Jan 26, 2017 · 10 comments

Comments

@swift-ci
Copy link

Previous ID SR-3751
Radar None
Original Reporter Vladislav (JIRA User)
Type Bug
Status Closed
Resolution Invalid
Environment

Linux

Additional Detail from JIRA
Votes 0
Component/s libdispatch
Labels Bug, BuildScript, Linux
Assignee dgrove-oss (JIRA)
Priority Medium

md5: 94f55c4e7fb5077d3ade0240bbfb5576

relates to:

  • SR-3771 error while loading shared libraries: libkqueue.so.0

Issue Description:

I have got the same build errors on both Gentoo and Linux From Scratch (LFS):
In file included from /mnt/swift/swift-source/swift-corelibs-libdispatch/src/allocator.c:21:
/mnt/swift/swift-source/swift-corelibs-libdispatch/src/internal.h:246:10: fatal error: 'sys/event.h' file not found

If I am not mistaken the event.h header is part of libevent library. Both systems have libevent installed but the event.h file is located in /usr/include but not in /usr/include/sys. /usr/include is standard installation for libevent headers.
It looks like cmake is not checking location for required files.

@swift-ci
Copy link
Author

Comment by Vladislav Dembskiy (JIRA)

By the way, libevent is not listed as required dependency in the Swift README

@swift-ci
Copy link
Author

Comment by David Grove (JIRA)

I think you forgot to do the git submodule steps needed when building libdispatch from source on Linux.
That error indicates that the libkqueue submodule was not checked out.

See the instructions in INSTALL.md for building from source on Linux (quoted below):

2. Initialize git submodules.
We are using git submodules to incorporate specific revisions of the
upstream pthread_workqueue and libkqueue projects into the build.

git submodule init
git submodule update

@swift-ci
Copy link
Author

Comment by Vladislav Dembskiy (JIRA)

Thank you David, but it was mistake that I did not mentioned that it was during normatl build of Swift on Linux:
utils/build-script --preset=buildbot_linux install_destdir=/mnt/swift/gentoo installable_package=/mnt/swift/gentoo/swift.tar.gz

I did not try to build libdispatch separatly.

@swift-ci
Copy link
Author

Comment by Vladislav Dembskiy (JIRA)

Linux ved-hp-gentoo 4.4.39-gentoo #1 SMP Mon Dec 26 21:22:33 MSK 2016 x86_64 Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz GenuineIntel GNU/Linux

@swift-ci
Copy link
Author

Comment by David Grove (JIRA)

Could you check to see if you have a properly checked-out libkqueue in swift-corelib-libdispatch/libkqueue (there should be files in the directory)? If the directory is empty, it means the submodule checkout didn't happen.

When I use swift/utils/update-checkout --clone-with-ssh to clone all of the swift git repositories for a fresh checkout, it does the git submodule checkout correctly for libkqueue and libpwq, but maybe that didn't work for you for some reason. For example, if you did the git clones manually, you may have not given the right command line arguments to recurse into submodules.

(%) ./utils/update-checkout --clone-with-ssh
.....many lines ommitted...

  • git clone --recursive git@github.com:apple/swift-corelibs-libdispatch.git swift-corelibs-libdispatch
    Submodule 'libkqueue' (https://github.com/mheily/libkqueue.git) registered for path 'libkqueue'
    Submodule 'libpwq' (https://github.com/mheily/libpwq.git) registered for path 'libpwq'
    Submodule path 'libkqueue': checked out '1281e0460f086503d524b5cbaed603c771435376'
    Submodule path 'libpwq': checked out '18437d2be372f4422b207ec6442c8caf7974025d'
    Cloning into 'swift-corelibs-libdispatch'...
    Cloning into 'libkqueue'...
    Cloning into 'libpwq'...
    .....more lines...

@swift-ci
Copy link
Author

Comment by Vladislav Dembskiy (JIRA)

I usually do
git clone https://github.com/apple/swift.git
./swift/utils/update-checkout --clone

and during update-checkout I saw:
.....
b"Cloning into 'cmark'...\n"
/mnt/swift/swift-source

I just run fresh git clone and update-checkout and in the /mnt/swift/swift-source/swift-corelibs-libdispatch/libkqueue folder I see the following files:
ved-hp-gentoo libkqueue # ls -al
total 96
drwxr-xr-x 7 root root 4096 Jan 28 14:59 .
drwxr-xr-x 18 root root 4096 Jan 28 14:59 ..
rw-rr- 1 root root 34 Jan 28 14:59 .git
rw-rr- 1 root root 264 Jan 28 14:59 .gitignore
rw-rr- 1 root root 2479 Jan 28 14:59 BUGS
rw-rr- 1 root root 5091 Jan 28 14:59 CMakeLists.txt
rw-rr- 1 root root 7944 Jan 28 14:59 ChangeLog
rw-rr- 1 root root 2089 Jan 28 14:59 LICENSE
rw-rr- 1 root root 2100 Jan 28 14:59 README.md
rw-rr- 1 root root 669 Jan 28 14:59 TODO
rw-rr- 1 root root 3044 Jan 28 14:59 Vagrantfile
rw-rr- 1 root root 260 Jan 28 14:59 config.h.in
drwxr-xr-x 3 root root 4096 Jan 28 14:59 include
drwxr-xr-x 2 root root 4096 Jan 28 14:59 kern
drwxr-xr-x 2 root root 4096 Jan 28 14:59 kqlite
rw-rr- 1 root root 14305 Jan 28 14:59 kqueue.2
rw-rr- 1 root root 332 Jan 28 14:59 libkqueue.pc.in
drwxr-xr-x 7 root root 4096 Jan 28 14:59 src
drwxr-xr-x 5 root root 4096 Jan 28 14:59 test
ved-hp-gentoo libkqueue #

@swift-ci
Copy link
Author

Comment by David Grove (JIRA)

libdispatch building of embedded libkqueue was broken by an upstream change to libkqueue that I pulled into libdispatch last week without realizing all the implications. Submitted #207 to drop back to most recent libkqueue version that does not have the problematic change to the build system.

@swift-ci
Copy link
Author

swift-ci commented Feb 1, 2017

Comment by David Grove (JIRA)

PR 207 to revert back to an older version of libkqueue should fix this problem (it does for me). If not, let me know.

@swift-ci
Copy link
Author

Comment by Vladislav Dembskiy (JIRA)

Hello David,
Today I did fresh checkout and run standard installation script:

utils/build-script --preset=buildbot_linux install_destdir=/mnt/swift/lfs installable_package=/mnt/swift/lfs/swift-lfs.tar.gz
First error I have got during swift compilation: "Block.h" not found. I did created the issue https://bugs.swift.org/browse/SR-3919 and use the following workaround:
Make symbolic link from swift-source/compiler-rt/lib/BlocksRuntime/Block.h to /usr/include
Then I have got another error during building libdispatch:
[36/218] Linking CXX shared library lib/libsourcekitdInProc.so
FAILED: lib/libsourcekitdInProc.so
: && /usr/bin/clang++ -fPIC -fno-stack-protector -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -Werror=date-time -std=c++11 -fcolor-diagnostics -ffunction-sections -fdata-sections -Wdocumentation -Wimplicit-fallthrough -Wunreachable-code -Woverloaded-virtual -O3 -target x86_64-unknown-linux-gnu -lpthread -latomic -ldl -fuse-ld=gold -lBlocksRuntime -shared -Wl,-soname,libsourcekitdInProc.so -o lib/libsourcekitdInProc.so ....
....
... /usr/lib/libuuid.so /mnt/swift/swift-source/build/buildbot_linux/llvm-linux-x86_64/./lib/libclangRewrite.a /mnt/swift/swift-source/build/buildbot_linux/llvm-linux-x86_64/./lib/libclangBasic.a /mnt/swift/swift-source/build/buildbot_linux/libdispatch-linux-x86_64/src/.libs/libdispatch.so && :
/usr/bin/ld.gold: error: cannot find -lBlocksRuntime
/usr/bin/ld.gold: error: cannot find -lBlocksRuntime
/usr/bin/ld.gold: error: cannot find -lBlocksRuntime
clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation)
[39/218] Building CXX object stdlib/public/runtime/CMakeFiles/swiftRuntime-linux-x86_64.dir/Demangle.cpp.o
ninja: build stopped: subcommand failed.
I have no idea about workaround. I believe that libBlocksRuntime should be created during compiler-rt compilation to be used in future steps. You see, not every Linux distribution includes libblocksruntime-dev. Neither Gentoo nor LFS/BLFS.

@swift-ci
Copy link
Author

Comment by Vladislav Dembskiy (JIRA)

Sorry. Incorrect place.

@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

1 participant