Jump to content

Building on OS X from SVN Source


Recommended Posts

Hello, I've been experiencing a bug where the game crashes every time I try to move the screen around ingame (version r11863). I figured that I might be able to get rid of the problem by building the game from the SVN source. However, when I run ./update-workspaces.sh I always get this:


readlink: illegal option -- f
usage: readlink [-n] [file ...]
Updating bundled third-party dependencies...

bash -c 'mkdir -p output/{debug,release,test}/{FCollada/{FCDocument,FMath,FUtils,FColladaTest/{FCTestAssetManagement,FCTestExportImport,FCTestXRef}},FColladaPlugins/FArchiveXML}'
cp output/libFColladaSD.a ../lib/libFColladaSD.a
cp output/libFColladaSR.a ../lib/libFColladaSR.a

SpiderMonkey is already up to date

Building NVTT...

-- Setting optimal options
-- Processor: i386
-- Compiler Flags:
-- Looking for OpenGL - found
-- Looking for GLUT - found
-- Looking for DirectX - not found
-- Looking for GLEW - not found
-- Looking for Cg - not found
-- Looking for CUDA - not found
-- Looking for Maya - not found
-- Looking for JPEG - found
-- Looking for PNG - found
-- Looking for TIFF - found
-- Looking for OpenEXR - not found
-- Use thread library: -lpthread
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:

BINDIR
CG
CUDA
GLEW
GLUT
LIBDIR
OPENEXR


-- Build files have been written to: /Users/Nic/0ad/libraries/nvtt/src/build
[ 13%] Linking CXX shared library libnvcore.dylib
Built target squish
[ 16%] Built target posh
[ 32%] Built target nvcore
Linking CXX shared library libnvmath.dylib
[ 46%] Built target nvmath
Linking CXX shared library libnvimage.dylib
ld: warning: ignoring file /usr/local/lib/libpng.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
"_png_create_read_struct", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_create_info_struct", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_destroy_read_struct", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_set_longjmp_fn", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_set_read_fn", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_read_info", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_get_IHDR", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_set_expand", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_get_valid", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_set_packing", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_set_strip_16", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_set_gray_to_rgb", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_set_filler", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_get_sRGB", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_get_gAMA", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_set_gamma", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_read_update_info", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_read_image", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_read_end", referenced from:
nv::ImageIO::loadPNG(nv::Stream&) in ImageIO.cpp.o
"_png_get_io_ptr", referenced from:
user_read_data(png_struct_def*, unsigned char*, unsigned long)in ImageIO.cpp.o
"_png_error", referenced from:
user_read_data(png_struct_def*, unsigned char*, unsigned long)in ImageIO.cpp.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[3]: *** [src/nvimage/libnvimage.dylib] Error 1
make[2]: *** [src/nvimage/CMakeFiles/nvimage.dir/all] Error 2
make[1]: *** [src/nvtt/CMakeFiles/nvtt.dir/rule] Error 2
make: *** [nvtt] Error 2
ERROR: NVTT build failed

I've tried upgrading my libpng with macports and homebrew, same results. I've also tried building with the latest Nvidia Texture Tool, again same. However that's about where my debugging skills end. Does anybody have any suggestions? I've looked at Quacker's thread, it was similar to my issue but I've been unable to get past the libpng error. Here's my system info if it helps:


OS : Darwin 11.0.0 (Darwin Kernel Version 11.0.0: Sat Jun 18 12:56:35 PDT 2011; root:xnu-1699.22.73~1/RELEASE_X86_64)
CPU : x86_64, Intel Core2 Duo P8600 @ 2.40GHz (1x2x1), 2.39 GHz
Memory : 2048 MiB; 1625 MiB free
Graphics Card : NVIDIA NVIDIA GeForce 320M OpenGL Engine
OpenGL Drivers : 2.1 NVIDIA-7.2.9; OpenGL 2.1 NVIDIA-7.2.9
Video Mode : 1280x800:32

Thanks!

Link to comment
Share on other sites

Thanks for the reply but I'm pretty sure libpng is not the issue. libpng ships with OS X and it should be compatible. Still, I updated it with macports anyways. Here's my version of libpng:



$ port -v installed libpng
The following ports are currently installed:
libpng @1.4.12_0 (active) platform='darwin 11' archs='x86_64'

Maybe I'm just having issues with my compiler. Gonna paste the below text into my .profile and reboot, then try and build. I'm going to cross my fingers and hope for the best :)

export CC=/usr/bin/gcc-4.2

