erlyaws / yaws

Yaws webserver
https://erlyaws.github.io
BSD 3-Clause "New" or "Revised" License
1.28k stars 267 forks source link

Linux (Ubuntu 16.04) build breaks with xcrun #364

Closed jacobythwaites closed 5 years ago

jacobythwaites commented 5 years ago

Commit https://github.com/klacke/yaws/commit/6ffab6907951110a4f6b63f574c7355b704c86e1 breaks my Travis and Ubuntu 160.4 builds with the following error:

ERROR: Failed to load blahblah/yaws/rebar.config: {error,
                                                                                      {108,
                                                                                       file,
                                                                                       {error,
                                                                                        {badmatch,
                                                                                         {error,
                                                                                          {127,
                                                                                           "sh: 1: exec: /usr/bin/xcrun: not found\n"}}},
                                                                                        [{erl_eval,
                                                                                          expr,
                                                                                          3,
                                                                                          []}]}}}
make[3]: *** [yaws] Error 1
vinoski commented 5 years ago

The change passed all Travis tests on Linux, you can see here: https://travis-ci.org/klacke/yaws otherwise I wouldn't have merged it.

Can you show me how you're running your build? What command line are you using?

jacobythwaites commented 5 years ago

Thanks Steve. I use a makefile target thus:

yaws:
    @git clone https://github.com/klacke/yaws.git
    @ln -s ../rebar2 $@/rebar
    @export PATH=$(PATH):. && cd $@ && rebar get-deps && rebar clean && rebar compile

where rebar2 is in the parent directory to the cloned repo.

The attached diff fixes it for me, by checking the os:type() in rebar.config.script.

I don't use rebar normally, perhaps I should be using rebar3 for yaws?

yaws_diff.txt

jacobythwaites commented 5 years ago

Have checked, I get the same error with rebar3 actually (only on Linux, is fine on Darwin).

vinoski commented 5 years ago

There shouldn't be a need to check os:type() since the rebar.config.script is already checking for an option set for Darwin in rebar.config:

NeedMacosSdkDir = lists:keymember('NEED_MACOS_SDK_DIR', 3, ErlOpts),

where the setting is

{platform_define, "darwin", 'NEED_MACOS_SDK_DIR'},

It's not clear why this would be getting set for your system. Can you run rebar -vv compile to see if this is getting set, and why?

vinoski commented 5 years ago

I'm now seeing the same error in an Ubuntu setup. I'll figure out why and fix it immediately. Thanks for the report!

vinoski commented 5 years ago

Yep, this is totally broken. Not sure how Travis ever passed. Fix on the way, sorry for the trouble.

vinoski commented 5 years ago

Travis-CI passed with the original broken change because it runs the automake build system, not rebar.

Also, note that technically the HAVE_SENDFILE portion of rebar.config.script is similarly broken, but I didn't modify it as part of 675430d because it's not part of the immediate breakage. A separate change is coming to eliminate yaws_sendfile since it's no longer needed, and the HAVE_SENDFILE support will be addressed as part of that change.

jacobythwaites commented 5 years ago

That works, thanks very much for fixing so quickly