project-navigation
Personal tools

Author Topic: Question re. compiling 2.3.1 for PPC/OSX 10.5  (Read 9067 times)

Offline dp

  • Rookie
  • ***
  • Posts: 38
    • View Profile
Question re. compiling 2.3.1 for PPC/OSX 10.5
« on: February 11, 2011, 12:58:23 am »
Step 2 of the instructions under "None universal binaries" at ufoai.ninex.info/wiki/index.php/Compile_for_Mac say "Edit the SDL_config.h in both the ppc and i386 directory."

But I find only one copy of SDL_config.h on my system. It's in /opt/local/var/macports/build/_opt_local_var_macports_sources etc./work/SDL-1.2.14/include. There are numerous ppc and i386 folders on my system, but none seem to be associated with SDL. The config file does seem to contain the BYTEORDER code that needs to be commented out, though. Is this just an error in the directions?

Offline dp

  • Rookie
  • ***
  • Posts: 38
    • View Profile
Re: Question re. compiling 2.3.1 for PPC/OSX 10.5
« Reply #1 on: February 15, 2011, 10:46:18 pm »
1. Having received no reply to my original question, I decided to forge ahead and see what happens. I commented out the BYTEORDER code in the config file, changed to the directory specified in Step 2, and typed "sudo port install libsdl-framework" into Terminal, as instructed. After a few seconds, I got a series of messages:

--->  Computing dependencies for libsdl-framework
--->  Dependencies to be installed: libsdl
Error: Requested variants "" do not match original selection "+universal".
Please use the same variants again, perform 'port clean libsdl' or specify the force option (-f).
Error: Failed to install libsdl
Log for libsdl is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_libsdl/main.log
Error: The following dependencies were not installed: libsdl
Error: Status 1 encountered during processing.

I was uncertain what to do, so I followed one of the message’s suggestions and typed "sudo port clean libsdl" into Terminal. It executed without error, so I tried the install again. This time, it completed ok and I was then able to finish Step 2.

2. Step 3 doesn't say what directory to be in but doesn't mention a need to change directories. So, I typed the specified command without changing and it seemed to execute ok until it tried to build p7zip. That yielded:

--->  Building p7zip
Error: Target org.macports.build returned: shell command failed (see log for details)
Log for p7zip is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_archivers_p7zip/main.log
Error: Status 1 encountered during processing.

When I checked the log, everything looked ok (except for a few warnings that some integer constants are too large for 'long' type) up until:

:info:build /var/tmp//ccJ51jOR.s:1442:Invalid mnemonic 's4w'
:info:build make[1]: *** [Main.o] Error 1
:info:build make: *** [sfx] Error 2
:info:build shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_archivers_p7zip/work/p7zip_9.13" && /usr/bin/make all3 " returned error 2
:error:build Target org.macports.build returned: shell command failed (see log for details)
:debug:build Backtrace: shell command failed (see log for details)
    while executing
"command_exec build"
    (procedure "portbuild::build_main" line 8 )
    invoked from within
"$procedure $targetname"
:info:build Warning: the following items did not execute (for p7zip): org.macports.activate org.macports.build org.macports.destroot org.macports.install
:notice:build Log for p7zip is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_archivers_p7zip/main.log

I have no idea how to correct this problem -- suggestions welcome.


Offline dp

  • Rookie
  • ***
  • Posts: 38
    • View Profile
Re: Question re. compiling 2.3.1 for PPC/OSX 10.5
« Reply #2 on: February 25, 2011, 05:54:29 pm »
1. I suspect the “None universal binaries” procedure (which I assume should read “Non-universal”) yields an Intel-only executable, rather than PPC-only, as I first thought. That might explain the warnings about overly large integer constants in the log, which I mentioned previously, since my G4 is 32-bit, and the absence of two SDL_config.h files on my system. So I decided to try the “Universal binaries” approach.

