Skip to content

Properly compute resource folder when linking statically #33168

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
merged 1 commit into from
Aug 4, 2020

Conversation

drexin
Copy link
Contributor

@drexin drexin commented Jul 28, 2020

  • deduplicate the logic to compute the resource folder
  • install headers and module files in shared and static resource folders
  • forward -static flag when calling swiftc with -print-target-info

@drexin drexin requested a review from DougGregor July 28, 2020 22:03
@drexin
Copy link
Contributor Author

drexin commented Jul 28, 2020

@swift-ci test

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

Could you please add a test for the driver path computation?

@drexin drexin force-pushed the wip-fix-resource-folder branch 2 times, most recently from ff6ad6f to 03c9b00 Compare July 28, 2020 22:23
@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 06705931e0e9d5db9c548665b9d9193c8ea98f11

@drexin drexin force-pushed the wip-fix-resource-folder branch 2 times, most recently from bb45c3f to fdf9d32 Compare July 28, 2020 23:48
@drexin
Copy link
Contributor Author

drexin commented Jul 28, 2020

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 06705931e0e9d5db9c548665b9d9193c8ea98f11

@drexin
Copy link
Contributor Author

drexin commented Jul 28, 2020

@swift-ci test

@drexin drexin force-pushed the wip-fix-resource-folder branch from fdf9d32 to 2845806 Compare July 28, 2020 23:55
@drexin
Copy link
Contributor Author

drexin commented Jul 28, 2020

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 2845806afcc093707bde8620acd9a707876dab22

@drexin drexin force-pushed the wip-fix-resource-folder branch from 2845806 to 9da99a1 Compare July 29, 2020 00:55
@drexin
Copy link
Contributor Author

drexin commented Jul 29, 2020

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 06705931e0e9d5db9c548665b9d9193c8ea98f11

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 9da99a12d4ff74ebff0703c28fad7d1dd2104e86

@drexin drexin force-pushed the wip-fix-resource-folder branch from 9da99a1 to 6309e01 Compare July 29, 2020 04:48
@drexin
Copy link
Contributor Author

drexin commented Jul 29, 2020

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 6309e0102c7f7b900d164d9cb5987f1108470598

@drexin drexin force-pushed the wip-fix-resource-folder branch from 6309e01 to 3eeb03d Compare July 29, 2020 16:54
@drexin
Copy link
Contributor Author

drexin commented Jul 29, 2020

@swift-ci test

@drexin
Copy link
Contributor Author

drexin commented Jul 29, 2020

@swift-ci test windows

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 3eeb03d0387918e887143510e5d5dbc75142b1d7

@drexin drexin force-pushed the wip-fix-resource-folder branch from 3eeb03d to f8ccbdd Compare July 29, 2020 18:01
@drexin
Copy link
Contributor Author

drexin commented Jul 29, 2020

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - f8ccbddd3dbb5e2cac9cb46a9c6aee173035b877

@drexin drexin force-pushed the wip-fix-resource-folder branch from f8ccbdd to 51c96fb Compare July 29, 2020 20:43
@drexin
Copy link
Contributor Author

drexin commented Jul 30, 2020

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 9daedd580e3c312d2cb4b3c69356a83e62351f1e

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 9daedd580e3c312d2cb4b3c69356a83e62351f1e

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 9daedd580e3c312d2cb4b3c69356a83e62351f1e

@drexin
Copy link
Contributor Author

drexin commented Jul 30, 2020

@swift-ci test linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - c7a4a9bee0284ceb7371bdf1182163d18f199c0c

@drexin drexin force-pushed the wip-fix-resource-folder branch 2 times, most recently from a3c4f72 to 18c4354 Compare July 30, 2020 15:05
@drexin
Copy link
Contributor Author

drexin commented Jul 30, 2020

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - c7a4a9bee0284ceb7371bdf1182163d18f199c0c

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - c7a4a9bee0284ceb7371bdf1182163d18f199c0c

@drexin drexin force-pushed the wip-fix-resource-folder branch from 18c4354 to 6c6dd27 Compare July 30, 2020 15:14
@drexin
Copy link
Contributor Author

drexin commented Jul 30, 2020

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 6c6dd2703e7960c611d4b9db038fa877c4e25865

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 6c6dd2703e7960c611d4b9db038fa877c4e25865

@drexin drexin force-pushed the wip-fix-resource-folder branch from 6c6dd27 to e82c012 Compare July 30, 2020 17:33
@drexin
Copy link
Contributor Author

drexin commented Jul 30, 2020

@swift-ci test windows

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 6c6dd2703e7960c611d4b9db038fa877c4e25865

@drexin
Copy link
Contributor Author

drexin commented Jul 30, 2020

@swift-ci test windows

- deduplicate the logic to compute the resource folder
- install headers and module files in shared and static resource folders
- forward -static flag when calling swiftc with -print-target-info
@drexin drexin force-pushed the wip-fix-resource-folder branch from e82c012 to 0850436 Compare July 30, 2020 22:07
@drexin
Copy link
Contributor Author

drexin commented Jul 30, 2020

@swift-ci smoke test

@drexin
Copy link
Contributor Author

drexin commented Jul 30, 2020

@swift-ci smoke test windows

1 similar comment
@drexin
Copy link
Contributor Author

drexin commented Jul 30, 2020

@swift-ci smoke test windows

if (const Arg *A = args.getLastArg(options::OPT_resource_dir)) {
StringRef value = A->getValue();
resourceDirPath.append(value.begin(), value.end());
} else if (!getTriple().isOSDarwin() && args.hasArg(options::OPT_sdk)) {
StringRef value = args.getLastArg(options::OPT_sdk)->getValue();
resourceDirPath.append(value.begin(), value.end());
llvm::sys::path::append(resourceDirPath, "usr", "lib",
shared ? "swift" : "swift_static");
llvm::sys::path::append(resourceDirPath, "usr");
Copy link
Member

Choose a reason for hiding this comment

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

Why are we adding <resource-dir>/usr now?

Copy link
Contributor Author

@drexin drexin Aug 4, 2020

Choose a reason for hiding this comment

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

We are using the SDK root here as opposed to the path relative to the executable. In the executable case we get something like $PATH/bin/swiftc and remove the bin/swiftc part from it and append lib/swift[_static]. The SDK path starts one level above that, so we have to add usr only in this case.

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.

4 participants