export CPP=/usr/bin/cpp-4.2

export CXX=/usr/bin/g++-4.2

Link to comment
Share on other sites

@bruno, sorry I thought the system info had my OS X version number in there somewhere. I'm on 10.7.0 (lion). And I was having the same issue before I updated libpng to 1.4.12_0 with macports. I think the original one was 1.4.11.

--edit--

gcc --version:

i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

I was about to try and change it to a non-llvm version. Do you have a command that I could run in Terminal? Otherwise I'm just gonna dig into my usr/bin and replace the alias (not sure if this is the best way to do it).

--edit--

Downloading High Performance Computing's gcc-lion binary. Will install and re-try ./update-workspaces.sh.

Edited by nickm
Link to comment
Share on other sites

Well that was disappointing. Installed gcc 4.8 from High Performance Computing and tested:


$ gcc --version
gcc (GCC) 4.8.0 20120603 (experimental)

Ran ./update-workspaces.sh again and same error. I'm gonna revert back to llvm and maybe I'll download the latest command line tools from apple later. Otherwise I'm pretty much out of ideas.

Link to comment
Share on other sites

Slightly off topic: that bug that I described where the game "crashes every time I try to move the screen around ingame" isn't quite accurate. It'll freeze within a second or two of moving the screen (i.e. pushing arrow keys) but if I just leave the game running for a minute it'll freeze up on its own. I end up killing the game by pushing cmd+option+escape (I was desperate and turns out this'll close the game, not sure if that's an actual key combo).

Anyways, I'm gonna take a break for an hour. I'll check back on this thread later to see if anyone has any new ideas :)

Link to comment
Share on other sites

Some odd suggestions, though note I don't own a Mac so I have no idea what I'm talking about.

Maybe the Mac equivalent of ldd would give you more useful information. Looks like this might be it:


otool -vf /usr/local/lib/libpng.dylib

Just to see how many versions of the library you have, this may or may not help:


locate libpng.dylib

On Linux this would give you a clue about what ld is thinking:


ldconfig -v | grep libpng

It appears on Mac you can force the package manager to install all versions of a library with the +universal flag.

Finally, there's this:

It is unsupported to have software installed in /usr/local while using MacPorts because of interference like this. Please remove or rename /usr/local, "sudo port clean hatari", and then try again.
Link to comment
Share on other sites

Well those two posts were helpful. I figured that the compiler wasn't using macport's libpng for some reason, so I created a symlink from the libpng.dylib in /usr/local to /usr/bin. Kind of a messy way to do it but it worked! But now I have another issue. Shared library "libnvimage.dylib" builds now, but immediately following it I get an error with libnvtt.dylib.


Linking CXX shared library libnvtt.dylib
Undefined symbols for architecture x86_64:
"nv::mem::malloc(unsigned long)", referenced from:
nvtt::Compressor::Compressor()in Compressor.cpp.o
nvtt::Compressor::Private::processInputImage(nvtt::Mipmap&, nvtt::InputOptions::Private const&) constin Compressor.cpp.o
nvtt::Compressor::enableCudaAcceleration(bool) in Compressor.cpp.o
nvtt::Compressor::Compressor()in Compressor.cpp.o
nvtt::Mipmap::asMutableFixedImage() in Compressor.cpp.o
nvtt::Mipmap::toFloatImage(nvtt::InputOptions::Private const&)in Compressor.cpp.o
nv::compressRGB(nv::Image const*, nvtt::OutputOptions::Private const&, nvtt::CompressionOptions::Private const&)in CompressRGB.cpp.o
...
"nv::mem::free(void const*)", referenced from:
nvtt::Compressor::Private::processInputImage(nvtt::Mipmap&, nvtt::InputOptions::Private const&) constin Compressor.cpp.o
nvtt::Compressor::Private::scaleMipmap(nvtt::Mipmap&, nvtt::InputOptions::Private const&, unsigned int, unsigned int, unsigned int) constin Compressor.cpp.o
nvtt::Compressor::Private::downsampleMipmap(nvtt::Mipmap&, nvtt::InputOptions::Private const&) constin Compressor.cpp.o
nvtt::Compressor::Private::initMipmap(nvtt::Mipmap&, nvtt::InputOptions::Private const&, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) constin Compressor.cpp.o
nvtt::Compressor::enableCudaAcceleration(bool) in Compressor.cpp.o
nvtt::Compressor::~Compressor()in Compressor.cpp.o
nvtt::Compressor::~Compressor()in Compressor.cpp.o
...
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[3]: *** [src/nvtt/libnvtt.dylib] Error 1
make[2]: *** [src/nvtt/CMakeFiles/nvtt.dir/all] Error 2
make[1]: *** [src/nvtt/CMakeFiles/nvtt.dir/rule] Error 2
make: *** [nvtt] Error 2
ERROR: NVTT build failed

