Skip to content

XCode 9.0 Beta : Compile Error #664

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

Closed
dinobei opened this issue Jun 8, 2017 · 22 comments
Closed

XCode 9.0 Beta : Compile Error #664

dinobei opened this issue Jun 8, 2017 · 22 comments

Comments

@dinobei
Copy link

dinobei commented Jun 8, 2017

After updating to XCode 9 Beta, the following Compiler Error occurred (SQlite.swift 0.11.2). How can I solve it?
2017-06-08 11 44 23

@dinobei dinobei changed the title XCode 9.0 Beta : Build Error XCode 9.0 Beta : Compile Error Jun 8, 2017
@RLovelett
Copy link

Fully acknowledge that I have no idea what I am doing. But given that it is complaining about files not found I figured it would be worth starting there.

So looking in the app bundles for Xcode 8.3.3 vs Xcode 9.0.0 I found this:

Xcode Version 8.3.3 (8E3004b)

/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/AppleTVOS.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/AppleTVSimulator.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/iPhoneOS.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/iPhoneSimulator.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/MacOSX.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/WatchOS.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/WatchSimulator.sdk/usr/include/sys/_symbol_aliasing.h

Xcode Version 9.0 beta (9M136h)

/Applications/Xcode-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode-beta.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode-beta.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include/sys/_symbol_aliasing.h

The thing that seems to be different is the fact that it is not included in /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain like it is on 8.3.3.

This could be a red herring but I thought I'd point it out.

@thebluepotato
Copy link
Contributor

I don't know if it's merely a fun fact, but the Xcode 9.0 beta 1 release notes state :

SQLite APIs can now be imported into Swift under the module name SQLite3

If only had a brief look, but it seems to be a very "raw" import, meaning all functions are prefixed with sqlite3_ to the point it seems it's more "ease of access" to the API than a real native Swift port. Maybe this will evolve to a real Swift syntax, but I guess it could be an option here for now to base SQLite.swift on the "official" API using import SQLite3 instead of having to resort to custom modulemaps, which would probably solve the issue presented here.

@bridger
Copy link

bridger commented Jun 9, 2017

Nice catch, @thebluepotato. Replacing all lines
import CSQLite
with
import SQLite3
Got everything compiling.

@iNoles
Copy link

iNoles commented Jun 9, 2017

that is very fascinating.

@thebluepotato
Copy link
Contributor

@bridger Glad it helped! However for me, replacing all CSQLite import statements with SQLite3 did solve the current issue but raised the one mentioned in #663, namely an issue with map. Have you been able to fix that one?

@bridger
Copy link

bridger commented Jun 10, 2017

I haven't got that map error. Maybe that comes from trying to use Swift 4? I'm using Xcode 9 but I'm letting SQLite.swift continue using Swift 3.2. The compiler can mix and match targets with different Swift versions now so there is no need to convert SQLite.swift to Swift 4 prematurely. It won't keep you from using Swift 4 in your main project.

@rygood
Copy link

rygood commented Jun 12, 2017

