Problem building from source on Mac OS


Problems running or configuring the software, commands & options, compiling, different platforms, using the interface, documentation, etc.

erf

Temple Termagant

Posts: 11

Joined: Wednesday, 22nd April 2015, 19:11

Post Monday, 4th December 2017, 00:52

Problem building from source on Mac OS

I run make TILES=y from the source folder and get the following error:

  Code:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/4.2.1
  * If you experience any problems building Crawl, please take a second look
  * at INSTALL.txt: the solution to your problem just might be in there!
    * Need to build contribs: freetype libpng sdl2 sdl2-image zlib lua/src sqlite
make[2]: *** No rule to make target `src/audio/coreaudio/*.o', needed by `libSDL2.a'.  Stop.
make[1]: *** [sdl2] Error 2
make: *** [.contrib-libs] Error 2


Anyone having success on bulding latest ( 43a1781948 ) on Mac OS?
User avatar

Dungeon Master

Posts: 502

Joined: Wednesday, 7th March 2012, 13:25

Location: Lexington, KY, US

Post Monday, 4th December 2017, 04:06

Re: Problem building from source on Mac OS

I don't have Mac OS to test with, but try this: edit contrib/sdl2/Makefile, find the line
  Code:
src/audio/coreaudio/*.c \
, and change the "*.c" to "*.m".

Dungeon Master

Posts: 240

Joined: Monday, 18th August 2014, 20:04

Post Monday, 4th December 2017, 05:34

Re: Problem building from source on Mac OS

This should be fixed now if you update your submodules. (I build on mac but I guess that .o file was cached somewhere.)

erf

Temple Termagant

Posts: 11

Joined: Wednesday, 22nd April 2015, 19:11

Post Wednesday, 6th December 2017, 03:57

Re: Problem building from source on Mac OS

I got a bit further now, but compliation failed with the following:
  Code:
In file included from clua.cc:7:
./cluautil.h:53:28: error: unknown type name 'luaL_reg'; did you mean 'luaL_Reg'?
                     const luaL_reg *lua_lib,
                           ^~~~~~~~
                           luaL_Reg
/usr/local/include/lauxlib.h:26:3: note: 'luaL_Reg' declared here
} luaL_Reg;
  ^
In file included from clua.cc:7:
./cluautil.h:57:36: error: unknown type name 'luaL_reg'; did you mean 'luaL_Reg'?
                             const luaL_reg *lr,
                                   ^~~~~~~~
                                   luaL_Reg
/usr/local/include/lauxlib.h:26:3: note: 'luaL_Reg' declared here
} luaL_Reg;
  ^
2 errors generated.
make: *** [clua.o] Error 1


Entering 'lua -v' yields:
  Code:
Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio


Do i need to install additional Lua libraries?

erf

Temple Termagant

Posts: 11

Joined: Wednesday, 22nd April 2015, 19:11

Post Wednesday, 6th December 2017, 10:16

Re: Problem building from source on Mac OS

I tried to rename the variables as suggeted by the compiler and then got the following errors:

  Code:
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C rltiles all ARCH=x86_64-apple-darwin17.2.0 TILES=y
    CXX cluautil.o
cluautil.cc:55:5: error: use of undeclared identifier 'luaL_openlib'
    luaL_openlib(ls, global, lua_lib, 0);
    ^
cluautil.cc:81:9: error: use of undeclared identifier 'luaL_openlib'
        luaL_openlib(ls, nullptr, lr, 0);
        ^
2 errors generated.
make: *** [cluautil.o] Error 1

erf

Temple Termagant

Posts: 11

Joined: Wednesday, 22nd April 2015, 19:11

Post Monday, 25th December 2017, 00:46

Re: Problem building from source on Mac OS

I build successfully after removing Lua version 5.3.4 installed with brew.

I had to use the following to build:
make mac-app-tiles APPLE_GCC=y NO_PKGCONFIG=y CONTRIB_SDL=y TILES=y

Dungeon Master

Posts: 240

Joined: Monday, 18th August 2014, 20:04

Post Tuesday, 26th December 2017, 17:23

Re: Problem building from source on Mac OS

Thanks for the update, this does indeed sound like a bad interaction with homebrew. Crawl uses a submodule version of lua in crawl-ref/source/contrib that is currently lua 5.1.4, and shouldn't use any system version of lua without some extra parameters. Homebrew by default installs everything in /usr/local, and is sort of notorious for leading to problems like this; so I guess what is happening is that the crawl Makefile and/or gnu utils aren't prioritizing the submodule version of lua. This may be fixable by someone with homebrew who can diagnose exactly what is going on, but to do this myself I'd have to uninstall macports so I won't be able to directly fix this any time soon. I did try a bit to replicate the problem by putting lua 5.3 header files in various places, but couldn't get it; I suspect that the problem needs whatever homebrew does to mess with clang include paths, not just a /usr/local install of lua.

erf

Temple Termagant

Posts: 11

Joined: Wednesday, 22nd April 2015, 19:11

Post Wednesday, 27th December 2017, 23:36

Re: Problem building from source on Mac OS

I'm a developer myself using mac and homebrew, but i don't have much knowledge of Make.. but isn't it possible to specify in the Makefile the Lua version used in the submodule ( 5.1.4 ) ?

Dungeon Master

Posts: 240

Joined: Monday, 18th August 2014, 20:04

Post Thursday, 28th December 2017, 18:23

Re: Problem building from source on Mac OS

erf wrote:I'm a developer myself using mac and homebrew, but i don't have much knowledge of Make.. but isn't it possible to specify in the Makefile the Lua version used in the submodule ( 5.1.4 ) ?


Yeah, it should be possible to force the submodule lua, but that's already supposed to be happening (and does on other build configurations). From googling it sounds like homebrew does something unusual to override paths for clang (not just setting environment variables; it sounds like it's replacing the binary itself, like e.g. ccache does), but it's a bit hard to figure out what exactly is happening without an actual homebrew install. If you do figure it out, let me know (or submit a PR!)

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 2 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.