Skip to content

[stubs] include unistd.h to repair swift-threading-package=none build #59365

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

Merged

Conversation

kateinoigakukun
Copy link
Member

syscall and read were missing when swift-threading-package=none since #59287 has been merged.
It results build failure with such configuration: e.g. https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-20.04-webassembly/407/console

/home/buildbot/jenkins/workspace/oss-swift-RA-linux-ubuntu-20.04-webassembly/swift/stdlib/public/stubs/Random.cpp:93:9: error: use of undeclared identifier 'syscall'
      !(syscall(__NR_getrandom, nullptr, 0, 0) == -1 && errno == ENOSYS);
        ^
/home/buildbot/jenkins/workspace/oss-swift-RA-linux-ubuntu-20.04-webassembly/swift/stdlib/public/stubs/Random.cpp:96:35: error: use of undeclared identifier 'syscall'
      actual_nbytes = WHILE_EINTR(syscall(__NR_getrandom, buf, nbytes, 0));
                                  ^
/home/buildbot/jenkins/workspace/oss-swift-RA-linux-ubuntu-20.04-webassembly/swift/stdlib/public/stubs/Random.cpp:96:35: error: use of undeclared identifier 'syscall'
/home/buildbot/jenkins/workspace/oss-swift-RA-linux-ubuntu-20.04-webassembly/swift/stdlib/public/stubs/Random.cpp:96:35: error: use of undeclared identifier 'syscall'
/home/buildbot/jenkins/workspace/oss-swift-RA-linux-ubuntu-20.04-webassembly/swift/stdlib/public/stubs/Random.cpp:114:39: error: use of undeclared identifier 'read'; did you mean '_IO_cookie_io_functions_t::read'?
          actual_nbytes = WHILE_EINTR(read(fd, buf, nbytes));
                                      ^~~~
                                      _IO_cookie_io_functions_t::read

`syscall` and `read` were missing when `swift-threading-package=none`
@kateinoigakukun kateinoigakukun requested a review from al45tair June 10, 2022 14:11
@kateinoigakukun
Copy link
Member Author

@swift-ci Please smoke test

@kateinoigakukun
Copy link
Member Author

preset=buildbot_incremental_linux_crosscompile_wasm
@swift-ci Please test with preset Linux Platform

@3405691582
Copy link
Member

FTR, this is also required for swift-threading-package=pthreads.

@al45tair
Copy link
Contributor

al45tair commented Jun 11, 2022

I think maybe the threading unit tests need a tweak in this case too. There's probably not much point in running them in the swift-threading-package=none case.

@kateinoigakukun
Copy link
Member Author

Yeah, I'll tweak the test later (I don't have enough time right now sorry)

Copy link
Contributor

@al45tair al45tair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a pretty safe change anyway, even without fixing the tests. I'll probably take a look at the test problem tomorrow.

@al45tair al45tair merged commit e60fb30 into swiftlang:main Jun 12, 2022
@kateinoigakukun
Copy link
Member Author

Thank you @al45tair !

@al45tair
Copy link
Contributor

Hopefully #59403 will fix the test problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants