Skip to content

Instantly share code, notes, and snippets.

@migueldeicaza
Last active August 6, 2020 03:59
Show Gist options
  • Save migueldeicaza/f8a18694aa07dd8de871a6ee17e73bf7 to your computer and use it in GitHub Desktop.
Save migueldeicaza/f8a18694aa07dd8de871a6ee17e73bf7 to your computer and use it in GitHub Desktop.

I have a problem with a native library dependency in my project SwiftTerm, the native library dependency is a wrapper for libssh, and I compile this as a .framework which I then reference from SwiftTerm.

The problem is that on the same system where I build the .framework, something makes the build system go poking at the original site where the code was built, and produces this error:

/Users/miguel/cvs/SwiftTerm/SwiftSH.binaries/module.modulemap:1:8: error: redefinition of module 'Libssh2'
module Libssh2 {
       ^
/Users/miguel/cvs/SwiftSH/libssh2/module.modulemap:1:8: note: previously defined here
module Libssh2 {
       ^

The first one is the binary framework that I am using on my project, the second is not referenced in my project, and is the location where I produced the SwiftSH.binaries.

This path seems to be referenced from the .swiftmodule files

The way I have been dealing with this is that I build my binary framework, and then chmod 0 the directory where I built it, to make it inaccessible, and that gets me over the hump.

I must be doing something wrong.

This is the invocation that fails:

    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -merge-modules -emit-module /Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/Objects-normal/x86_64/UIKitSshTerminalView\~partial.swiftmodule /Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/Objects-normal/x86_64/ViewController\~partial.swiftmodule /Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/Objects-normal/x86_64/AppDelegate\~partial.swiftmodule -parse-as-library -sil-merge-partial-modules -disable-diagnostic-passes -disable-sil-perf-optzns -target x86_64-apple-ios13.0-simulator -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk -I /Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Products/Debug-iphonesimulator -F /Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Products/Debug-iphonesimulator -F /Users/miguel/cvs/SwiftTerm/SwiftSH.binaries -enable-testing -g -module-cache-path /Users/miguel/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity\=checked -Onone -D DEBUG -serialize-debugging-options -Xcc -working-directory -Xcc /Users/miguel/cvs/SwiftTerm/TerminalApp -enable-anonymous-context-mangled-names -Xcc -I/Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/iOSTerminal-generated-files.hmap -Xcc -I/Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/iOSTerminal-own-target-headers.hmap -Xcc -I/Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/iOSTerminal-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/iOSTerminal-project-headers.hmap -Xcc -I/Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Products/Debug-iphonesimulator/include -Xcc -isystem -Xcc /Users/miguel/cvs/SwiftTerm/SwiftSH.binaries -Xcc -I/Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/DerivedSources-normal/x86_64 -Xcc -I/Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/DerivedSources/x86_64 -Xcc -I/Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/DerivedSources -Xcc -DDEBUG\=1 -target-sdk-version 14.0 -emit-module-doc-path /Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/Objects-normal/x86_64/iOSTerminal.swiftdoc -emit-module-source-info-path /Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/Objects-normal/x86_64/iOSTerminal.swiftsourceinfo -emit-objc-header-path /Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/Objects-normal/x86_64/iOSTerminal-Swift.h -module-name iOSTerminal -o /Users/miguel/DerivedData/iOSTerminal-axniahgryyeziefrebipgnxeicqi/Build/Intermediates.noindex/iOSTerminal.build/Debug-iphonesimulator/iOSTerminal.build/Objects-normal/x86_64/iOSTerminal.swiftmodule

The directory taht I have to block with chmod is "/cvs/SwiftSH"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment