Closed leoliu closed 5 years ago
Please run the following two commands from your terminal command line:
xcode-select --install
sudo xcodebuild -license
to install/update your XCode command line tools, and agree to the license to use them.
Yes I have done these two steps but the issue remains.
xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
The problem might be somewhere else.
I ran those two steps and everything builds fine for me.
It built for me too until yesterday's update. Did you update xcode to the latest on 10.14.6? Maybe the script needs to handle errors more gracefully.
Yes, I updated to XCode 11.0 on macOS 10.14.6.
The error message you're getting indicates that you probably need to switch the active developer directory:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
This makes it very painful for MacOS. I may not have xcode installed since I don't use it often. Last time I opened it was 2017. The dependency should be optional not mandatory. Does it make more sense to issue a warning and then continue?
If you don't have XCode installed, how will you be able to build?
The dependency is mandatory because it's the correct and portable way to find include files — see 6ffab690. Have a look around github; there are numerous projects in various languages that use xcrun
in a similar fashion.
It has been possible to build without xcode since forever. xcode is never mandatory. I have recently built Emacs 26.3 and Erlang 22.1.
The part of Yaws that needs this huge toolset is not at the core of Yaws, any of them is optional. If for some reason they can not be built many just ignore and continue or at most print out a warning. Secondly I have /usr/include
populated but it is ignored by Yaws.
Instead I am met with this:
===> Verifying dependencies...
===> Error evaluating configuration script at "/Users/leo/sources/myapp/_build/default/lib/yaws/rebar.config.script":
{error,{99,file,
{error,{badmatch,{error,{1,
"xcodebuild: error: SDK \"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk\" cannot be located.\nxcrun: error: unable to lookup item 'PlatformPath' in SDK '/'\n"}}},
[{erl_eval,expr,5,[{file,"erl_eval.erl"},{line,453}]},
{erl_eval,exprs,5,[{file,"erl_eval.erl"},{line,126}]},
{erl_eval,expr,5,[{file,"erl_eval.erl"},{line,449}]},
{erl_eval,exprs,5,[{file,"erl_eval.erl"},{line,126}]},
{file,eval_stream2,6,[{file,"file.erl"},{line,1393}]},
{file,script,2,[{file,"file.erl"},{line,1090}]},
{rebar_config,consult_and_eval,2,
[{file,"/Users/leo/sources/erlang/rebar3/src/rebar_config.erl"},
{line,287}]}]}}}
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
Did you run the ...xcode-select -switch...
command I supplied earlier?
You can try 0cbe2d1 (branch fix-389
) to see if it addresses the issue. The rebar.config.script
code differed from the automake configure.ac
in that it didn't first check for the existence of /usr/include/security
before using xcrun
.
I have just tested fix-389 and it works. Thanks.
But making the build process terminate if xcrun fails is really really bad for some optional parts of Yaws. It forces users like me to solve a problem they don't have in a painful and time-consuming way.
So please if possible make the build process more fault-tolerant. Even if /usr/include/security
and xcrun
don't exist it should be able to build a workable app. All users (particularly new users) will be thankful.
BTW I know for a fact I am not using these optional parts of Yaws because I am compiling on macOS and deploying to centos for 2 years now.
None of this code has changed since Feb 2019, though, and I don't recall anybody having problems with it. In this case, part of your complaint is really that the XCode update broke your system. I'd still like to know if the -switch
command I provided earlier would have resolved the problem.
Since the include path the code is looking for is related to PAM, and if you're not using PAM you're supposed to set the YAWS_DISABLE_PAM
environment variable when you build so that PAM is ignored, I'll augment the fix-389
branch so that xcrun
is skipped for rebar
if that environment variable is set. This is already the way it works for automake builds.
My mac has 4G ram and is running two browsers and swapping like a pig. I had xcode installed probably from 2017 when I was testing an implementation for APNS. I have meant to delete it for a while.
I build many programs from sources. There were even a few years I only built from sources i.e. no homebrew or macports. The aforementioned emacs
and erlang
require no fiddling with xcode despite their size and complexity. This is a first and bizarre requirement to run xcode-select -switch...
. It probably will work but helps nobody.
It helps everybody to make the build smooth.
If xcrun
craps out a warning is more than enough. At least consider making rebar.config.script do so. If every project that depends on Yaws requires setting up xcode likely no one wants to depend on Yaws.
I disagree, as XCode tools have provided the standard build tools and environment for OS X for many years now. Recent versions changed some directory locations, which is why xcrun
is needed to determine those pathnames. There hasn't been a /usr/include
directory on a standard up-to-date Mac for the past year or so.
I always strive to make the build as smooth as possible, but I can't cater to everyone's customized setup. That said, in this case the problem was that rebar.config.script
was not properly checking the YAWS_DISABLE_PAM
environment variable and also not checking for /usr/include
(which, again, no longer exists on standard macOS). Both of these are fixed in fix-389
, which I'll merge shortly. If you don't want PAM included in your builds, then you must set YAWS_DISABLE_PAM=1
in your build environment.
Yes, I updated to XCode 11.0 on macOS 10.14.6.
The error message you're getting indicates that you probably need to switch the active developer directory:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Ahhhh this command helps!
Somehow my xcode (on macos 10.14.6) got auto-updated today and Yaws cannot be built any more due to
/usr/bin/xcrun --show-sdk-platform-path