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

Brew install does not currently work #51

Closed
daniel-beard opened this issue Sep 13, 2017 · 35 comments
Closed

Brew install does not currently work #51

daniel-beard opened this issue Sep 13, 2017 · 35 comments

Comments

@daniel-beard
Copy link

Using the instructions from the README I currently get this:

brew install xcodegen
==> Installing xcodegen from yonaskolb/xcodegen
==> Downloading https://github.com/yonaskolb/XcodeGen/archive/0.6.1.tar.gz
Already downloaded: /Users/dbeard/Library/Caches/Homebrew/xcodegen-0.6.1.tar.gz
==> Building XcodeGen
==> swift build -c release -Xlinker -rpath -Xlinker @executable_path -Xswiftc -static-stdlib
Last 15 lines from /Users/dbeard/Library/Logs/Homebrew/xcodegen/01.swift:
2017-09-13 12:02:33 -0700

swift build -c release -Xlinker -rpath -Xlinker @executable_path -Xswiftc -static-stdlib

error: manifest parse error(s):
sandbox-exec: sandbox_apply_container: Operation not permitted

If reporting this issue please do so to (not Homebrew/brew or Homebrew/core):
yonaskolb/xcodegen

/usr/local/Homebrew/Library/Homebrew/utils/github.rb:226:in `raise_api_error': curl failed!  (GitHub::Error)
curl: (22) The requested URL returned error: 422 Unprocessable Entity
curl: (3) <url> malformed
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:184:in `open'
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:284:in `search'
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:231:in `search_issues'
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:244:in `issues_for_formula'
	from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:369:in `fetch_issues'
	from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:365:in `issues'
	from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:419:in `dump'
	from /usr/local/Homebrew/Library/Homebrew/brew.rb:133:in `rescue in <main>'
	from /usr/local/Homebrew/Library/Homebrew/brew.rb:26:in `<main>'
@daniel-beard
Copy link
Author

May be related to having Xcode 9 GM installed.

@jalopezcar
Copy link

I had the same problem with xcode9, it works with xcode8

sudo xcode-select -s .../Xcode.app

@yonaskolb
Copy link
Owner

Yes, it won't build with Xcode 9 if that's your default. I'll update to Swift 4 hopefully in the next couple of days

@yonaskolb
Copy link
Owner

Swift 4 upgrade implemented by #52

@yonaskolb
Copy link
Owner

Just a note @daniel-beard, if you want to install a working Swift 4 version before the next release you can install from master:

$ git clone https://github.com/yonaskolb/XcodeGen.git
$ cd XcodeGen
$ make

@yonaskolb
Copy link
Owner

yonaskolb commented Sep 18, 2017

I've released 1.0.0 with Swift 4 support, but this still seems to be an issue. Does anyone have any ideas on how to fix this, as I can't find any information about the error?

@pepicrft
Copy link

@yonaskolb I ran through similar issues when I tried to install xcode using Homebrew. I solved by adding the flag --no-sandbox.

brew install xcodegen --no-sandbox

Not sure about why the flag is needed though @yonaskolb

@yonaskolb
Copy link
Owner

Thanks @pepibumur! That does indeed seem to fix the issue, strange...
I've updated the readme

@pepicrft
Copy link

Cool @yonaskolb

@yonaskolb
Copy link
Owner

I noticed this in the Swift 4 release notes:

On macOS, Swift package builds now occur in a sandbox which prevents network access and file system modification, to help mitigate the effect of maliciously crafted manifests

I hadn't seen this mentioned before. Doesn't seem like there was a proposal for this. Still not sure how this affects homebrew installation

@pepicrft
Copy link

@yonaskolb, I think they prevent that people run code in the Package.swift that has access to the system somehow. But I don't think it's the case here since the Package.swift is not doing such thing. Weird :/

@ehyche
Copy link

ehyche commented Sep 20, 2017

@yonaskolb : I ran:

brew update
brew tap yonaskolb/XcodeGen https://github.com/yonaskolb/XcodeGen.git
brew install XcodeGen --no-sandbox

