DeNA/DeClang

C++ headers conflict in XCode 12

alexcohn opened this issue · 7 comments

Using the pre-built binary (https://github.com/DeNA/DeClang/releases/tag/iOS-v1.0.0) and XCode 12.5 (12E262), I had conflicts in C++ headers (e.g. the compiler could not resolve ::int8_t). I removed the .DeClang/compiler/ios/include/c++ directory, and could compile my code, but there are probably negative consequences that I am not aware of.

This kind of issue is possible because the clang version we used won't be exactly the same as the version Xcode used. Could you have a try of this release https://github.com/DeNA/DeClang/releases/tag/swift5.4-v1.1.0 to see if the same issue happens?

The release only declares support for Mac OS. Do you mean I should perform a full build from this branch? I will, as soon as I am back from the vacation.

In the meanwhile, what may be negative consequences of ignoring the bundled c++ headers?

What do you mean support for Mac OS? It supports Xcode and of course Xcode runs on Mac OS. If you mean the build target then it support any build target that Xcode supports e.g. OSX, iOS etc.

I am probably missing something…

When I open https://github.com/DeNA/DeClang/releases/download/swift5.4-v1.1.0/swift-LOCAL-2021-03-20-a-osx.tar.gz, I only see

ls -l ~/Downloads/Library/Developer/Toolchains/swift-LOCAL-2021-03-20-a.xctoolchain/

total 8
drwxr-xr-x@ 3 reblaze  staff    96 Mar 20 12:10 Developer
-rw-r--r--@ 1 reblaze  staff  1107 Mar 20 12:35 Info.plist
drwxr-xr-x@ 3 reblaze  staff    96 Mar 20 09:15 System
drwxr-xr-x@ 8 reblaze  staff   256 Mar 20 12:34 usr

cat ~/Downloads/Library/Developer/Toolchains/swift-LOCAL-2021-03-20-a.xctoolchain/Info.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Aliases</key>
	<array>
		<string>Local</string>
	</array>
	<key>CFBundleIdentifier</key>
	<string>com.nevermoe.20210320</string>
	<key>CompatibilityVersion</key>
	<integer>2</integer>
	<key>CompatibilityVersionDisplayString</key>
	<string>Xcode 8.0</string>
	<key>DisplayName</key>
	<string>Local Swift Development Snapshot 2021-03-20</string>
	<key>OverrideBuildSettings</key>
	<dict>
		<key>ENABLE_BITCODE</key>
		<string>NO</string>
		<key>SWIFT_DEVELOPMENT_TOOLCHAIN</key>
		<string>YES</string>
		<key>SWIFT_DISABLE_REQUIRED_ARCLITE</key>
		<string>YES</string>
		<key>SWIFT_LINK_OBJC_RUNTIME</key>
		<string>YES</string>
		<key>SWIFT_USE_DEVELOPMENT_TOOLCHAIN_RUNTIME</key>
		<string>NO</string>
	</dict>
	<key>ReportProblemURL</key>
	<string>https://bugs.swift.org/</string>
	<key>ShortDisplayName</key>
	<string>Local Swift Development Snapshot</string>
	<key>Version</key>
	<string>5.0.20210320</string>
</dict>
</plist>

And this toolchain only shows up in my XCode 12.5 (after I moved it to /Applications/Xcode.app/Contents/Developer/Toolchains/swift-LOCAL-2021-03-20-a.xctoolchain/) with MacOS target.

I mean, it does not show up in the list of available compilers:

image

Open Xcode and select Xcode->Toolchains->Local Swift Development Snapshot 2021-03-20

Have you tried this? You don't need to change compiler in build options as long as you select this toolchain in Xcode.

Or if you are using command line please try:

xcodebuild -toolchain com.nevermoe.20210320

Hi, we just released v1.1.1 and this should support Xcode12.5 without header file conflict. https://github.com/DeNA/DeClang/releases/tag/swift5.4-v1.1.1. Also, does the v1.1.0 toolchain solve your problem? If there are no update I'm closing this issue later.

Confirmed. No header file conflicts anymore.