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-3913] The test target of the project generated by swift package generate-xcodeproj has incorrect LD_RUNPATH_SEARCH_PATHS which is necessary for running the test on the iPhone. #5112

Closed
norio-nomura opened this issue Feb 10, 2017 · 2 comments
Labels

Comments

@norio-nomura
Copy link
Contributor

Previous ID SR-3913
Radar None
Original Reporter @norio-nomura
Type Bug
Status Resolved
Resolution Done
Environment

swift-3.1-DEVELOPMENT-SNAPSHOT-2017-02-08-a

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 8fd656c3cbc0e446137205265c532035

Issue Description:

Running test on iPhone fails by error `Library not loaded: @rpath/libswiftCore.dylib`.

Reproducing steps:

12:45:57  mkdir Example12:46:00  cd Example12:46:07  git init
Initialized empty Git repository in /Users/norio/github/Example/.git/
➜  12:46:10 git:(master) TOOLCHAINS=org.swift.3120170208a swift package init --type library
Creating library package: Example
Creating Package.swift
Creating .gitignore
Creating Sources/
Creating Sources/Example.swift
Creating Tests/
Creating Tests/LinuxMain.swift
Creating Tests/ExampleTests/
Creating Tests/ExampleTests/ExampleTests.swift12:46:16 git:(master) ✗ TOOLCHAINS=org.swift.3120170208a swift package generate-xcodeproj
generated: ./Example.xcodeproj12:46:21 git:(master) ✗ TOOLCHAINS=org.swift.3120170208a xcodebuild -scheme Example -sdk iphonesimulator -destination "name=iPhone SE" test
Build settings from command line:
    SDKROOT = iphonesimulator10.2
    TOOLCHAINS = org.swift.3120170208a2017-02-10 12:47:14.304 xctest[54845:901717] The bundleExampleTestscouldnt be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2017-02-10 12:47:14.305 xctest[54845:901717] (dlopen_preflight(/Users/norio/Library/Developer/Xcode/DerivedData/Example-bygfgjtvpvxtugcpfmrnommmzxoy/Build/Products/Debug-iphonesimulator/ExampleTests.xctest/ExampleTests): Library not loaded: @rpath/libswiftCore.dylib
  Referenced from: /Users/norio/Library/Developer/Xcode/DerivedData/Example-bygfgjtvpvxtugcpfmrnommmzxoy/Build/Products/Debug-iphonesimulator/ExampleTests.xctest/ExampleTests
  Reason: image not found)
2017-02-10 12:47:14.316 xcodebuild[54741:901323] Error Domain=IDETestOperationsObserverErrorDomain Code=5 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted}

Testing failed:
    Test target ExampleTests encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted)
** TEST FAILED **

TOOLCHAINS=org.swift.3120170208a xcodebuild -scheme Example -sdk  -destinatio  6.71s user 3.79s system 97% cpu 10.807 total12:59:14 git:(master) ✗ grep -B 1 -A 2 LD_RUNPATH_SEARCH_PATHS Example.xcodeproj/project.pbxproj
            INFOPLIST_FILE = "Example.xcodeproj/Example_Info.plist";
            LD_RUNPATH_SEARCH_PATHS = (
               "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
            );
--
--
            INFOPLIST_FILE = "Example.xcodeproj/Example_Info.plist";
            LD_RUNPATH_SEARCH_PATHS = (
               "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
            );
--
--
            INFOPLIST_FILE = "Example.xcodeproj/ExampleTests_Info.plist";
            LD_RUNPATH_SEARCH_PATHS = (
               "@loader_path/../Frameworks",
            );
--
--
            INFOPLIST_FILE = "Example.xcodeproj/ExampleTests_Info.plist";
            LD_RUNPATH_SEARCH_PATHS = (
               "@loader_path/../Frameworks",
            );

The last two search results are those of the test target, and `@loader_path/Frameworks` is required in `LD_RUNPATH_SEARCH_PATHS` to run on iPhone.

@norio-nomura
Copy link
Contributor Author

Workaround is "Manually adding `@loader_path/Frameworks` to `LD_RUNPATH_SEARCH_PATHS`"

@norio-nomura
Copy link
Contributor Author

Opened: #946

@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

1 participant