and that fixed the "sandbox-exec: sandbox_apply_container: Operation not permitted" error. But I am still seeing the homebrew error, which causes XcodeGen to not install. Here is the output:

[ehyche@GM19403 ~]$ brew install XcodeGen --no-sandbox
==> Installing xcodegen from yonaskolb/xcodegen
==> Downloading https://github.com/yonaskolb/XcodeGen/archive/1.1.0.tar.gz
Already downloaded: /Users/ehyche/Library/Caches/Homebrew/xcodegen-1.1.0.tar.gz
==> Building XcodeGen
==> swift build -c release -Xswiftc -static-stdlib
Last 15 lines from /Users/ehyche/Library/Logs/Homebrew/xcodegen/01.swift:
Resolving https://github.com/yonaskolb/JSONUtilities at 3.3.8
Cloning https://github.com/JohnSundell/Unbox
Resolving https://github.com/JohnSundell/Unbox at 2.5.0
Cloning https://github.com/jpsim/Yams
Resolving https://github.com/jpsim/Yams at 0.3.6
Cloning https://github.com/tadija/AEXML.git
Resolving https://github.com/tadija/AEXML.git at 4.1.0
Cloning https://github.com/swift-xcode/xcodeproj.git
Resolving https://github.com/swift-xcode/xcodeproj.git at 0.1.2
Cloning https://github.com/kylef/Spectre.git
Resolving https://github.com/kylef/Spectre.git at 0.7.2
Cloning https://github.com/onevcat/Rainbow.git
Resolving https://github.com/onevcat/Rainbow.git at 2.1.0
Cloning https://github.com/kylef/Commander.git
Resolving https://github.com/kylef/Commander.git at 0.6.1

If reporting this issue please do so to (not Homebrew/brew or Homebrew/core):
yonaskolb/xcodegen

/usr/local/Homebrew/Library/Homebrew/utils/github.rb:226:in `raise_api_error': curl failed!  (GitHub::Error)
curl: (22) The requested URL returned error: 422 Unprocessable Entity
curl: (3) <url> malformed
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:184:in `open'
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:284:in `search'
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:231:in `search_issues'
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:244:in `issues_for_formula'
	from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:369:in `fetch_issues'
	from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:365:in `issues'
	from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:419:in `dump'
	from /usr/local/Homebrew/Library/Homebrew/brew.rb:133:in `rescue in <main>'
	from /usr/local/Homebrew/Library/Homebrew/brew.rb:26:in `<main>'

@yonaskolb yonaskolb reopened this Sep 20, 2017
@yonaskolb
Copy link
Owner

@ehyche, I just noticed that too actually. It was working before but now that error occurs. Nothing has changed that I can see between 1.0.1 and 1.1.0. Maybe a homebrew update broken something?
The error from Homebrew doesn't really help. Running with -v gives a bit more info though

