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-3877] Compile LinuxMain.swift as a swift target #5114

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

[SR-3877] Compile LinuxMain.swift as a swift target #5114

swift-ci opened this issue Feb 6, 2017 · 15 comments
Labels

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Feb 6, 2017

Previous ID SR-3877
Radar None
Original Reporter amraboelela (JIRA User)
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: a8410044f75f6c6ff25b74a269d9e8f9

Issue Description:

This was working fine on December 2016, now in my swift module https://github/com/amraboelela/SwiftLevelDB which import C module: https://github/com/amraboelela/CLevelDB

When I do "swift test" in SwiftLevelDB I get error:
Fetching https://github.com/amraboelela/CLevelDB
Cloning https://github.com/amraboelela/CLevelDB
Resolving https://github.com/amraboelela/CLevelDB at 1.0.0
Compile Swift Module 'SwiftLevelDB' (4 sources)
Compile Swift Module 'SwiftLevelDBTests' (2 sources)
Linking ./.build/debug/SwiftLevelDBPackageTests.xctest
<unknown>:0: error: missing required module 'CLevelDB'
<unknown>:0: error: build had 1 command failures
error: exit(1): /home/amr/swift/toolchains/swift-toolchain/usr/bin/swift-build-tool -f /home/amr/rengo/SwiftLevelDB/.build/debug.yaml test

@ankitspd
Copy link
Member

ankitspd commented Feb 7, 2017

What snapshot is this? Could be this a dupe of https://bugs.swift.org/browse/SR-3816 ?

PS: top level modulemap in https://github.com/amraboelela/CLevelDB makes it a system package

@swift-ci
Copy link
Contributor Author

swift-ci commented Feb 7, 2017

Comment by Amr Aboelela (JIRA)

I don't use a snapshot, I make a daily build from source using "./swift/utils/build-toolchain local.swift" script, it takes 13 hours 😃

Is it wrong that it is a system package?

I didn't understand the relation with SR-3816 ? am I missing something in the modulemap ?

@ankitspd
Copy link
Member

ankitspd commented Feb 7, 2017

can you tell me the revision of swiftpm that you built?
no its not wrong, just that CLevelDB needs to be built manually and installed before it can be linked. (importing works fine because the headers can be seen)

@swift-ci
Copy link
Contributor Author

swift-ci commented Feb 7, 2017

Comment by Amr Aboelela (JIRA)

It is already built and installed:

/usr/lib$ ls -l
...
lrwxrwxrwx 1 root root 19 Feb 6 10:48 libCLevelDB.so -> libCLevelDB.so.1.19
-rwxr-xr-x 1 root root 455K Feb 6 10:48 libCLevelDB.so.1.19
lrwxrwxrwx 1 root root 19 Feb 6 10:48 libCLevelDB.so.1 -> libCLevelDB.so.1.19

Also I am using a toolchain which is build just yesterday, which means it should include this PR #927 already, but I am still getting the same error.

@swift-ci
Copy link
Contributor Author

swift-ci commented Feb 7, 2017

Comment by Amr Aboelela (JIRA)

This is the swiftpm I have:

swiftpm$ git log
commit fad1b0c
Author: Ankit Aggarwal <ankit_aggarwal@apple.com>
Date: Sun Feb 5 12:17:57 2017 +0530

[PackageModel] Minor cleanup in Product

commit a0e044a
Merge: b25030a cb70454
Author: swift-ci <swift-ci@users.noreply.github.com>
Date: Sat Feb 4 09:08:03 2017 -0800

Merge pull request #924 from Steveybrown/process-thread-safe

commit cb70454
Author: Stephen Brown <steveybrown@gmail.com>
Date: Mon Jan 30 20:57:31 2017 +0000

[Utility] Added thread safety to Process.

@swift-ci
Copy link
Contributor Author

swift-ci commented Feb 7, 2017

Comment by Amr Aboelela (JIRA)

Oh, so it was you who made the last commit 😉

@ankitspd
Copy link
Member

ankitspd commented Feb 7, 2017

I can't reproduce this on current master but I can investigate this if you provide revision of swiftpm that you built. Otherwise, can you try using a trunk or swift-3.1 toolchain from swift.org and see if it still reproduces for you?

@ankitspd
Copy link
Member

ankitspd commented Feb 7, 2017

Thanks, I'll check. was this on macOS or linux?

@swift-ci
Copy link
Contributor Author

swift-ci commented Feb 7, 2017

Comment by Amr Aboelela (JIRA)

I am already using the latest thing from master. It is in Linux Ubuntu 16.04

@ankitspd
Copy link
Member

ankitspd commented Feb 7, 2017

ah right

@ankitspd
Copy link
Member

ankitspd commented Feb 7, 2017

ok I see, this works fine on macOS (on which I initially tested) but not on linux because we're passing LinuxMain.swift in link line which makes it want to see all modules again.
We need to compile LinuxMain as a swift target and then include its object while linking.

@ankitspd
Copy link
Member

ankitspd commented Feb 7, 2017

This should fix it: #936

Thanks for reporting!

@swift-ci
Copy link
Contributor Author

swift-ci commented Feb 7, 2017

Comment by Amr Aboelela (JIRA)

Ok thanks. But why was it working fine till Dec 2016 ?

@ankitspd
Copy link
Member

ankitspd commented Feb 7, 2017

The Build module was rewritten to be more testable and maintainable, this is a usecase we don't have any test for but now I'll add one so it doesn't regress 🙂

@swift-ci
Copy link
Contributor Author

Comment by Amr Aboelela (JIRA)

I am finally able to verify the fix, thank you.

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

No branches or pull requests

2 participants