2. I followed the procedure at http://ufoai.ninex.info/wiki/index.php/Getting_the_source#Mac_OS_X to get the source.

3. Followed instructions at http://guide.macports.org/#using.port.selfupdate to run MacPorts’ selfupdate command (sudo port selfupdate) and upgrade outdated files (sudo port upgrade outdated).

4. Followed http://ufoai.ninex.info/wiki/index.php/Compile_for_Mac to install some libraries.

5. I could not perform Step 1.5 on that page because the link it gives (http://gtk-osx.org/) points to an Asian-language site that has nothing to do with Gtk2 or Glib2. I tried searching for another source and found http://sourceforge.net/apps/trac/gtk-osx/wiki/Build#Prerequisites. Unfortunately, the prerequisites indicate the procedure for installation is incompatible with a system that has MacPorts installed.

So, once again, I’m stymied. Help would be appreciated.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Question re. compiling 2.3.1 for PPC/OSX 10.5
« Reply #3 on: February 25, 2011, 06:32:05 pm »
gtk is not needed for the game - only for uforadiant - disable uforadiant via configure and you don't need gtk

Offline dp

  • Rookie
  • ***
  • Posts: 38
    • View Profile
Re: Question re. compiling 2.3.1 for PPC/OSX 10.5
« Reply #4 on: February 26, 2011, 04:51:12 am »
Quote
gtk is not needed for the game - only for uforadiant
and, by inference, Glib2 isn't needed either because it's used only by Gtk2, apparently. Thanks.

Quote
disable uforadiant via configure and you don't need gtk
I haven't done a make for uforadiant, so I assume this step is unnecessary (maybe impossible, because there should be nothing to disable)?

I forged ahead with Step 2, which calls first for running "selfupdate" and "upgrade outdated" again. The selfupdate proved to be superfluous, but the upgrade produced an error when it tried to update perl5:

--->  Installing perl5 @5.12.3_0+perl5_12
--->  Deactivating perl5 @5.8.9_0
--->  Cleaning perl5
--->  Activating perl5 @5.12.3_0+perl5_12
Error: Target org.macports.activate returned: Image error: /opt/local/bin/a2p is being used by the active perl5.8 port.  Please deactivate this port first, or use 'port -f activate perl5' to force the activation.

It then proceeded to do an "install perl5.8 @5.8.9_4+universal" and completed normally. I'm perplexed as to (1) why the upgrade would install an outdated version of perl5 after it had already installed 5.12.3_0; and (2) why it specified +universal for the 5.8.9_4 install, but not for 5.12.3_0. I hope (2) doesn't prove to be an error.

Anyway, I typed "sudo port activate perl5 @5.12.3_0+perl5_12" into Terminal and it seemed to work, even though I forgot to use the -f flag:

--->  Computing dependencies for perl5
--->  Activating perl5 @5.12.3_0+perl5_12
--->  Cleaning perl5

Next, I typed "sudo port install libsdl_image +universal" etc., as instructed in Step 2, but omitted gtkglext and gtksourceview2 because I infer they're unnecessary if one doesn't need uforadiant. This command seemed to work fine.

Step 2 says next to type "./configure --enable-universal" into Terminal, but this yielded "-bash: ./configure: No such file or directory". I also tried "sudo ./configure --enable-universal", but that yielded "sudo: ./configure: command not found".

I searched for info about ./configure -- the best source I found was at http://linux.about.com/od/ubupck_doc/a/ubupg06t03.htm. It says configure should run a script that generates a Makefile. Apparently, I'm making a syntax error and/or need to cd to somewhere -- regardless, I need help again.



Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Question re. compiling 2.3.1 for PPC/OSX 10.5
« Reply #5 on: February 26, 2011, 03:09:31 pm »
are you in your ufoai checkout directory? there should be a configure script

Offline dp

  • Rookie
  • ***
  • Posts: 38
    • View Profile
Re: Question re. compiling 2.3.1 for PPC/OSX 10.5
« Reply #6 on: February 26, 2011, 10:12:49 pm »
Aha. Yes, /Users/dp/ufoai contains a configure file (shown as a Unix Executable). Thank you.

I did a cd to that directory and typed "sudo ./configure --enable-universal". Several things I didn't expect happened: (1) It disabled uforadiant; (2) It couldn't find xvid.h or theora.h, even though I successfully did a "sudo port install XviD +universal libtheora +universal" last night; and (3) It couldn't find bfd.h, link.h, or CUnit/Basic.h.

Nonetheless, I continued on with Step 2 to see what would happen and typed "make" -- this yielded:

===> CC [game] src/game/g_actor.c
gcc-4.0: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags
make: *** [debug-darwin-powerpc/game/game/g_actor.c.o] Error 1

These don't sound like errors related to the files that configure couldn't find.

Step 2 notes "If you are having trouble getting things to compile, be aware that most of the issues come from installing autoconfig/automake as universal." and recommends trying a different install in this case. I tried it, but got the same results.

I searched my drive for xvid.h and found copies in 2 locations: /opt/local/include and /opt/local/var/macports/software/XviD/1.2.2.0/opt/local/include. The first was installed last night and the second was installed back when I was trying the "Non-universal binaries" procedure.

I also found 2 copies of theora.h in "theora" folders, in the same directories.

I found bfd.h in /Users/dp/ufoai/src/shared.

There's a link.h file in /Developers/SDKs/MacOSX10.5.sdk/usr/include/wx-2.8/wx, dated Sept 26 2005.

There's also a basic.h file in an "ogl" folder in the same directory, with the same date. I'd bet these link.h and basic.h files aren't the ones I need.

Evidently, I need to: (1) Find and install the correct link.h and basic.h files in the correct directories; and (2) Either move the other files to the directories configure expects to find them in (and I don't know where it's looking) or edit the configure file.

I used XCode to look at the configure file and, toward the end, found:

PKGDATADIR=${PKGDATADIR:-${PREFIX}/games/ufoai}
PKGBINDIR=${PKGBINDIR:-${PREFIX}/bin}
PKGLIBDIR=${PKGLIBDIR:-${PREFIX}/lib}

This may be what needs editing, but I'm unsure what the edits should be. I'm also unsure how to fix the errors produced by the options and flags in the makefile.

Offline dp

  • Rookie
  • ***
  • Posts: 38
    • View Profile
Re: Question re. compiling 2.3.1 for PPC/OSX 10.5
« Reply #7 on: March 07, 2011, 02:25:51 am »
I returned to this effort recently after studying a bit about UNIX and MacPorts.

1. Ran “sudo port -u upgrade outdated” to get any updated files and delete old ones.
2. Got a fresh copy of the ufoai source.
3. Added paths to the files that were reported as missing in my last attempt to my environment. The path environment shown by “set” is: /opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:$/opt/local/include:/Users/dp/ufoai/src/shared:/Developers/SDKs/MacOSX105.sdk/user/include
4. Ran “sudo ./configure --enable-universal” again.

I got the same errors as before. The messages that puzzle me are:

Setting custom data directory
Setting custom library directory
Could not find xvid.h
Could not find theora/theora.h
Found execinfo.h
Could not find bfd.h
Found sys/utsname.h
Could not find link.h
Could not find CUnit/Basic.h

5. I don’t understand why the configure script is setting custom data and library directories. It appears to me that the script should do this only if I specify custom directories in the command line.

6. Apparently, the script is looking for xvid.h, theora.h, bfd.h, and link.h in specific directories and they aren’t there, since adding paths to the ones I found previously didn’t help. Wish I knew where the script expects to find them -- I don’t understand the script well enough to determine this.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Question re. compiling 2.3.1 for PPC/OSX 10.5
« Reply #8 on: March 07, 2011, 07:46:55 am »
Try to export yourCFLAGS and LDFLAGS to your macport dirs.

I wil write more about this once i have a real keyboard under my fingers.

Offline dp

  • Rookie
  • ***
  • Posts: 38
    • View Profile
Re: Question re. compiling 2.3.1 for PPC/OSX 10.5
« Reply #9 on: March 07, 2011, 04:29:54 pm »
I added /opt/local/var/macports to my PATH environmental variable (I think this is what you were suggesting), but got the same messages from the configure script as before.

Something I noticed that may be relevant: The macports path contains files named cflags.diff, patch-CFLAGS.diff, and no-AM_CFLAGS.diff. It also contains patch-fix-apr_apu-ldflags.diff and patch-build-generic-platform.inc.in-LDFLAGS.diff, but not an ldflags.diff. It seems odd to me that there would be patches for ldflags when there apparently is no ldflags.diff file present.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Question re. compiling 2.3.1 for PPC/OSX 10.5
« Reply #10 on: March 07, 2011, 08:06:42 pm »
try this:
Code: [Select]
export CFLAGS=-I/path/to/macports/includes
export LDFLAGS=-l/path/to/macports/lib

Offline dp

  • Rookie
  • ***
  • Posts: 38
    • View Profile
Re: Question re. compiling 2.3.1 for PPC/OSX 10.5
« Reply #11 on: March 07, 2011, 08:38:01 pm »
No help -- got the same messages. (I notice you used =-I for CFLAGS and =-l for LDFLAGS. Thinking one might be a typo, I tried all permutations.)
« Last Edit: March 07, 2011, 08:42:59 pm by dp »

Offline dp

  • Rookie
  • ***
  • Posts: 38
    • View Profile
Re: Question re. compiling 2.3.1 for PPC/OSX 10.5
« Reply #12 on: March 08, 2011, 04:10:26 pm »
After some searching, I discovered that CFLAGS and LDFLAGS are flags for the compiler and linker, respectively, and my environment includes default paths to them. Therefore, changing those paths shouldn't affect the configure problems I've been reporting.

I concluded that Mattn was implicitly telling me to ignore those problems and try "make" again, after setting the flag paths per his instructions. Unfortunately, I got the same compiler errors as before:

gcc-4.0: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags
make: *** [debug-darwin-powerpc/game/game/g_actor.c.o] Error 1

Offline dp

  • Rookie
  • ***
  • Posts: 38
    • View Profile
Re: Question re. compiling 2.3.1 for PPC/OSX 10.5
« Reply #13 on: March 09, 2011, 05:00:12 pm »
I found documentation about the compiler switches mentioned in the error message (http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html#Option-Summary):

-S: Stop after the stage of compilation proper; do not assemble.

-E: Stop after the preprocessing stage; do not run the compiler proper.

-save-temps: Store the usual “temporary” intermediate files permanently.

-M: Instead of outputting the result of preprocessing, output a rule suitable for make describing the dependencies of the main source file.

-arch: Specifies the architecture of the target cpu(s), e.g, i386, ppc970, etc. Apple's GCC on Darwin does create “fat” files if multiple -arch options are used; it does so by running the compiler or linker multiple times and joining the results together with lipo.

I suspect the only one that should be used for my purposes is -arch. I've studied the makefile and makefile.local (the latter is created by the configure script) but don't understand them well enough to confidently delete the others. For example, I can't even find a place where the -save-temps switch is set.

Offline dp

  • Rookie
  • ***
  • Posts: 38
    • View Profile
Re: Question re. compiling 2.3.1 for PPC/OSX 10.5
« Reply #14 on: March 10, 2011, 05:57:27 pm »
I looked at the cflags files, to see whether there's anything obvious there that would enable me to easily change the compiler flags -- no dice.

I was hoping to learn the process for producing universal binaries and make them available to others so non-developer PPC users could run the dev version and participate in the beta testing (as well as run the stable version). But I'm spinning my wheels and can't make progress without help.