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-6212] generate-xcodeproj C projects don't build for .pc dependencies #4932

Closed
swift-ci opened this issue Oct 24, 2017 · 3 comments
Closed
Labels

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-6212
Radar None
Original Reporter gmilos (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Swift 4 release.

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

md5: 6cbdb67f13de7a0d36e0d8a49f65b5c1

Issue Description:

If a (SwiftPM packaged) C project has dependencies on pkgConfig style SwiftPM packages, it builds fine from command line, but fails from Xcode (after generating the proj file with `swift package generate-xcodeproj`)

@swift-ci
Copy link
Contributor Author

Comment by Gregor Milos (Grzegorz Miłoś) (JIRA)

I've added minimal repro, that shows the issue. Here is what happens for me:

gmilos:/tmp/repro/SR-6212$
swift build
Fetching /private/tmp/repro/LibUV
Cloning /private/tmp/repro/LibUV
Resolving /private/tmp/repro/LibUV at 0.0.1
Compile SR-6212 src/main.c
Linking ./.build/x86_64-apple-macosx10.10/debug/SR-6212
gmilos:/tmp/repro/SR-6212$
./.build/x86_64-apple-macosx10.10/debug/SR-6212
libuv version: 1.11.0

gmilos:/tmp/repro/SR-6212$
swift package generate-xcodeproj
generated: ./SR-6212.xcodeproj
 
gmilos:/tmp/repro/SR-6212$
xcodebuild
=== BUILD TARGET SR-6212 OF PROJECT SR-6212 WITH THE DEFAULT CONFIGURATION (Debug) ===Check dependenciesWrite auxiliary files
/bin/mkdir -p /tmp/repro/SR-6212/build/SR-6212.build/Debug/SR-6212.build/Objects-normal/x86_64
write-file /tmp/repro/SR-6212/build/SR-6212.build/Debug/SR-6212.build/Objects-normal/x86_64/SR-6212.LinkFileListCompileC build/SR-6212.build/Debug/SR-6212.build/Objects-normal/x86_64/main.o Sources/SR-6212/src/main.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
 cd /tmp/repro/SR-6212
 export LANG=en_US.US-ASCII
 /Applications/Xcode.real.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch x86_64 -fmessage-length=270 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -isysroot /Applications/Xcode.real.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -mmacosx-version-min=10.10 -g -fvisibility=hidden -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -I/tmp/repro/SR-6212/build/Debug/include -I/tmp/repro/SR-6212/Sources/SR-6212/include -I/tmp/repro/SR-6212/.build/checkouts/LibUV-3003940377571171115 -I/tmp/repro/SR-6212/build/SR-6212.build/Debug/SR-6212.build/DerivedSources/x86_64 -I/tmp/repro/SR-6212/build/SR-6212.build/Debug/SR-6212.build/DerivedSources -F/tmp/repro/SR-6212/build/Debug -F/Applications/Xcode.real.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -MMD -MT dependencies -MF /tmp/repro/SR-6212/build/SR-6212.build/Debug/SR-6212.build/Objects-normal/x86_64/main.d --serialize-diagnostics /tmp/repro/SR-6212/build/SR-6212.build/Debug/SR-6212.build/Objects-normal/x86_64/main.dia -c /tmp/repro/SR-6212/Sources/SR-6212/src/main.c -o /tmp/repro/SR-6212/build/SR-6212.build/Debug/SR-6212.build/Objects-normal/x86_64/main.o
/tmp/repro/SR-6212/Sources/SR-6212/src/main.c:2:10: fatal error: 'uv.h' file not found
#include <uv.h>
 ^~~~~~
1 error generated.** BUILD FAILED **
The following build commands failed:
 CompileC build/SR-6212.build/Debug/SR-6212.build/Objects-normal/x86_64/main.o Sources/SR-6212/src/main.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

@swift-ci
Copy link
Contributor Author

Comment by Gregor Milos (Grzegorz Miłoś) (JIRA)

The failure seems to be due to the fact that in generated project.pbxproj we have:

OTHER_SWIFT_FLAGS = (
"$(inherited)",
"-I/usr/local/Cellar/libuv/1.11.0/include",
);

What we really want is HEADERS_SEARCH_PATH instead.

@ankitspd
Copy link
Member

ankitspd commented Nov 1, 2017

1e9457b

@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