Doesn't look like a problem with any external libraries this time, but it's the same error. I have no clue what could be causing it this time though.

Link to comment
Share on other sites

Could it be using the C compiler to compile C++? I guess that could cause linker errors like those.

Other than that, I have no idea. To be thorough, close your terminal and re-open it, to get rid of any weird variables. Then clean-workspaces, update-workspaces and start over.

Link to comment
Share on other sites

Thanks myconid, cleaning the workspace got rid of that weird error. Don't know why I didn't think of that :P

And to clear up any confusion, I'm just trying to get through update-workspaces.

The 'Building spidermonkey' stage complained about my gcc and g++ compilers so I opted for my HPC compilers instead of llvm:


export CC=/usr/local/bin/gcc
export CXX=/usr/local/bin/g++

Works perfectly. However I'm getting another weird error:


checking for 64-bit OS... yes
checking for Python version >= 2.5 but not 3.x... yes
checking for -dead_strip option to ld... no
checking for ANSI C header files... no
checking for working const... no
checking for mode_t... yes
checking for off_t... yes
checking for pid_t... yes
checking for size_t... yes
checking for __stdcall... no
checking for ssize_t... no
checking for st_blksize in struct stat... no
checking for siginfo_t... no
checking for stdint.h... yes
checking for the size of void*... configure: error: No size found for void*
ERROR: SpiderMonkey build failed

Void*? anyone know that that is? I cleaned the workspace again after I got this error but nothing changed.

Edited by nickm
Link to comment
Share on other sites

