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
Linking globals named 'OBJC_CLASS_$_GatewayApiLong': symbol multiply defined! #4238
Comments
Hi! Thanks for reporting this! This doesn't immediately ring a bell 🤔 However I'm not sure I understand what you mean by "Our schema has no scalar Long" - if the In any case if possible, it would help a lot if you could share a project so that we can reproduce and investigate this (if this can't be shared publicly feel free to send it to benoit.lubek@apollographql.com) 🙏 |
hi, yes sorry it is actually declared i missed it before. In the header file generated i can see that interface (GatewayApiLong) is actually generated twice - just have to check with the org what i can share. so i'll get back soon. thanks for the quick response. |
Thanks! Are you in a multi-module setup by any chance (wondering if it could be a type clash). |
Each schema is in it's own kmp module. The other module is very simple - it compiles fine and I can use it in the ios app. This gateway_api module has the bulk of the operations though. |
in the generated GatewayApi.h the conflicting interfaces are:
and
So possibly the declared
i don't know if that helps - still checking about the schema but it might take a few days .. sorry |
Ooh good catch, yes this is probably the culprit. Can you try to rename the By the way, I noticed above you showed part of your schema in json, but you can convert it to SDL instead, which is more user-friendly: ./gradlew convertApolloSchema --from=src/main/graphql/schema.json --to=src/main/graphql/schema.graphqls |
It a corporate schema. So company wide. Probably you might need to change the namespaciing a bit? It's not urgent tho. Possibly the numerical interfaces could be |
Eg
|
In this PR, we're adding an (experimental) # In a new file named extra.graphqls, next to your schema.graphqls
extend scalar Long @targetName(name: "GatewayApiLong") In the meantime, you can still rename the |
yes looks like that should work. I'm not sure how common it is for users to declare a scalar type with a name the same as a kotlin type (Integer, Long, Char, etc). I guess this would work for all those cases though. when do you think it would be released? it not really urgent atm though. as we are just testing things out. |
The |
on nice ... i'll give it a whirl |
So i am trying this out. I have got the I have
but it shows errors:
Wondering if you have any suggestions for checking it? |
Thanks for trying it out! Just making sure, are these messages you're seeing in the IDE? It's possible the directive is not known to the GraphQL plugin, so it highlights it as an error, but it will still compile OK. You can have a look at the generated code which should be in the |
it still the same error - so looks like it not getting picked up for some reason
the generated
|
Hmm this is odd indeed. The class should be named |
@sentinelweb anything else we can help with here? |
sorry i missed you message - i couldn't get this to work for our use case, i cleaned and rebuilt, etc - but luckily for us the offending Long scalar declaration was move to another module so the conflict disappeared. |
@BoD @martinbonnin I am seeing this issue in my Multiplatform project on the latest version of Apollo, even with the |
Hi @allenwhite. If you added the |
@BoD Thanks for getting back to me. Yeah I checked, I see |
@allenwhite Just to be sure: which version of Apollo are you on? Is the |
@BoD I initially saw on an earlier version of Apollo, and updated to the latest (3.8.0) but still saw the issue. And yupp, I have that file right next to the schema file. |
@allenwhite Would it be possible for you to provide a minimal barebones version of your project so we can have a look? (If this can't be public, you can share it to my email: benoit.lubek@apollographql.com) |
Just shot something over to you @BoD . Thanks! |
Thanks a lot! This helped identify the issue. For the posterity in case other people have the same issue: Apollo was explicitly configured with |
Summary
I am testing using the Kotlin Multiplatform version of Apollo. Our schema works fine when compiling for android but we are getting the above error when building iOS library :
./gradlew clean gateway_api:iosX64MainBinaries
Version
3.3.2
Description
Add context about the problem here. How it happened and how to reproduce it:
Our schema has no
scalar Long
declaration but there are quite a few places that use an adhoc scalar Long definition in fields (e.g. below)I am guessing this is the cause of the above error so I wanted to check if simply declaring a
scalar Long
in the schema and using it for fields would be the correct solution? As it might quite a big change for our organization.Or is there some compilation flag i could add that would ignore this error?
i have also tried adding
codegenModels.set("responseBased")
and modifying our code to use this codegen structure - but i ended up getting the same error after the change.This is the error stacktrace when executing
./gradlew clean gateway_api:iosX64MainBinaries
- same forpod install
in XCode.The text was updated successfully, but these errors were encountered: