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

building for iOS Simulator, but linking in dylib built for macOS, file '/usr/local/Cellar/gmp/6.2.0/lib/libgmp.dylib' for architecture x86_64 #1

Open
ghost opened this issue Nov 13, 2020 · 4 comments

Comments

@ghost
Copy link

ghost commented Nov 13, 2020

I am very glad that I got this great library for homomorphic encryption in my app. But I would like to inform that i am getting compilation issue while running the project on simulator. below are the details. Any suggestion would be appreciated.

Xcode version: 11.3.1
iOS version: 13.0
Swift version: 5.0 as well as 4.2

d /Users/anusuya_p/Library/Developer/Xcode/DerivedData/VisionSample-gisduavvviadxadozdzqqmpaaxku/Build/Products/Debug-iphonesimulator/VisionSample.app/VisionSample normal (in target 'VisionSample' from project 'VisionSample')

cd /Users/anusuya_p/Downloads/VisionSample

/Users/anusuya_p/Downloads/Xcode_12.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-ios13.0-simulator -isysroot /Users/anusuya_p/Downloads/Xcode_12.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.1.sdk -L/Users/anusuya_p/Library/Developer/Xcode/DerivedData/VisionSample-gisduavvviadxadozdzqqmpaaxku/Build/Products/Debug-iphonesimulator -F/Users/anusuya_p/Library/Developer/Xcode/DerivedData/VisionSample-gisduavvviadxadozdzqqmpaaxku/Build/Products/Debug-iphonesimulator -filelist /Users/anusuya_p/Library/Developer/Xcode/DerivedData/VisionSample-gisduavvviadxadozdzqqmpaaxku/Build/Intermediates.noindex/VisionSample.build/Debug-iphonesimulator/VisionSample.build/Objects-normal/x86_64/VisionSample.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/anusuya_p/Library/Developer/Xcode/DerivedData/VisionSample-gisduavvviadxadozdzqqmpaaxku/Build/Intermediates.noindex/VisionSample.build/Debug-iphonesimulator/VisionSample.build/Objects-normal/x86_64/VisionSample_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -L/Users/anusuya_p/Downloads/Xcode_12.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/anusuya_p/Library/Developer/Xcode/DerivedData/VisionSample-gisduavvviadxadozdzqqmpaaxku/Build/Intermediates.noindex/VisionSample.build/Debug-iphonesimulator/VisionSample.build/Objects-normal/x86_64/VisionSample.swiftmodule -L/usr/local/Cellar/gmp/6.2.0/lib -lgmp -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/anusuya_p/Library/Developer/Xcode/DerivedData/VisionSample-gisduavvviadxadozdzqqmpaaxku/Build/Intermediates.noindex/VisionSample.build/Debug-iphonesimulator/VisionSample.build/VisionSample.app-Simulated.xcent /Users/anusuya_p/Library/Developer/Xcode/DerivedData/VisionSample-gisduavvviadxadozdzqqmpaaxku/Build/Products/Debug-iphonesimulator/PackageFrameworks/SipHash.framework/SipHash -Xlinker -dependency_info -Xlinker /Users/anusuya_p/Library/Developer/Xcode/DerivedData/VisionSample-gisduavvviadxadozdzqqmpaaxku/Build/Intermediates.noindex/VisionSample.build/Debug-iphonesimulator/VisionSample.build/Objects-normal/x86_64/VisionSample_dependency_info.dat -o /Users/anusuya_p/Library/Developer/Xcode/DerivedData/VisionSample-gisduavvviadxadozdzqqmpaaxku/Build/Products/Debug-iphonesimulator/VisionSample.app/VisionSample -Xlinker -add_ast_path -Xlinker /Users/anusuya_p/Library/Developer/Xcode/DerivedData/VisionSample-gisduavvviadxadozdzqqmpaaxku/Build/Intermediates.noindex/SwiftPaillier.build/Debug-iphonesimulator/SwiftPaillier.build/Objects-normal/x86_64/SwiftPaillier.swiftmodule -Xlinker -add_ast_path -Xlinker /Users/anusuya_p/Library/Developer/Xcode/DerivedData/VisionSample-gisduavvviadxadozdzqqmpaaxku/Build/Intermediates.noindex/BigInt.build/Debug-iphonesimulator/BigInt.build/Objects-normal/x86_64/BigInt.swiftmodule -Xlinker -add_ast_path -Xlinker /Users/anusuya_p/Library/Developer/Xcode/DerivedData/VisionSample-gisduavvviadxadozdzqqmpaaxku/Build/Intermediates.noindex/Bignum.build/Debug-iphonesimulator/Bignum.build/Objects-normal/x86_64/Bignum.swiftmodule

ld: building for iOS Simulator, but linking in dylib built for macOS, file '/usr/local/Cellar/gmp/6.2.0/lib/libgmp.dylib' for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

@code28
Copy link
Owner

code28 commented Nov 16, 2020

I'm happy to hear, that the library is useful for you. Actually, I don't have much time to look into this issue right now, but it seems, that the GMP library can't be linked. You should be able to easily remove GMP from this library and use Bignum only, which is pure Swift, so there shouldn't be any linking problem.

@ghost
Copy link
Author

ghost commented Nov 17, 2020

Thanks for the reply. you mean OpenSSL-based Swift big number library? Do you have any quick reference to refer and make the things work? I am looking for the details how to remove GMP from this library and use the BigInt ? could you please help me on this. Thank you!

Screenshot 2020-11-17 at 8 31 56 PM

@code28
Copy link
Owner

code28 commented Nov 20, 2020

To remove GMP, you have to remove the dependency BignumGMP from Package.swift (line 14 and in line 19). Then you have to remove it from Paillier.swift: I'm not 100% sure, but I think it should be possible to replace line 8 with typealias Bignum = BigUInt.
Let me know, if this works.

@ghost
Copy link
Author

ghost commented Nov 20, 2020

Thanks @code28 for the details. I made necessary changes and made it up and running on iOS application by removing the bigNum package. I will make it available to the public sometimes later as I am running with ton of task on my plate. When you have some time you can quick go through the git and share your comments once I have pushed the code.

Thanks again.

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

No branches or pull requests

1 participant