I think your build environment is slightly confusing or confused. It's quite possible to build the game on Lion with Apple's llvm-gcc, the only thing you have to do is define CC=gcc and CXX=g++ before update-workspaces.sh, since Spidermonkey's config script defaults to looking for gcc-4.2. I wouldn't go mixing compilers at each step though, just pick one (preferably Apple's latest command line tools for Xcode) and do a clean build.

Link to comment
Share on other sites

Well bruno, I didn't think that would work seeing as they are my defaults anyways but I went ahead and ran this:


export CC=gcc
export CXX=g++

Spidermonkey was already compiled under my HPC compilers, so the script skipped over it. Everything else worked fine. I opened pyrogenesis.xcodeproj and ran pyrogenesis. I didn't get any compile errors but text rendering is awful, as well as most of the menus. I'm getting yellow/green artifacts everywhere. When I ran a match none of the meshes loaded and I got a empty map. I know I downloaded the bleeding edge source but I guess I sort of expected it to be at least somewhat playable. Oh well, at least I got it to compile. I guess I'll just go file a bug report regarding my initial problem. And yeah bruno, my build environment is both confusing and confused. I think I have around three or four gcc compilers now ^_^

Link to comment
Share on other sites

i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

LLVM build 2336.1.00 was from around Xcode 4.1 (a little old now). While Apple keep pushing the accelerating update process, can you check there isn't an update to Xcode suggested to you?

Link to comment
Share on other sites

I know I downloaded the bleeding edge source but I guess I sort of expected it to be at least somewhat playable. Oh well, at least I got it to compile. I guess I'll just go file a bug report regarding my initial problem.

It may bleeding edge, but it should still be reasonably usable - as was Alpha 10, for that matter. What you are describing shouldn't ever happen on a stable system... Check you have the latest drivers, check the game is linking to the right drivers, check your opengl is working correctly (as opposed to software emulation).

Link to comment
Share on other sites

Yep I'm still using Xcode 4.2. I'm planning on updating someday, but I keep putting it off since its a pretty massive download.

Just so you know, between Xcode 4.1 and 4.3 there have been significant changes. Whereas before the command line tools were bundled with Xcode, now it's a separated ~160MB download available through Xcode preferences (or you can download them freely from ADC if you have an Apple ID, but I would recommend using Xcode so it will properly integrate). I think 4.2 is late enough that GCC was no longer bundled, but if say, you upgraded from an earlier version, then you might have fragments of GCC around in addition to LLVM. The process could be even more confusing if you upgraded from Snow Leopard. Also, installing a new Xcode won't clean up the old pre-4.3 developer tools (in e.g. /Developer) nor will removing the old app bundle, so you'll have to run the dev tools uninstall script - I would do that before upgrading. One nice thing about upgrading is that Xcode updates are now incremental, instead of requiring a new 3GB download every time, you can upgrade components via download preferences.

Also if you'd like to try Git and have an itch for a decent OS X build environment for the game, I've been working on a Github fork. I use it to build the official app bundles we distribute. I'd love to know how it handles your build environment at any rate and if the graphical defects disappear, as other people report similar problems when using Mac Ports and Homebrew, but not with our bundles, so I'm also inclined to blame a faulty build environment and the mercurial nature of Apple's dev tools.

Link to comment
Share on other sites

Oh man, I wish I had known there was an official OS X fork to begin with.. this would've been so much easier. Unfortunately I just got back home from vacation today and I'm back to my crappy 60kbs wireless broadband internet (250 mb/day cap). Sometime in the next few weeks I'll drop by the public library and I'll definitely check out those downloads. Thanks for all the advice guys, its a cool community you have here.

Btw- I managed to delay the game crash I was getting by about 30 minutes by changing the render paths to "fixed" in default.cfg.

Link to comment
Share on other sites

Okay as recommedned, I checked out SVN r12525 earlier. I proceeded to follow the build instructions and during the first step (update-workspaces) FCollada build failed.

Output:


Last login: Sat Aug 25 13:17:34 on ttys000
iMac:~ Geek$ cd /Users/Geek/0ad/build/workspaces
iMac:workspaces Geek$ ./update-workspaces.sh -j3
readlink: illegal option -- f
usage: readlink [-n] [file ...]
Updating bundled third-party dependencies...
bash -c 'mkdir -p output/{debug,release,test}/{FCollada/{FCDocument,FMath,FUtils,FColladaTest/{FCTestAssetManagement,FCTestExportImport,FCTestXRef}},FColladaPlugins/FArchiveXML}'
FCollada/FCollada.cpp
g++ -fvisibility=hidden -W -Wall -Wno-unused-parameter -Wno-unused-function -fPIC -fno-strict-aliasing -O0 -g -D_DEBUG -DRETAIL -IFCollada `pkg-config libxml-2.0 --cflags` -MD -MF output/debug/FCollada/FCollada.d -c FCollada/FCollada.cpp -o output/debug/FCollada/FCollada.o
FCollada/FColladaPlugin.cpp
g++ -fvisibility=hidden -W -Wall -Wno-unused-parameter -Wno-unused-function -fPIC -fno-strict-aliasing -O0 -g -D_DEBUG -DRETAIL -IFCollada `pkg-config libxml-2.0 --cflags` -MD -MF output/debug/FCollada/FColladaPlugin.d -c FCollada/FColladaPlugin.cpp -o output/debug/FCollada/FColladaPlugin.o
FCollada/FCDocument/FCDAnimated.cpp
g++ -fvisibility=hidden -W -Wall -Wno-unused-parameter -Wno-unused-function -fPIC -fno-strict-aliasing -O0 -g -D_DEBUG -DRETAIL -IFCollada `pkg-config libxml-2.0 --cflags` -MD -MF output/debug/FCollada/FCDocument/FCDAnimated.d -c FCollada/FCDocument/FCDAnimated.cpp -o output/debug/FCollada/FCDocument/FCDAnimated.o
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
In file included from FCollada/FCollada.h:49,
from FCollada/StdAfx.h:13,
from FCollada/FColladaPlugin.cpp:9:
FCollada/FUtils/FUtils.h:91:25: error: libxml/tree.h: No such file or directory
In file included from FCollada/FCollada.h:49,
from FCollada/StdAfx.h:13,
from FCollada/FCDocument/FCDAnimated.cpp:15:
FCollada/FUtils/FUtils.h:91:25: error: libxml/tree.h: No such file or directory
In file included from FCollada/FCollada.h:49,
from FCollada/StdAfx.h:13,
from FCollada/FCollada.cpp:9:
FCollada/FUtils/FUtils.h:91:25: error: libxml/tree.h: No such file or directory
In file included from FCollada/FCDocument/FCDAnimated.cpp:20:
FCollada/FCDocument/FCDAnimated.h:280: error: ‘xmlNode’ has not been declared
make: *** [output/debug/FCollada/FCDocument/FCDAnimated.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [output/debug/FCollada/FCollada.o] Error 1
make: *** [output/debug/FCollada/FColladaPlugin.o] Error 1
ERROR: FCollada build failed
iMac:workspaces Geek$

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...