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

GraphQL doesn't compile on Linux Swift 5.4 #79

Closed
adam-fowler opened this issue May 10, 2021 · 5 comments · Fixed by #80
Closed

GraphQL doesn't compile on Linux Swift 5.4 #79

adam-fowler opened this issue May 10, 2021 · 5 comments · Fixed by #80

Comments

@adam-fowler
Copy link
Contributor

Using Dockerfile

FROM swift:5.4 as build

WORKDIR /build
COPY ./Package.* ./
RUN swift package resolve

# Copy entire repo into container
COPY . .

RUN swift test --enable-test-discovery

I get these errors

#8 8.305 /build/Sources/GraphQL/Map/AnyCoder.swift:2058:22: error: '_cfTypeID' is inaccessible due to 'internal' protection level
#8 8.305         guard number._cfTypeID == CFBooleanGetTypeID() else {
#8 8.305                      ^~~~~~~~~
#8 8.305 Foundation.NSNumber (internal):45:27: note: '_cfTypeID' declared here
#8 8.305     override internal var _cfTypeID: CFTypeID { get }
#8 8.305                           ^
#8 8.305 [148/184] Compiling GraphQL Parser.swift
#8 8.305 /build/Sources/GraphQL/Map/AnyCoder.swift:2058:22: error: '_cfTypeID' is inaccessible due to 'internal' protection level
#8 8.305         guard number._cfTypeID == CFBooleanGetTypeID() else {
#8 8.305                      ^~~~~~~~~
#8 8.305 Foundation.NSNumber (internal):45:27: note: '_cfTypeID' declared here
#8 8.305     override internal var _cfTypeID: CFTypeID { get }
#8 8.305                           ^
#8 8.305 [149/184] Compiling GraphQL Source.swift
#8 8.305 /build/Sources/GraphQL/Map/AnyCoder.swift:2058:22: error: '_cfTypeID' is inaccessible due to 'internal' protection level
#8 8.305         guard number._cfTypeID == CFBooleanGetTypeID() else {
#8 8.305                      ^~~~~~~~~
#8 8.305 Foundation.NSNumber (internal):45:27: note: '_cfTypeID' declared here
#8 8.305     override internal var _cfTypeID: CFTypeID { get }
#8 8.305                           ^
#8 8.305 [150/184] Compiling GraphQL Visitor.swift
#8 8.305 /build/Sources/GraphQL/Map/AnyCoder.swift:2058:22: error: '_cfTypeID' is inaccessible due to 'internal' protection level
...
@alexsteinerde
Copy link
Member

This issue seems to be introduced to the Foundation library with this commit: apple/swift-corelibs-foundation@75f3bac
I'm not sure if it is possible to make this property public again or if there is a workaround.

@alexsteinerde
Copy link
Member

I just saw the official Jira issue for this (https://bugs.swift.org/browse/SR-464). This property is intended to be private. So I think there is no chance in getting this changed back in the Foundation source code.

@adam-fowler
Copy link
Contributor Author

It looks like a lot of this code is based off the JSONEncoder/Decoder from Foundation. The majority of this code (at least in swift-corelibs-foundation) has been rewritten and does not depend on NSNumber anymore. Is it possible to re-write to avoid NSNumber?

@alexsteinerde
Copy link
Member

I created a PR that fixes the build issue for me (I used the Dockerfile provided by you).
Please correct me if my solution is wrong.

If a re-write is possible I don't know. I'm not very familiar with the low level code to answer this question.

@adam-fowler
Copy link
Contributor Author

Yeah looks to fix it. I hadn't thought of using CFGetTypeID.
Removing NSNumber will improve performance of the Coders. But I guess that can be done another time.

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 a pull request may close this issue.

2 participants