~/Developer/XcodeGen: brew install XcodeGen --no-sandbox -v
==> Installing xcodegen from yonaskolb/xcodegen
==> Downloading https://github.com/yonaskolb/XcodeGen/archive/1.1.0.tar.gz
Already downloaded: /Users/Yonas/Library/Caches/Homebrew/xcodegen-1.1.0.tar.gz
==> Verifying xcodegen-1.1.0.tar.gz checksum
tar xzf /Users/Yonas/Library/Caches/Homebrew/xcodegen-1.1.0.tar.gz
==> Building XcodeGen
==> swift build -c release -Xswiftc -static-stdlib
Compile CYaml src/scanner.c
Compile CYaml src/reader.c
Compile CYaml src/writer.c
Compile CYaml src/dumper.c
Compile CYaml src/parser.c
Compile CYaml src/emitter.c
Compile CYaml src/loader.c
Compile CYaml src/api.c
/usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `initialize': Operation not permitted - /Users/Yonas/Library/Logs/Homebrew/xcodegen/01.swift.cc (Errno::EPERM)
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `open'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `log'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:369:in `<main>'
/usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `initialize': Operation not permitted - /Users/Yonas/Library/Logs/Homebrew/xcodegen/01.swift.cc (Errno::EPERM)
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `open'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `log'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:369:in `<main>'
/usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `initialize': Operation not permitted - /Users/Yonas/Library/Logs/Homebrew/xcodegen/01.swift.cc (Errno::EPERM)
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `open'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `log'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:369:in `<main>'
/usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `initialize': Operation not permitted - /Users/Yonas/Library/Logs/Homebrew/xcodegen/01.swift.cc (Errno::EPERM)
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `open'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `log'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:369:in `<main>'
/usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `initialize': Operation not permitted - /Users/Yonas/Library/Logs/Homebrew/xcodegen/01.swift.cc (Errno::EPERM)
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `open'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `log'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:369:in `<main>'
/usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `initialize': Operation not permitted - /Users/Yonas/Library/Logs/Homebrew/xcodegen/01.swift.cc (Errno::EPERM)
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `open'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `log'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:369:in `<main>'
/usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `initialize': Operation not permitted - /Users/Yonas/Library/Logs/Homebrew/xcodegen/01.swift.cc (Errno::EPERM)
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `open'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `log'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:369:in `<main>'
/usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `initialize': Operation not permitted - /Users/Yonas/Library/Logs/Homebrew/xcodegen/01.swift.cc (Errno::EPERM)
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `open'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:350:in `log'
	from /usr/local/Homebrew/Library/Homebrew/shims/super/clang:369:in `<main>'
error: terminated(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /private/tmp/xcodegen-20170920-93543-fqqj0p/XcodeGen-1.1.0/.build/release.yaml main
Fetching https://github.com/kylef/PathKit.git
Fetching https://github.com/jpsim/Yams.git
Fetching https://github.com/kylef/Commander.git
Fetching https://github.com/yonaskolb/JSONUtilities.git
Fetching https://github.com/kylef/Spectre.git
Fetching https://github.com/onevcat/Rainbow.git
Fetching https://github.com/swift-xcode/xcodeproj.git
Fetching https://github.com/jpsim/Yams
Fetching https://github.com/tadija/AEXML.git
Fetching https://github.com/yonaskolb/JSONUtilities
Fetching https://github.com/JohnSundell/Unbox
Cloning https://github.com/kylef/PathKit.git
Resolving https://github.com/kylef/PathKit.git at 0.8.0
Cloning https://github.com/jpsim/Yams.git
Resolving https://github.com/jpsim/Yams.git at 0.3.6
Cloning https://github.com/yonaskolb/JSONUtilities.git
Resolving https://github.com/yonaskolb/JSONUtilities.git at 3.3.8
Cloning https://github.com/yonaskolb/JSONUtilities
Resolving https://github.com/yonaskolb/JSONUtilities at 3.3.8
Cloning https://github.com/JohnSundell/Unbox
Resolving https://github.com/JohnSundell/Unbox at 2.5.0
Cloning https://github.com/jpsim/Yams
Resolving https://github.com/jpsim/Yams at 0.3.6
Cloning https://github.com/tadija/AEXML.git
Resolving https://github.com/tadija/AEXML.git at 4.1.0
Cloning https://github.com/swift-xcode/xcodeproj.git
Resolving https://github.com/swift-xcode/xcodeproj.git at 0.1.2
Cloning https://github.com/kylef/Spectre.git
Resolving https://github.com/kylef/Spectre.git at 0.7.2
Cloning https://github.com/onevcat/Rainbow.git
Resolving https://github.com/onevcat/Rainbow.git at 2.1.0
Cloning https://github.com/kylef/Commander.git
Resolving https://github.com/kylef/Commander.git at 0.6.1

==> Formula
Tap: yonaskolb/xcodegen
Path: /usr/local/Homebrew/Library/Taps/yonaskolb/homebrew-xcodegen/Formula/xcodegen.rb
==> Configuration
HOMEBREW_VERSION: 1.3.2-86-g5d888c0
ORIGIN: https://github.com/Homebrew/brew
HEAD: 5d888c08a3186c7ca411a0197e4fcf36f2cd3769
Last commit: 3 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: e6b63822d703810d91b03c045009f8b1a65908ac
Core tap last commit: 75 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.0.0-p648
Clang: 9.0 build 900
Git: 2.13.5 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Perl: /opt/local/bin/perl => /opt/local/bin/perl5.16
Python: /usr/bin/python
Ruby: /Users/Yonas/.rvm/rubies/ruby-2.4.0/bin/ruby
Java: 1.8.0_77, 1.7.0_71
macOS: 10.12.6-x86_64
Xcode: 9.0
CLT: N/A
X11: N/A
MacPorts/Fink: /opt/local/bin/port
==> ENV
HOMEBREW_CC: clang
HOMEBREW_CXX: clang++
SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
MAKEFLAGS: -j8
CMAKE_PREFIX_PATH: /usr/local
CMAKE_INCLUDE_PATH: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/apache2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
CMAKE_FRAMEWORK_PATH: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks
MACOSX_DEPLOYMENT_TARGET: 10.12
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.12
HOMEBREW_SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
ACLOCAL_PATH: /usr/local/share/aclocal
PATH: /usr/local/Homebrew/Library/Homebrew/shims/super:/usr/bin:/bin:/usr/sbin:/sbin

Error: yonaskolb/xcodegen/xcodegen 1.1.0 did not build
Logs:
     /Users/Yonas/Library/Logs/Homebrew/xcodegen/00.options.out
     /Users/Yonas/Library/Logs/Homebrew/xcodegen/01.swift
If reporting this issue please do so to (not Homebrew/brew or Homebrew/core):
yonaskolb/xcodegen

/usr/local/Homebrew/Library/Homebrew/utils/github.rb:226:in `raise_api_error': curl failed!   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current (GitHub::Error)
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 422 Unprocessable Entity
curl: (3) <url> malformed
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:184:in `open'
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:284:in `search'
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:231:in `search_issues'
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:244:in `issues_for_formula'
	from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:369:in `fetch_issues'
	from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:365:in `issues'
	from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:419:in `dump'
	from /usr/local/Homebrew/Library/Homebrew/brew.rb:133:in `rescue in <main>'
	from /usr/local/Homebrew/Library/Homebrew/brew.rb:26:in `<main>'
~/Developer/XcodeGen:

@ehyche
Copy link

ehyche commented Sep 20, 2017

Looks like it is related (I think) to the custom tap that is used: Homebrew/brew#2733

@aerobounce
Copy link

So, seemingly it's a brew-side bug and we have to wait until next version of brew...?

@yonaskolb
Copy link
Owner

Yeah, I'm sure it it's an Xcode 9, homebrew or formula problem. It might be fixed with a homebrew or macOS update?

@ilovezfs
Copy link

Hi, I'm one of the Homebrew maintainers. You need to run swift build --disable-sandbox because Homebrew runs all builds in a sandbox, and you cannot exec another sandbox within a sandbox.

You should not run brew install --no-sandbox, which is intended for debugging purposes only.

@aerobounce
Copy link

Ah, that totally makes sense...

@ilovezfs
Copy link

For an example, see Homebrew/homebrew-core#18456.

@pepicrft
Copy link

Makes sense. Thanks, @ilovezfs for clarifying it. I've updated it to not use the sanbox flag with Homebrew.

@yonaskolb
Copy link
Owner

Fantastic, thank you @ilovezfs!
Is there any documentation around the Swift 4 changes that require this workaround? Is it all Swift 4 packages or only those with C code, as I noticed the error happened while compiling libCYaml from the Yams dependency.

@pepicrft
Copy link

I found this @yonaskolb on this link:

On macOS, Swift package builds now occur in a sandbox which prevents network access and file system modification, to help mitigate the effect of maliciously crafted manifests.

I think it might be related

@yonaskolb
Copy link
Owner

Yeah I believe that's what caused it

@aerobounce
Copy link

aerobounce commented Sep 25, 2017

Seems now on 1.1.0 this is fixed by those workaround commits. Successfully installed xcodegen by brew on 10.12.6 with Xcode 9.
I think this issue is solved, at least for now?

valeriomazzeo added a commit to valeriomazzeo/homebrew-linuxmain-generator that referenced this issue Sep 26, 2017
@jalopezcar
Copy link

I'm getting the same error with 1.9.0 version

$ brew install xcodegen
==> Installing xcodegen from yonaskolb/xcodegen
==> Downloading https://github.com/yonaskolb/XcodeGen/archive/1.9.0.tar.gz
Already downloaded: /Users/jlopezcarreno/Library/Caches/Homebrew/xcodegen-1.9.0.tar.gz
==> make install PREFIX=/usr/local/Cellar/xcodegen/1.9.0
Last 15 lines from /Users/jlopezcarreno/Library/Logs/Homebrew/xcodegen/01.make:
Cloning https://github.com/yonaskolb/JSONUtilities.git
Resolving https://github.com/yonaskolb/JSONUtilities.git at 3.3.8
Cloning https://github.com/JohnSundell/ShellOut.git
Resolving https://github.com/JohnSundell/ShellOut.git at 2.1.0
Cloning https://github.com/kylef/PathKit.git
Resolving https://github.com/kylef/PathKit.git at 0.9.1
Cloning https://github.com/tadija/AEXML.git
Resolving https://github.com/tadija/AEXML.git at 4.3.0
Cloning https://github.com/kylef/Spectre.git
Resolving https://github.com/kylef/Spectre.git at 0.8.0
Cloning https://github.com/onevcat/Rainbow.git
Resolving https://github.com/onevcat/Rainbow.git at 3.1.1
Cloning https://github.com/kylef/Commander.git
Resolving https://github.com/kylef/Commander.git at 0.8.0
make: *** [build] Error 1

If reporting this issue please do so to (not Homebrew/brew or Homebrew/core):
yonaskolb/xcodegen

/usr/local/Homebrew/Library/Homebrew/utils/github.rb:220:in `raise_api_error': curl failed!  (GitHub::Error)
curl: (22) The requested URL returned error: 422 Unprocessable Entity
curl: (3) <url> malformed
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:178:in `open_api'
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:292:in `search'
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:225:in `search_issues'
	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:238:in `issues_for_formula'
	from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:368:in `fetch_issues'
	from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:364:in `issues'
	from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:418:in `dump'
	from /usr/local/Homebrew/Library/Homebrew/brew.rb:139:in `rescue in <main>'
	from /usr/local/Homebrew/Library/Homebrew/brew.rb:31:in `<main>'

It doesn't happen with v1.8.0

$ brew install https://raw.githubusercontent.com/yonaskolb/XcodeGen/1.9.0/Formula/xcodegen.rb

It seems also that the tag version 1.9.0 point actually to v1.8.0

@vhbit
Copy link
Contributor

vhbit commented Apr 14, 2018

@jalopezcar please provide output of brew install xcodegen --verbose, Xcode version and if you have CLT (command line tools) installed.

vhbit added a commit to vhbit/XcodeGen that referenced this issue Apr 14, 2018
I guess that's the reason for
yonaskolb#51 (comment),
I haven't modified original pull request after new discoveries found in
discussion yonaskolb#283 (primarily - that it is not Xcode 9.3 issue, but issue
caused by Xcode and CLT installed in the same time).

This patch modifies ENV only if CLT is installed.

I've checked it against Xcode + CLT and it worked fine, it'll be great
if someone can confirm that this one works on Xcode only system. You
can do that by running `brew edit xcodegen` and after patching
`brew reinstall xcodegen`
@yonaskolb
Copy link
Owner

@jalopezcar can you see if the formula on master fixes your issue?

@jalopezcar
Copy link

I still get the same error

$ brew install https://raw.githubusercontent.com/yonaskolb/XcodeGen/master/Formula/xcodegen.rb --verbose

/Library/Homebrew/build.rb /Users/jlopezcarreno/Library/Caches/Homebrew/Formula/xcodegen.rb --verbose
==> Downloading https://github.com/yonaskolb/XcodeGen/archive/1.9.0.tar.gz
Already downloaded: /Users/jlopezcarreno/Library/Caches/Homebrew/xcodegen-1.9.0.tar.gz
==> Verifying xcodegen-1.9.0.tar.gz checksum
tar xzf /Users/jlopezcarreno/Library/Caches/Homebrew/xcodegen-1.9.0.tar.gz
==> make install PREFIX=/usr/local/Cellar/xcodegen/1.9.0
swift build --disable-sandbox -c release -Xswiftc -static-stdlib
Compile CYaml src/writer.c
Compile CYaml src/parser.c
Compile CYaml src/emitter.c
Compile CYaml src/reader.c
Compile CYaml src/api.c
Compile CYaml src/scanner.c
Compile Swift Module 'AEXML' (5 sources)
Compile Swift Module 'PathKit' (1 sources)
Compile Swift Module 'JSONUtilities' (10 sources)
Compile Swift Module 'Rainbow' (11 sources)
Compile Swift Module 'Commander' (9 sources)
Compile Swift Module 'Spectre' (8 sources)
Compile Swift Module 'Yams' (16 sources)
/private/tmp/xcodegen-20180416-88739-3hlf5l/XcodeGen-1.9.0/.build/checkouts/AEXML.git--1992474868199569405/Sources/Element.swift:100:24: error: value of type '[AEXMLElement]' has no member 'compactMap'
        let found = all?.compactMap {
                    ~~~^ ~~~~~~~~~~
/private/tmp/xcodegen-20180416-88739-3hlf5l/XcodeGen-1.9.0/.build/checkouts/AEXML.git--1992474868199569405/Sources/Element.swift:114:24: error: value of type '[AEXMLElement]' has no member 'compactMap'
        let found = all?.compactMap { element in
                    ~~~^ ~~~~~~~~~~
/private/tmp/xcodegen-20180416-88739-3hlf5l/XcodeGen-1.9.0/.build/checkouts/AEXML.git--1992474868199569405/Sources/Element.swift:131:55: error: value of type '[AEXMLElement]' has no member 'compactMap'
        let found = all(containingAttributeKeys: keys)?.compactMap { element in
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ ~~~~~~~~~~
error: terminated(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /private/tmp/xcodegen-20180416-88739-3hlf5l/XcodeGen-1.9.0/.build/release.yaml main
Fetching https://github.com/kylef/PathKit.git
Fetching https://github.com/kylef/Commander.git
Fetching https://github.com/jpsim/Yams.git
Fetching https://github.com/yonaskolb/JSONUtilities.git
Fetching https://github.com/kylef/Spectre.git
Fetching https://github.com/onevcat/Rainbow.git
Fetching https://github.com/xcodeswift/xcproj.git
Fetching https://github.com/JohnSundell/ShellOut.git
Fetching https://github.com/tadija/AEXML.git
Cloning https://github.com/xcodeswift/xcproj.git
Resolving https://github.com/xcodeswift/xcproj.git at 4.3.0
Cloning https://github.com/jpsim/Yams.git
Resolving https://github.com/jpsim/Yams.git at 0.7.0
Cloning https://github.com/yonaskolb/JSONUtilities.git
Resolving https://github.com/yonaskolb/JSONUtilities.git at 3.3.8
Cloning https://github.com/JohnSundell/ShellOut.git
Resolving https://github.com/JohnSundell/ShellOut.git at 2.1.0
Cloning https://github.com/kylef/PathKit.git
Resolving https://github.com/kylef/PathKit.git at 0.9.1
Cloning https://github.com/tadija/AEXML.git
Resolving https://github.com/tadija/AEXML.git at 4.3.0
Cloning https://github.com/kylef/Spectre.git
Resolving https://github.com/kylef/Spectre.git at 0.8.0
Cloning https://github.com/onevcat/Rainbow.git
Resolving https://github.com/onevcat/Rainbow.git at 3.1.1
Cloning https://github.com/kylef/Commander.git
Resolving https://github.com/kylef/Commander.git at 0.8.0
make: *** [build] Error 1

==> Formula
Path: /Users/jlopezcarreno/Library/Caches/Homebrew/Formula/xcodegen.rb
==> Configuration
HOMEBREW_VERSION: 1.6.0
ORIGIN: https://github.com/Homebrew/brew
HEAD: 6233b9d1991043b00f635a2878fa336db3ae95d2
Last commit: 19 minutes ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 9623af306426378a6be99b8b32043b5c5ca751b7
Core tap last commit: 12 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_ENABLE_AUTO_UPDATE_MIGRATION: 1
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.3.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 9.0 build 900
Git: 2.16.2 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 9.0.4, 1.8.0_162, 1.7.0_80
macOS: 10.13.3-x86_64
CLT: 9.2.0.0.1.1510905681
Xcode: 9.2
XQuartz: N/A
==> ENV
HOMEBREW_CC: clang
HOMEBREW_CXX: clang++
MAKEFLAGS: -j8
CMAKE_PREFIX_PATH: /usr/local
CMAKE_INCLUDE_PATH: /usr/include/libxml2:/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: /System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.13
ACLOCAL_PATH: /usr/local/share/aclocal
PATH: /usr/local/Homebrew/Library/Homebrew/shims/super:/usr/bin:/bin:/usr/sbin:/sbin

Error: xcodegen 1.9.0 did not build
Logs:
     /Users/jlopezcarreno/Library/Logs/Homebrew/xcodegen/01.make
     /Users/jlopezcarreno/Library/Logs/Homebrew/xcodegen/00.options.out
     /Users/jlopezcarreno/Library/Logs/Homebrew/xcodegen/01.make.cc
Do not report this issue to Homebrew/brew or Homebrew/core!

@vhbit
Copy link
Contributor

vhbit commented Apr 17, 2018

@jalopezcar ok, that's a different issue. You use Xcode 9.2 while xcodegen 1.9.0 is now Swift 4.1
I guess that can be mitigated by providing a shim in AEXML for compactMap on earlier Swift versions, similar to https://github.com/Carthage/Carthage/blob/master/Source/CarthageKit/SwiftShims.swift

@vhbit
Copy link
Contributor

vhbit commented Apr 17, 2018

@yonaskolb maybe it's time to use bottles instead of building? I can see that mint is delivered through brew official repo and gets bottles support right away, any particular reason why xcodegen doesn't follow that path?

@yonaskolb
Copy link
Owner

@vhbit There’s no reason that we don’t have an official formula yet. Back when xcodegen started it wasn’t allowed for maintainers to submit the formula to homebrew. I don’t believe that’s the case anymore, but I just haven’t gotten around to it. Obviously I use Mint 😉
If you’d like to submit the formula that would be great!

@vhbit
Copy link
Contributor

vhbit commented Apr 18, 2018

@yonaskolb

you’d like to submit the formula that would be great!

I don't think they'll like workarounds I've put there 😄 but I'll try soon.

@agurod42
Copy link

agurod42 commented May 8, 2018

Hello guys! I'm facing the same problem :(

Tried with mint, brew and also building from sources.

This is my mint output:

mint install yonaskolb/xcodegen --verbose
🌱  Finding latest version of xcodegen
🌱  Resolved latest version of xcodegen to 1.9.0
🌱  Cloning https://github.com/yonaskolb/xcodegen.git 1.9.0...
Cloning into 'github.com_yonaskolb_xcodegen'...
remote: Counting objects: 178, done.
remote: Compressing objects: 100% (139/139), done.
remote: Total 178 (delta 12), reused 101 (delta 9), pack-reused 0
Receiving objects: 100% (178/178), 1.28 MiB | 123.00 KiB/s, done.
Resolving deltas: 100% (12/12), done.
Note: checking out 'aec94c87f5925ce2af5ca0224f24376c3c53e5f0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

🌱  Building xcodegen. This may take a few minutes...
Fetching https://github.com/kylef/PathKit.git
Fetching https://github.com/kylef/Commander.git
Fetching https://github.com/yonaskolb/JSONUtilities.git
Fetching https://github.com/jpsim/Yams.git
Fetching https://github.com/kylef/Spectre.git
Fetching https://github.com/onevcat/Rainbow.git
Fetching https://github.com/xcodeswift/xcproj.git
Fetching https://github.com/JohnSundell/ShellOut.git
Fetching https://github.com/tadija/AEXML.git
Cloning https://github.com/xcodeswift/xcproj.git
Resolving https://github.com/xcodeswift/xcproj.git at 4.3.0
Cloning https://github.com/jpsim/Yams.git
Resolving https://github.com/jpsim/Yams.git at 0.7.0
Cloning https://github.com/yonaskolb/JSONUtilities.git
Resolving https://github.com/yonaskolb/JSONUtilities.git at 3.3.8
Cloning https://github.com/JohnSundell/ShellOut.git
Resolving https://github.com/JohnSundell/ShellOut.git at 2.1.0
Cloning https://github.com/kylef/PathKit.git
Resolving https://github.com/kylef/PathKit.git at 0.9.1
Cloning https://github.com/tadija/AEXML.git
Resolving https://github.com/tadija/AEXML.git at 4.3.0
Cloning https://github.com/kylef/Spectre.git
Resolving https://github.com/kylef/Spectre.git at 0.8.0
Cloning https://github.com/onevcat/Rainbow.git
Resolving https://github.com/onevcat/Rainbow.git at 3.1.1
Cloning https://github.com/kylef/Commander.git
Resolving https://github.com/kylef/Commander.git at 0.8.0
Compile CYaml src/scanner.c
Compile CYaml src/reader.c
Compile CYaml src/writer.c
Compile CYaml src/parser.c
Compile CYaml src/emitter.c
Compile CYaml src/api.c
Compile Swift Module 'PathKit' (1 sources)
Compile Swift Module 'AEXML' (5 sources)
Compile Swift Module 'JSONUtilities' (10 sources)
Compile Swift Module 'Rainbow' (11 sources)
/private/var/folders/bn/vphz8g615hz01svmbckkcpjw0000gn/T/mint/github.com_yonaskolb_xcodegen/.build/checkouts/AEXML.git--1992474868199569405/Sources/Element.swift:100:24: error: value oftype '[AEXMLElement]' has no member 'compactMap'
        let found = all?.compactMap {
                    ~~~^ ~~~~~~~~~~
/private/var/folders/bn/vphz8g615hz01svmbckkcpjw0000gn/T/mint/github.com_yonaskolb_xcodegen/.build/checkouts/AEXML.git--1992474868199569405/Sources/Element.swift:114:24: error: value oftype '[AEXMLElement]' has no member 'compactMap'
        let found = all?.compactMap { element in
                    ~~~^ ~~~~~~~~~~
/private/var/folders/bn/vphz8g615hz01svmbckkcpjw0000gn/T/mint/github.com_yonaskolb_xcodegen/.build/checkouts/AEXML.git--1992474868199569405/Sources/Element.swift:131:55: error: value oftype '[AEXMLElement]' has no member 'compactMap'
        let found = all(containingAttributeKeys: keys)?.compactMap { element in
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ ~~~~~~~~~~
error: terminated(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /private/var/folders/bn/vphz8g615hz01svmbckkcpjw0000gn/T/mint/github.com_yonaskolb_xcodegen/.build/release.yaml main

@yonaskolb
Copy link
Owner

@agurodriguez your error looks like you’re not compiling with Xcode 9.3, as it’s complaining about Swift 4.1’s compactMap not being found

@agurod42
Copy link

agurod42 commented May 9, 2018

You're totally right. Updated Xcode to 9.3 and the problem went away.

Thank you!

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

No branches or pull requests

9 participants