Page 1 of 1
Building on MacOsx
Posted: Sat Sep 07, 2013 5:55 am
by julian.guarin.2010
Hi everyone...
Im having this linking error:
Undefined symbols for architecture x86_64:
"Export_png8(char const*, int, int, int, int, int, int, unsigned char*, unsigned char*, int, bool)", referenced from:
Shape_chooser::export_png(char const*, Image_buffer8&, int, int)in shapelst.o
"Import_png8(char const*, int, int&, int&, int&, int&, int&, unsigned char*&, unsigned char*&, int&)", referenced from:
Shape_chooser::import_all_pngs(char*, int)in shapelst.o
Import_png(char const*, Shape_file_info*, unsigned char*, int, int)in shapelst.o
Import_png_tiles(char const*, Shape_file_info*, unsigned char*, int, int, bool)in shapelst.o
not to mention that I modified pngio.h in order to declare the offending functions, so shapelist.cc in line 802 could acknowledge the functions and use them...
I guess Im using the wrong kind of libpng perhaps, I mean... im trying to link against something made for another architecture..? Thanks.
Re: Building on MacOsx
Posted: Sat Sep 07, 2013 6:58 am
by Dominus
Are you trying with svn or some other version? (Use svn)
What version of libpng are you using?
How did you get the libs? Self compiled or via macports, fink, homebrew?
Can you upload your config.log file and link here?
Re: Building on MacOsx
Posted: Sat Sep 07, 2013 6:09 pm
by julian.guarin.2010
Thanks on your answer...
Well I reviewed some changelogs and yes Exult uses libpng 1.2 and I have 1.5, as Im using macports and it is a pain to downgrade to libpng 1.2.
Related to the error message: What I did was to manually insert PNGIO.C into shapelist.cc (cause the declarations were subject of macro validation, which seems was not set).
That way I could manage to handle the error message I posted. However for each hole you cover and new one fully opens!
, and that it is libpng15 doesn't work, in particular this error messages pops:
shapelst.cc: In function ‘int Import_png32(const char*, int&, int&, int&, int&, int&, unsigned char*&, bool)’:
shapelst.cc:122: error: invalid use of incomplete type ‘struct png_struct_def’
/opt/local/include/png.h:869: error: forward declaration of ‘struct png_struct_def’
I actually changed the source, inserting the code of pngio.c explicitly inside shapelst.cc, i'm aware that maybe other source files such as shapelst.cc may call these functions... I did it in order to understand what is the problem with libpng15...
Im using the version 1.4.9rc1, Im not sure if this is the last snapshot (guess it is not) and Im going to checkout using SVN and see if I got it this time right.
I haven't upload the configlog, because I don't have where to... and i dont know if the forum rules allow to upload such...
thank you
Re: Building on MacOsx
Posted: Sat Sep 07, 2013 6:48 pm
by Dominus
Use svn, there have been fixes for png. It works with libpng 1.4x - I aven't tsted with 1.5x yet
Re: Building on MacOsx
Posted: Sun Sep 08, 2013 7:43 am
by julian.guarin.2010
Thanks, I've builded the SVN snapshot. And indeed the png worked!. The only issue is that I have to rename manually the ucparse.hh to ucparse.h. The other issue was with X11, but installing the XQuartz libr did the Job. It builded, I haven't test for crashes yet either.
Thanks!
Re: Building on MacOsx
Posted: Sun Sep 08, 2013 9:35 am
by Dominus
Yeah that ucparse problem haunts us abd we have no clear way to fix it ;(
Great that it built. Enjoy!
Re: Building on MacOsx
Posted: Mon Sep 09, 2013 4:28 am
by julian.guarin.2010
Hehe not so fast.
The build took place, and I have the execution file. But sadly when I type ./exult I got this message:
Platform: Mac OS X
Exult path settings:
Data : data
Digital music : data/music
Unable to initialize SDL: No available video device
I have looked down through this forum, and into README & README.MacOSX files, as well as FAQs and surfed in Google but haven't found any info. I understand the problem is involved with SDL library. The libsdl ver I have is:
imacjulian:trunk imac$ port info libsdl
libsdl @1.2.15_3 (devel, multimedia)
Variants: universal, [+]x11
Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide fast access to the graphics
framebuffer and audio device. It is used by MPEG playback software, emulators, and many popular games, including
the award winning Linux port of "Civilization: Call To Power." Simple DirectMedia Layer supports Linux, Win32,
BeOS, Mac OS, Solaris, IRIX, and FreeBSD.
Homepage:
http://www.libsdl.org/
Library Dependencies: xorg-libXext, xorg-libXrandr, xrender
Conflicts with: libsdl-devel
Platforms: macosx, freebsd
License: LGPL-2.1+
Maintainers:
jmr@macports.org,
openmaintainer@macports.org
So, I'm missing something that is pretty obvious, if it's so, Im sorry I tried to figured it out.... I was about to start debugging by myself the code (I will anyway) but wanted to ask first here if there's something wrong.
Thanks for your help....!
Re: Building on MacOsx
Posted: Mon Sep 09, 2013 4:42 am
by Dominus
Hmm, you need to build SDL with the x11 variant I think.
For a test, build exult without Exult Studio support and try that. If that succeeds, then have macports build sdl with x11 (sudo port install -f libsdl +x11)
(Btw, with doing that from the start you wouldn't have had to install xquartz because macports would have installed everything needed for x11 - I think
)
Re: Building on MacOsx
Posted: Mon Sep 09, 2013 6:34 am
by julian.guarin.2010
Does it have anything to do with the special X11 libraries?
Cause ./configure reports (with all the flags set) says the X11 special libraries are not present....
I will try and let you know!
Thank you!
Re: Building on MacOsx
Posted: Mon Sep 09, 2013 6:41 am
by julian.guarin.2010
Ok I checked with the info command it was already installed....
Re: Building on MacOsx
Posted: Mon Sep 09, 2013 6:50 am
by julian.guarin.2010
I have a tech query... How can I debug the program? I mean, sure with GDB, but can I do it in Eclipse or Xcode? What do you recommend?
By the way the build is crashing on Export_png (which is a thing I suspect is needed by exult_studio).
Thanks!
Re: Building on MacOsx
Posted: Mon Sep 09, 2013 6:56 am
by julian.guarin.2010
Well that did it!...
THANKS!
Now I will try to figure out what happens when setting exult_studio.
I would like to debug step by step and study the code of the program, how would I do that? Does it exists a Eclipse project file? Is there a doc which explains how is the source code arranged? I mean I would like to know the code and perhaps help you guys...
Thanks for the help!
Julian.
Re: Building on MacOsx
Posted: Mon Sep 09, 2013 7:20 am
by Dominus
Hmm, what did it? Configure without ES (Exult Studio)?
I'll have to try myself now what happens. Normally it was something wrong with the compiler flags etc.
What do you pass for those before running configure, which SDK are you building against (or what is your OS version). Up to now I mostly built against the 10.6 SDK as that still brings its own x11 libs, but I haven't tried with an x11/ES build in a while. (Mostly because that adds a lot of libs to the mix that are not needed for playing and debugging normal play).
There is no eclipse or xcode project file. If you want to get more in depth knowledge of the structure and what is where, you best come to our irc channel #exult on freenode. Wjp or Marzo should be better equipped to help with that (though irc can mean you may have to wait for responses for a bit).
I do welcome any help you can offer
Re: Building on MacOsx
Posted: Mon Sep 09, 2013 8:53 am
by Dominus
Ok, just checked and got it to work with macports libs and xquartz.
The only thing I needed to change was configure.ac:665 - instead of pointing at /usr/x11/lib, point at /opt/x11/lib:
SYSLIBS="$SYSLIBS -L/opt/X11/lib -lX11"
my configure line:
./configure --enable-exult-studio --enable-macosx-studio-support --disable-sdltest --disable-oggtest --disable-vorbistest --disable-alsa --disable-fluidsynth
(and then following instructions on readme.macosx, append PATH with the path to the exult_source/mapedit folder and copying exult_studio.glade to the data folder)
Exult started fine and Exult Studio started fine via ctrl+cmd+m (only after I finally entered the path to the mapedit folder correctly...
)
Re: Building on MacOsx
Posted: Mon Sep 09, 2013 6:38 pm
by julian.guarin.2010
great! I will try that configure...
I guess the problem is all about configuring flags because theres a shadowed macro that should not be.... that declares the PNGIO.c functions.
I will check on IRC channel and will check it out!
Thank you
Re: Building on MacOsx
Posted: Mon Sep 09, 2013 9:06 pm
by julian.guarin.2010
Ok I've tried. that configuration doesn't make it. The macros declaring png.h functions:
g++ -DHAVE_CONFIG_H -I. -I.. -I./../headers -I./.. -I./../shapes -I./../imagewin -I./../conf -I./../gamemgr -I./../files -I./../server -I./../usecode -I./../shapes/shapeinf -D_REENTRANT -I/opt/local/include/libglade-2.0 -I/opt/local/include/gtk-2.0 -I/opt/local/lib/gtk-2.0/include -I/opt/local/include/pango-1.0 -I/opt/local/include/gio-unix-2.0/ -I/opt/local/include -I/opt/local/include/cairo -I/opt/local/include/atk-1.0 -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/libpng15 -I/opt/local/include -I/opt/local/include/gdk-pixbuf-2.0 -I/opt/local/include/libpng15 -I/opt/local/include/pango-1.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/libxml2 -DMACOSX -O2 -Wno-long-long -DEXULT_DATADIR=\"/Library/Application\ Support/Exult/data\" -MT shapelst.o -MD -MP -MF .deps/shapelst.Tpo -c -o shapelst.o shapelst.cc
shapelst.cc: In member function ‘time_t Shape_chooser::export_png(const char*, Image_buffer8&, int, int)’:
shapelst.cc:724: error: ‘Export_png8’ was not declared in this scope
shapelst.cc: In function ‘void Import_png(const char*, Shape_file_info*, unsigned char*, int, int)’:
shapelst.cc
error: ‘Import_png8’ was not declared in this scope
shapelst.cc: In function ‘void Import_png_tiles(const char*, Shape_file_info*, unsigned char*, int, int, bool)’:
shapelst.cc
error: ‘Import_png8’ was not declared in this scope
shapelst.cc: In member function ‘void Shape_chooser::import_all_pngs(char*, int)’:
shapelst.cc
error: ‘Import_png8’ was not declared in this scope
make[2]: *** [shapelst.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
I guess there's a miss in the configuration in the build or my dev libs are not right installed.
Maybe there's a way to compare the libs you have installed, how are those installed and I would check how are these installed. If you agree maybe we could check.
I've started a blog post to build exult and exult studio under Mac OSX. I've written down all the issues you have helped me to solve so far, all this info is going to be in that post... let me know if this is ok with you...
Thanks again!
Re: Building on MacOsx
Posted: Mon Sep 09, 2013 9:18 pm
by julian.guarin.2010
Well, I disabled the exult studio option and compiled right again ..... so the problem seems to be libpng and exult_studio.
Re: Building on MacOsx
Posted: Mon Sep 09, 2013 9:46 pm
by Dominus
Strange since you've been able to build it before (only it didn't run)
To simplify things I only used a fresh install (I did that fresh install last weekend because I switched to Maverick) of MacPorts and only grabbed the libs from there.
port installed gives me:
libpng @1.5.17_0+universal (active)
libsdl @1.2.15_3+universal+x11 (active)
(I always build universal because I need to test 32bit stuff for Dosbox as well).
Then I have xquartz installed (which resides in /opt/x11 by default)
Changed configure.ac to use that X11 location.
Ran autogen and the above configure.
The only thing I also have is the following in my ~/.profile additional to the path settings MacPorts changes:
Code: Select all
export CFLAGS=-I/opt/local/include
export LDFLAGS=-L/opt/local/lib
export CXXFLAGS=$CFLAGS
export CPPFLAGS=$CXXFLAGS
export ACLOCAL_FLAGS="-I /opt/local/share/aclocal"
export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig"
--with-ogg-libraries=/opt/local/lib --with-ogg-includes=/opt/local/include --with-vorbis-libraries=/opt/local/lib --with-vorbis-includes=/opt/local/include
--with-ogg=/opt/local/ --with-vorbis=/opt/local/
Probably the flags help since it compiles fine and runs fine for me this way.
Now, please make sure you are trying this on an unmodified SVN (except for the configure.ac thing). SVN! NOT the rc1 sources.
Where is that blog post?
Re: Building on MacOsx
Posted: Tue Sep 10, 2013 4:58 am
by julian.guarin.2010
Yeah, Its strange.... cause the first time I built on the trunk there was no issues building with the pngio.c, but running with SDL (No video device crash), perhaps
I should delete the svn checkout directory and re-checkout... I guess I will try that.
libpng @1.5.17 (graphics)
Variants: universal
libsdl @1.2.15_3 (devel, multimedia)
Variants: universal, [+]x11
I will try and let you know tommorow (it 2 am here u know
)
The focus of the blog post would be the problems that would come in as you try to build exult on a Mac. Mavericks should be released today so I guess it would be more relevant nowadays. When I'm done with this I will give you author permissions and perhaps, if you have the time, would you like to make an editorial review of the post? It would be very kind of you.
Re: Building on MacOsx
Posted: Tue Sep 10, 2013 5:05 am
by julian.guarin.2010
What I want to do with the Blog is nothing special... random articles of programming topics, in Mac OSX, aimed to people who came from or still is in Linux world...
Being a FAN of U7 as I am, and since ever wanted to take a deep look into exult code, I think the first post about Exult building would be a catchy thing.
Well I will try to rebuild and I'll let you know.
Re: Building on MacOsx
Posted: Tue Sep 10, 2013 6:20 am
by Dominus
Btw, don't check with port info which ports you have installed because that only gives you which version is available on MacPorts. Use "port installed" instead (you can also use "port installed portname" (replace portname with libpng, for example)). Isn't relevant in this case but still.
To check whether you are truly on latest SVN, do "svnversion" in the Exult source folder. It should return "7432" (if you grabbed SVN via subversion).
Seems you could be interested in my snapshot script:
https://dl.dropboxusercontent.com/u/773 ... napshot.sh
To explain, for my snapshot building I made a new prefix in /opt for each arch I'm building for, exult.i386, exult.x86_64, exult.ppc.
These prefixes are independent of MacPorts and only contain what is needed for Exult (and Pentagram, Nuvie, xu4, DOSBox) snapshots.
To be on the safe side, I'm building each arch after the other. One could do that in one go but for finding build failures, I prefer this way. The error handling in this script mostly helps me with this as well, so I'm not uploading bad snapshots.
I'm also using old SDKs for compatibility sake. SDK 10.5 for ppc and i386, and SDK 10.6 for x86_64. I found that newer SDKs are not always fully backwards compatible even if you set the correct deployment target. The prefixes are also built against these SDKs.
For testing I have virtual machines of OS X 10.5 + 10.6 (intel) and an old Mac Mini with OS X 10.4
When Mail.app receives an SVN commit mail, it triggers this script automatically, so as long as my machine is running, I do not need to start this script manually. Of course, Maverick's Mail.app hates Gmail, so right now one never knows when Mail.app receives mail
And then I made a special prefix for building Exult Studio at /opt/exult.x86_64.gtk which contains everything self compiled for building ES. It's not up to date and therefore I made my above tests with MacPorts. Since I found no easy way to bundle a working Exult + Exult Studio, this prefix is not being kept as up to date as the others
The build script for that:
https://dl.dropboxusercontent.com/u/773 ... ult.gtk.sh
It's basically the same approach as with MacPorts, only other prefix for all the flags.
Re: Building on MacOsx
Posted: Wed Sep 11, 2013 6:28 pm
by julian.guarin.2010
Muchas gracias! Thank you so much Dominus. Great info! I will study with detail this friday on!,
I let you know!
BTW svnversion command returned 7234M
Re: Building on MacOsx
Posted: Wed Sep 11, 2013 6:39 pm
by Dominus
Revision 7234 is from December 2012, where did you get that? Get it via SVN from here
https://sourceforge.net/p/exult/code/HEAD/tree/ (choose http to get the link to check it out or on that page see if the snapshot feature works).
Also M means you modified the source, so make sure your only modification is the configure.ac thing...
(Or just maybe you got the numbers confused and it is 7432 after all?
)
Re: Building on MacOsx
Posted: Tue Oct 01, 2013 9:05 pm
by julian.guarin.2010
Hi everyone!.
Hello Dominus. I tried your configuration script to compile a svn snapshot.
7433 Was the svnversion I used (no modifications).
When I used the flags to compile exult studio I got the same error I posted days ago:
g++ -DHAVE_CONFIG_H -I. -I.. -I./../headers -I./.. -I./../shapes -I./../imagewin -I./../conf -I./../gamemgr -I./../files -I./../server -I./../usecode -I./../shapes/shapeinf -D_REENTRANT -I/opt/local/include/libglade-2.0 -I/opt/local/include/gtk-2.0 -I/opt/local/lib/gtk-2.0/include -I/opt/local/include/pango-1.0 -I/opt/local/include/gio-unix-2.0/ -I/opt/local/include -I/opt/local/include/cairo -I/opt/local/include/atk-1.0 -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/libpng15 -I/opt/local/include -I/opt/local/include/gdk-pixbuf-2.0 -I/opt/local/include/libpng15 -I/opt/local/include/pango-1.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/libxml2 -DMACOSX -O2 -Wno-long-long -DEXULT_DATADIR=\"/Library/Application\ Support/Exult/data\" -MT shapelst.o -MD -MP -MF .deps/shapelst.Tpo -c -o
shapelst.o shapelst.cc
shapelst.cc: In member function ‘time_t Shape_chooser::export_png(const char*, Image_buffer8&, int, int)’:
shapelst.cc:724: error: ‘Export_png8’ was not declared in this scope
shapelst.cc: In function ‘void Import_png(const char*, Shape_file_info*, unsigned char*, int, int)’:
shapelst.cc
error: ‘Import_png8’ was not declared in this scope
shapelst.cc: In function ‘void Import_png_tiles(const char*, Shape_file_info*, unsigned char*, int, int, bool)’:
shapelst.cc
error: ‘Import_png8’ was not declared in this scope
shapelst.cc: In member function ‘void Shape_chooser::import_all_pngs(char*, int)’:
shapelst.cc
error: ‘Import_png8’ was not declared in this scope
make[2]: *** [shapelst.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
That's when trying to build exult Studio.
And then I tried to use the exultsnapshot script (which doesn't compile exult studio). When I run it
./configure $CONF_OPT --with-macosx-static-lib-path=/opt/exult.x86_64/lib || {
DIE=1
error_exit "$(( $LINENO -2 )) : x86_64 configure failed."
}
suggests that there is a /opt/exult.x86_64 directory that I don't have...
I guess I will try this on windows or Linux to see if there is a difference.
Re: Building on MacOsx
Posted: Tue Oct 01, 2013 10:33 pm
by Dominus
Of course you need to adjust this for your paths...
Re: Building on MacOsx
Posted: Wed Oct 02, 2013 2:22 pm
by julian.guarin.2010
Yeah, sure, my path. The name is what confuses me.. what static library files is this directory holding? That's what confuses me.. the static libs the compiling will produce? Or a bundle of libs that I don't know what are those....
Sorry about the confusion but I don't know what libs are supposed to contain the path associated to the environment variable --with-macosx-static-lib-path.
Thanks!
Re: Building on MacOsx
Posted: Wed Oct 02, 2013 3:26 pm
by Dominus
As you use macports it's /opt/local/lib
Please do the following:
- Start a new terminal session and try again.
- run svnversion in the sourcefolder
- Please copy/paste EVERYTHING you did prior to make
- put your config.log somewhere for download, for example pastebin or dropbox
- Copy/paste your ~/.profile entries
Try (in a new Terminal session):
Code: Select all
export PATH=/opt/local/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
export CPPFLAGS='-I/opt/local/include'
export CFLAGS='-I/opt/local/include'
export CXXFLAGS='-I/opt/local/include'
export LDFLAGS='-L/opt/local/lib'
export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig"
./autogen.sh
./configure --enable-exult-studio --enable-macosx-studio-support --disable-sdltest --disable-oggtest --disable-vorbistest --disable-alsa --disable-fluidsynth --disable-mt32emu
make clean
make
Re: Building on MacOsx
Posted: Thu Oct 03, 2013 1:14 am
by monotremata
Just curious, why are you building an X11 version for OS X instead of going the Mac friendly 'normal' route??
Never thought of that before. I bet I could give you all kinds of new headaches with compiling all over again Dominus!
Re: Building on MacOsx
Posted: Thu Oct 03, 2013 2:16 am
by Dominus
Mono, because someone would need to iron out the bugs and make it possible. Took The Gimp YEARS to be finally stable enough.
And X11 is only needed for when building with Exult Studio support.
Re: Building on MacOsx
Posted: Thu Oct 03, 2013 10:19 pm
by julian.guarin.2010
Dominus: it did do! (7433)
Because of the name of the folder on your scripts I didn't realize those were the static libs path in general, i thought it was for a specific static lib.
But now I get it.. The compile went Ok with exult studio support!!
Thank you very much.
Re: Building on MacOsx
Posted: Fri Oct 04, 2013 7:41 am
by Dominus
Yes, macports installs dynamic and static libs by default (*.dylib, *.a)
Great you got it working now