devernay / xcodelegacy

Legacy components for XCode 4-12 (deprecated compilers and Mac OS X SDKs)
https://github.com/devernay/xcodelegacy
470 stars 63 forks source link

Bad Info.plist created for Xcode 10.0 #46

Closed gghose closed 5 years ago

gghose commented 6 years ago

The install program produces a sed error but modifies the plist.

Sure enough when I try make a project:

could not create session: requestError(description: "unknown error while handling message: unableToInitializeCore(errors: [\"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform: error: unable to load platform: \\'Info.plist\\' was malformed: Couldn\\'t parse property list because the input data was in an invalid format\", \"/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.0.xcplugin/Contents/Resources/GCC Generic.xcspec: warning: spec \\':com.apple.compilers.gcc\\' already registered from /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/Clang LLVM 1.0.xcplugin/Contents/Resources/Default Compiler.xcspec\", \"/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.0.xcplugin/Contents/Resources/GCC 4.0.xcspec: error: unknown spec \\'Class\\': \\'PBXCompilerSpecificationGcc3_3\\'\", \"/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.2.xcplugin/Contents/Resources/GCC 4.2.xcspec: error: unknown spec \\'Class\\': \\'PBXCompilerSpecificationGcc3_3\\'\", \": error: missing required Mac OS X platform\"])")

rsfinn commented 6 years ago

The XcodeLegacy.sh script tries to use sed to write the new minimum SDK version into the embedded property list at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist, but in Xcode 10 the plist file is in binary format, so sed corrupts it. Fortunately the script backs up the Info.plist to Info.plist-original alongside, so you can replace the bad version with the original.

As shipped, the original version declares the minimum version as 10.11, so if you don't need an SDK older than that, you're done. Otherwise, you can use BBEdit to edit the binary plist and manually enter the desired version (the key is "MinimumSDKVersion").

victori commented 6 years ago

Hmm, I have the same problem on Xcode 10.1. However the reverted plist hasn't not helped. Any other insight what it might be?

victori commented 6 years ago

Actually I take it back my error appears to be different.

`2018-11-07 12:39:32.153 xcodebuild[13749:11389670] [MT] DVTSDK: Skipped SDK /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk; its version (10.6) is below required minimum (10.11) for the macosx platform. 2018-11-07 12:39:32.988 XCBBuildService[13751:11389704] /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.0.xcplugin/Contents/Resources/GCC Generic.xcspec: warning: spec ':com.apple.compilers.gcc' already registered from /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/Clang LLVM 1.0.xcplugin/Contents/Resources/Default Compiler.xcspec 2018-11-07 12:39:32.996 XCBBuildService[13751:11389705] /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.2.xcplugin/Contents/Resources/GCC 4.2.xcspec: error: unknown spec 'Class': 'PBXCompilerSpecificationGcc3_3' 2018-11-07 12:39:32.996 XCBBuildService[13751:11389693] /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.0.xcplugin/Contents/Resources/GCC 4.0.xcspec: error: unknown spec 'Class': 'PBXCompilerSpecificationGcc3_3' --- xcodebuild: WARNING: Configuration Release-Debug is not in the project. Building default configuration.

2018-11-07 12:39:33.238 XCBBuildService[13751:11389706] /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.0.xcplugin/Contents/Resources/GCC Generic.xcspec: warning: spec ':com.apple.compilers.gcc' already registered from /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/Clang LLVM 1.0.xcplugin/Contents/Resources/Default Compiler.xcspec 2018-11-07 12:39:33.245 XCBBuildService[13751:11389693] /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.0.xcplugin/Contents/Resources/GCC 4.0.xcspec: error: unknown spec 'Class': 'PBXCompilerSpecificationGcc3_3' 2018-11-07 12:39:33.246 XCBBuildService[13751:11389709] /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.2.xcplugin/Contents/Resources/GCC 4.2.xcspec: error: unknown spec 'Class': 'PBXCompilerSpecificationGcc3_3' lnote: Using new build system error: could not create session: requestError(description: "unknown error while handling message: unableToInitializeCore(errors: [\"/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.0.xcplugin/Contents/Resources/GCC Generic.xcspec: warning: spec \\':com.apple.compilers.gcc\\' already registered from /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/Clang LLVM 1.0.xcplugin/Contents/Resources/Default Compiler.xcspec\", \"/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.0.xcplugin/Contents/Resources/GCC 4.0.xcspec: error: unknown spec \\'Class\\': \\'PBXCompilerSpecificationGcc3_3\\'\", \"/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.2.xcplugin/Contents/Resources/GCC 4.2.xcspec: error: unknown spec \\'Class\\': \\'PBXCompilerSpecificationGcc3_3\\'\"])")`