For anyone using CocoaPods, here is a snippet to add to your post_install do section of your Podfile. It will go over the directory structure for SQLite.swift and apply @bridger's fix.

	Dir.glob('Pods/SQLite.swift/Sources/SQLite/**/*.swift').each { |path|
		begin
			text = File.read(path)
			text = text.gsub(/import CSQLite/, 'import SQLite3')
			File.open(path, 'w') { |file| file.puts text }
		rescue Exception
			puts "Unable to patch #{path}: #{$!}"
		end
	}```

@saqib-saud
Copy link

@rygood Thanks for the snippet, pod files seems to be readonly. getting multiple errors like the following.

Unable to patch Pods/SQLite.swift/Sources/SQLite/Typed/Collation.swift: Permission denied - Pods/SQLite.swift/Sources/SQLite/Typed/Collation.swift

@thebluepotato
Copy link
Contributor

Yep, files in the "Pods" project are locked. Maybe this can be circumvented by script?
Before addressing the Swift 4 mapissue (which frankly I believe is only a misinterpretation by the interpreter of join the object and join() the function), a specific swift4 branch could already:

  • Replace import CSQLite with import SQLite3
  • Remove all the modulemaps

@saqib-saud
Copy link

saqib-saud commented Jun 13, 2017

Snippet wont edit locked file. I'm using a fork for now.

pod 'SQLite.swift', :inhibit_warnings => true, :git => 'https://github.com/spronin/SQLite.swift.git'

@rygood
Copy link

rygood commented Jun 14, 2017

My work around for the locked files is nuking the Pods/ directory and doing a fresh pod install the script is able to modify the files on the first install.

@jberkel
Copy link
Collaborator

jberkel commented Jun 15, 2017

@thebluepotato would you mind setting up a PR for this (swift4 branch)? Unfortunately I don't have much time to maintain SQLite.swift at the moment.

@thebluepotato
Copy link
Contributor

thebluepotato commented Jun 15, 2017

I've set up the necessary updates (and fixed the map issue), I just need someone to create a swift-4 branch here so my PR can point to there. pod lib lint fails for now but installing from git and compiling work in my project. All tests passed, except those for SQLCipher (untested).

NB : about the map issue, I think Swift 4 is stricter between single-tuple and multiple arguments, meaning that if you map a collection of tuples, the argument is the tuple, not the tuples sub-components (will be clearer once you see the code).

@jberkel
Copy link
Collaborator

jberkel commented Jun 15, 2017

@thebluepotato branch created

@thebluepotato
Copy link
Contributor

@jberkel Thanks! PR #668 created.

@jberkel
Copy link
Collaborator

jberkel commented Jul 1, 2017

there's now a swift-4 branch available

@AlexandreLage
Copy link

Thank you @rygood
Your solution works fine.

First I removed SQLite from my podfile, so I could uninstall it.
I deleted the following lines:

use_frameworks!
  pod 'SQLite.swift'

Then $ pod install
Now SQLite has been removed.

Then I put SQLite back and also put the code you made for us.

use_frameworks!
  pod 'SQLite.swift'
  
  post_install do
      Dir.glob('Pods/SQLite.swift/Sources/SQLite/**/*.swift').each { |path|
          begin
              text = File.read(path)
              text = text.gsub(/import CSQLite/, 'import SQLite3')
              File.open(path, 'w') { |file| file.puts text }
              rescue Exception
              puts "Unable to patch #{path}: #{$!}"
          end
      }
  end

Then $ pod install
Now SQLite has been installed and those lines containing 'import CSQLite' were replaced by 'import SQLite3'.
It worked fine.
Many thanks from Brazil

@joshfriend
Copy link
Contributor

With Xcode 9GM I no longer have any errors or warnings compiling this. I'm using version 0.11.3, so maybe it was just an issue with the beta Xcode only?

@jberkel
Copy link
Collaborator

jberkel commented Sep 14, 2017

There will be 0.11.4 soon, with the swift4 changes (#725).
@joshfriend interesting, maybe it broke too many things so they rolled some changes back

@aleczadikian
Copy link

aleczadikian commented Sep 20, 2017

On an unrelated project, I saw these errors merely because my Xcode 9 (release, not beta) wasn't located at exactly /Applications/Xcode.app, rather Xcode 8 was there while Xcode 9 was at /Applications/Xcode Nein.app. I didn't go changing any SQLite imports to fix it, just renamed the app. Maybe this is applicable to you guys.

@jberkel
Copy link
Collaborator

jberkel commented Sep 28, 2017

@aleczadikian this should no longer by an issue (with the release branch and upcoming 0.11.4)

@jberkel
Copy link
Collaborator

jberkel commented Sep 30, 2017

Closed with 0.11.4

@jberkel jberkel closed this as completed Sep 30, 2017
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