nicolas-cellier-aka-nice commented 5 years ago

Couldn't we detect the case when property list is binary, and then use plutil rather than sed? See for example: http://scriptingosx.com/2016/11/editing-property-lists/ plutil -replace otherkey -string othervalue test.plist

nicolas-cellier-aka-nice commented 5 years ago

I could successfully install the legacy SDKs/Compilers on Xcode 10.1 by replacing the sed command:

mv "$PLATFORMDIR/Info.plist" "$PLATFORMDIR/Info.plist-original"
sed -e '/MinimumSDKVersion/{N;d;}' < "$PLATFORMDIR/Info.plist-original" > "$PLATFORMDIR/Info.plist"

with:

cp -p "$PLATFORMDIR/Info.plist" "$PLATFORMDIR/Info.plist-original"
plutil -remove MinimumSDKVersion "$PLATFORMDIR/Info.plist"
gghose commented 5 years ago

Just did the plutil fix with Xcode 10.1 and it works! Thanks.

Now I've got another problem... somehow the ld links seem screwed up. I've got a project trying to link with x86_64 and for some reason the ppc directories in the toolchain are being searched:

Ld /Users/geoff/Library/Developer/Xcode/DerivedData/AttendDynX-gbqjgpntvkhtkqcasypgoxrrrqla/Build/Products/Development/AttendDynX.app/Contents/MacOS/AttendDynX normal x86_64 cd /Users/geoff/Desktop/Lablib/AttendDynX5 export MACOSX_DEPLOYMENT_TARGET=10.5 /Applications/Xcode.app/Contents/Developer/usr/bin/llvm-gcc-4.2 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.5.sdk -L/Users/geoff/Library/Developer/Xcode/DerivedData/AttendDynX-gbqjgpntvkhtkqcasypgoxrrrqla/Build/Products/Development -F/Users/geoff/Library/Developer/Xcode/DerivedData/AttendDynX-gbqjgpntvkhtkqcasypgoxrrrqla/Build/Products/Development -F../LocalFrameworks/build/Development -filelist /Users/geoff/Library/Developer/Xcode/DerivedData/AttendDynX-gbqjgpntvkhtkqcasypgoxrrrqla/Build/Intermediates.noindex/AttendDynX.build/Development/AttendDynX.build/Objects-normal/x86_64/AttendDynX.LinkFileList -mmacosx-version-min=10.5 -Xlinker -object_path_lto -Xlinker /Users/geoff/Library/Developer/Xcode/DerivedData/AttendDynX-gbqjgpntvkhtkqcasypgoxrrrqla/Build/Intermediates.noindex/AttendDynX.build/Development/AttendDynX.build/Objects-normal/x86_64/AttendDynX_lto.o -fobjc-link-runtime -framework EZAudioCompat -framework Lablib -framework Cocoa -Xlinker -dependency_info -Xlinker /Users/geoff/Library/Developer/Xcode/DerivedData/AttendDynX-gbqjgpntvkhtkqcasypgoxrrrqla/Build/Intermediates.noindex/AttendDynX.build/Development/AttendDynX.build/Objects-normal/x86_64/AttendDynX_dependency_info.dat -o /Users/geoff/Library/Developer/Xcode/DerivedData/AttendDynX-gbqjgpntvkhtkqcasypgoxrrrqla/Build/Products/Development/AttendDynX.app/Contents/MacOS/AttendDynX

Error: cannot find ld for x86_64 in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/../libexec/ld/ppc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/../../../libexec/ld/ppc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/../../../../libexec/ld/ppc or /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/../../../../../libexec/ld/ppccollect2: ld returned 1 exit status

What's odd is that Xcode succeeded in making the app (It's in DerivedData) but this area is preventing it from being run "within" the Xcode environment? Any ideas?

devernay commented 5 years ago

fixed by #47

gghose commented 5 years ago

My issue with ld not being found is back. I wish I had a better understanding of the logic by which paths are searched. This isn't an issue of the plist; it looks fine.

To reiterate:

cannot find ld for x86_64 in /Applications/Xcode.9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/../libexec/ld/ppc /Applications/Xcode.9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/../../../libexec/ld/ppc /Applications/Xcode.9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/../../../../libexec/ld/ppc or /Applications/Xcode.9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/../../../../../libexec/ld/ppccollect2: ld returned 1 exit status