Page 1 of 1

Compiling on Mac OS X

Posted: Wed Nov 18, 2009 9:53 pm
by BrilliantWinter

Hey, I figured I would post a quick tutorial on how to compile the HEAD of VBA-M on Mac OS X (I am running Snow Leopard, but it should work for most other systems).

 

<ol style="list-style-type:decimal;">[*]Open Terminal and CD to a directory where you would like the files stored - cd ~/Desktop

[*]Download the most recent copy of the code (may be buggy) - svn co https://vbam.svn.sourceforge.net/svnroot/vbam vbam

[*]Download and install MacPorts (Follow their instructions for the package installer)

[*]Change back to terminal and install cmake - sudo port install cmake

[*]Change back to terminal and install libpng - sudo port install libpng

[*]Download the runtime library of SDL and copy the SDL.Framework folder in the DMG to /library/Frameworks

[*]Download the sourcecode of SDL, untar it, and cd to the directory in terminal

[*]Once in the SDL directory, run ./configure, make, sudo make install

[*]CD to the trunk directory of the SVN copy of VBA-M (in my case ~/Desktop/vbam/trunk)

[*]Run the following in terminal - cmake .

[*]Run the following in terminal - make

[*]If you run into any issues with png.h not being found, search your computer for png.h and pngconf.h (most likely in /opt/local/include/libpng12/) and copy both files to /usr/local/include

[*]Run the following in terminal - sudo make install

[*]Run the following in terminal - vbam PATH_TO_ROM

[*]Have fun

</ol>

 

This will not have VBA-M working out of the box however, as save files (among other things) will fail, but it will get ROMs running at least My bad, turns out Pokemon Fire-Red has issues saving due to the protection issues or whatever. Saving works fine in most games

 

Spenser


Compiling on Mac OS X

Posted: Mon Jun 21, 2010 10:13 pm
by Keybounce

I am unable to compile.

 

Code: Select all

Kleiman-ibook:trunk michael$ port installed cmake libpng SDL 
The following ports are currently installed:
 cmake @2.8.1_2 (active)
 libpng @1.2.43_0 (active)
Kleiman-ibook:trunk michael$ port installed | grep -i sdl
 libsdl @1.2.14_8+no_x11
 libsdl @1.2.14_8+no_x11+universal (active)
 libsdl_image @1.2.10_2+universal (active)
 libsdl_mixer @1.2.11_0+universal (active)
 libsdl_ttf @2.0.9_1+universal (active)
Kleiman-ibook:trunk michael$ cmake .
-- Loaded CMakeASMInformation - ASM support is still experimental, please report issues
-- Could NOT find SFML  (missing:  SFML_LIBRARY SFML_INCLUDE_DIR)
CMake Error at /opt/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:70 (MESSAGE):
 Could NOT find SFML (missing: SFML_LIBRARY SFML_INCLUDE_DIR)
Call Stack (most recent call first):
 CMakeScripts/FindSFML.cmake:78 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
 CMakeLists.txt:44 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!
Kleiman-ibook:trunk michael$ 

What is SFML?

 

10.5.8, PPC.


And I have my answer:

 

http://www.sfml-dev.org/

 

Downloaded the 1.6 universal binary tarball.

Put the frameworks into /opt/local/Library/Frameworks

 

Yet I still get

Code: Select all

-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Could NOT find SFML  (missing:  SFML_LIBRARY SFML_INCLUDE_DIR)
-- Found ZLIB: /usr/lib/libz.dylib
-- Found PNG: /opt/local/lib/libpng.dylib
CMake Error at /opt/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:70 (MESSAGE):
 Could NOT find SFML (missing: SFML_LIBRARY SFML_INCLUDE_DIR)
Call Stack (most recent call first):
 CMakeScripts/FindSFML.cmake:78 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
 CMakeLists.txt:44 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!

 

Code: Select all

Kleiman-ibook:trunk michael$ ls /opt/local/Library/Frameworks/
total 0
0 Python.framework/		0 sfml-network.framework/
0 SFML.framework/		0 sfml-system.framework/
0 sfml-audio.framework/		0 sfml-window.framework/
0 sfml-graphics.framework/

 

Python has been there for a while.

 

Other things were found in /opt/local (it's where Macports puts everything).

 

So, can someone help me understand CMakeScripts/FindSFML.cmake, so I can figure out how to tell it about /opt/local/Library/Frameworks?

 

EDIT: Never mind, I found it.

 

Code: Select all

SET(SFML_INCLUDE_SEARCH_DIR
   ~/Library/Frameworks
   /Library/Frameworks
   /usr/local/include/SFML
   /usr/include/SFML
   /usr/local/include
   /usr/include
   /sw/include/SFML # Fink
   /sw/include
   /opt/local/include/SFML # DarwinPorts
   /opt/local/include
   /opt/csw/include/SFML # Blastwave
   /opt/csw/include
   /opt/include/SFML
   /opt/include
)

 

Notice that it has the home and system Library/Frameworks (for Apple, and personal), but not the /opt/local/Library/Frameworks (for local system installs).

 

For your patching pleasure. Feed this to patch -p0.

 

Code: Select all

Kleiman-ibook:trunk michael$ diff -u CMakeScripts/FindSFML.cmake~ CMakeScripts/FindSFML.cmake
--- CMakeScripts/FindSFML.cmake~	2010-06-18 21:28:20.000000000 -0700
+++ CMakeScripts/FindSFML.cmake	2010-06-21 21:17:22.000000000 -0700
@@ -26,6 +26,7 @@
    /usr/include 
    /sw/include/SFML # Fink 
    /sw/include 
+    /opt/local/Library/Frameworks
    /opt/local/include/SFML # DarwinPorts 
    /opt/local/include 
    /opt/csw/include/SFML # Blastwave 
@@ -41,6 +42,7 @@
    /usr 
    /sw 
    /opt/local 
+    /opt/local/Library/Frameworks
    /opt/csw 
    /opt 
) 

 

Crashes during compile:

 

Code: Select all

Scanning dependencies of target vbamcore
[ 29%] Building CXX object CMakeFiles/vbamcore.dir/src/Util.o
[ 30%] Building CXX object CMakeFiles/vbamcore.dir/src/common/Patch.o
[ 31%] Building C object CMakeFiles/vbamcore.dir/src/common/memgzio.o
[ 32%] Building CXX object CMakeFiles/vbamcore.dir/src/gba/agbprint.o
[ 34%] Building CXX object CMakeFiles/vbamcore.dir/src/gba/bios.o
In file included from /Volumes/Michael/Documents/Development/vbam/trunk/src/gba/GBAinline.h:10,
                from /Volumes/Michael/Documents/Development/vbam/trunk/src/gba/bios.cpp:7:
/Volumes/Michael/Documents/Development/vbam/trunk/src/gba/GBALink.h:3:28: error: SFML/Network.hpp: No such file or directory
/Volumes/Michael/Documents/Development/vbam/trunk/src/gba/GBALink.h:119: error: ‘sf’ has not been declared
/Volumes/Michael/Documents/Development/vbam/trunk/src/gba/GBALink.h:119: error: ‘IPAddress’ does not name a type
make[2]: *** [CMakeFiles/vbamcore.dir/src/gba/bios.o] Error 1
make[1]: *** [CMakeFiles/vbamcore.dir/all] Error 2
make: *** [all] Error 2
Kleiman-ibook:trunk michael$ ls /opt/local/Library/Frameworks/SFML.framework/Headers/
total 28
0 Audio/		 4 Graphics.hpp		 4 System.hpp
4 Audio.hpp		 0 Network/		 0 Window/
8 Config.hpp		 4 Network.hpp		 4 Window.hpp
0 Graphics/		 0 System/
Kleiman-ibook:trunk michael$ 

 

I do not know my way around CMake.

I don't know what it's passing to the compiler, or why it can't be found.

 

Anyone?


(NB: Somehow I posted a new reply to my last message as an edit.

I'm posting this so that if you saw my first message, and didn't see the second, that you know to go back and re-read that last message.)

 

(Btw: Automatically turning a new post into an edit/append is BAD; I hope that's not what the forum is doing. It means that people who only read new posts will never see changes at the end of a thread.)


Alright, the next step in figuring out what's up. After all, why would it fail to find that one header in that file (Hmm, it's C++), but no other file gave any errors with SFML?

 

Kleiman-ibook:trunk michael$ egrep SFML src//.h

src/gba/GBALink.h:#include

src/gba/GBASockClient.h:#include

 

Ahh...

 

Is it really the case that the only place this is used is for the link support? And then only the networking framework?

 

Meanwhile, I found the CFLAGS:

 

Code: Select all

Kleiman-ibook:trunk michael$ cat CMakeFiles/vbamcore.dir/flags.make
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8

# compile C with /usr/bin/gcc
# compile CXX with /usr/bin/c++
C_FLAGS = -O3 -Wall -I/Volumes/Michael/Documents/Development/vbam/trunk/fex -I/opt/local/include -I/opt/local/include/SDL   -DSYSCONFDIR='"/etc"' -DWITH_LIRC='0' -DVERSION='"1.8.0-SVN"' -DPKGDATADIR='"/usr/local/share/vbam"' -DPACKAGE=''

C_DEFINES = -DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DHAVE_ZLIB_H -DFINAL_VERSION -DSDL -DUSE_OPENGL -DBKPT_SUPPORT -DC_CORE

CXX_FLAGS = -O3 -Wall -I/Volumes/Michael/Documents/Development/vbam/trunk/fex -I/opt/local/include -I/opt/local/include/SDL   -DSYSCONFDIR='"/etc"' -DWITH_LIRC='0' -DVERSION='"1.8.0-SVN"' -DPKGDATADIR='"/usr/local/share/vbam"' -DPACKAGE=''

CXX_DEFINES = -DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DHAVE_ZLIB_H -DFINAL_VERSION -DSDL -DUSE_OPENGL -DBKPT_SUPPORT -DC_CORE

 

Lets play with those -I options just a bit ...

 

(Cmake seems strange. The final makefiles are like assembly output from a compiler, compared to what a makefile normally looks like. )


Alright, the "workaround":

 

Add "-F/opt/local/Library/Frameworks" to the two FLAGS lines.

 

Now, this is a generated file. Where is the source that creates this file? (anyone?)


Compiling on Mac OS X

Posted: Tue Jun 22, 2010 1:29 am
by Squall Leonhart

(Btw: Automatically turning a new post into an edit/append is BAD; I hope that's not what the forum is doing. It means that people who only read new posts will never see changes at the end of a thread.)

 

all double posts made within 24 hours of each other are merged.


Compiling on Mac OS X

Posted: Tue Jun 22, 2010 2:30 am
by Keybounce

Alright, one more link issue.

 

cat CMakeFiles/vbam.dir/link.txt

 

/usr/bin/c++ -O3 -Wall -Wl,-search_paths_first -headerpad_max_install_names CMakeFiles/vbam.dir/src/sdl/debugger.o CMakeFiles/vbam.dir/src/sdl/SDL.o CMakeFiles/vbam.dir/src/sdl/dummy.o CMakeFiles/vbam.dir/src/sdl/filters.o CMakeFiles/vbam.dir/src/sdl/text.o CMakeFiles/vbam.dir/src/sdl/inputSDL.o CMakeFiles/vbam.dir/src/common/SoundSDL.o CMakeFiles/vbam.dir/src/sdl/expr.o CMakeFiles/vbam.dir/src/sdl/exprNode.o CMakeFiles/vbam.dir/src/sdl/expr-lex.o CMakeFiles/vbam.dir/src/filters/hq/c/hq_implementation.o -o vbam -F/opt/local/Library/Frameworks libvbamcore.a -lSDLmain /opt/local/lib/libSDL.dylib -framework Cocoa /usr/lib/libz.dylib /opt/local/lib/libpng.dylib -framework AGL -framework OpenGL -framework sfml-system -framework sfml-audio -framework sfml-graphics -framework sfml-network -framework sfml-window libfex.a

 

Note that there is "-lSDLmain". It's in /opt/local/lib, but that directory doesn't get searched with that command line.

 

Adding -L/opt/local/lib

 

... And it fails at runtime.

 

Kleiman-ibook:trunk michael$ ./vbam

dyld: Library not loaded: @executable_path/../Frameworks/sfml-system.framework/Versions/A/sfml-system

Referenced from: /Volumes/Michael/Documents/Development/vbam/trunk/./vbam

Reason: image not found

Trace/BPT trap

 

Yes, there's an -F/opt/local/Library/Frameworks in that link line.

Yes, that's the correct directory.

 

But it fails to run. No clue why.

 

Help?


Alright, I found a work-around.

 

DYLD_FRAMEWORK_PATH=/opt/local/Library/Frameworks/

export DYLD_FRAMEWORK_PATH

 

===

I have to give it the full pathname of a rom file. Running from the directory that had the rom file in it was not sufficient (either as rom.gb or ./rom.gb). Is this known, or mac specific?

 

Sadly, neither pokemon blue nor red worked -- both just gave me a yellow screen.

Equally, I realize I have no way to tell if my rom files are good or not. (I don't have a rom dumper, and probably couldn't desolder the cartridge without destroying something anyways.)


Compiling on Mac OS X

Posted: Wed Jun 23, 2010 4:00 pm
by Keybounce

And now I have the final key(s) to the linking issue. This is an option to ld(1):

Code: Select all

  -dylib_file install_name:file_name
                Specifies that a dynamic shared library is in a different
                location than its standard location. Use this option when you
                link with a library that is dependent on a dynamic library,
                and the dynamic library is in a location other than its
                default location. install_name specifies the path where the
                library normally resides. file_name specifies the path of the
                library you want to use instead. For example, if you link to
                a library that depends upon the dynamic library libsys and
                you have libsys installed in a nondefault location, you would
                use this option: -dylib_file /lib/lib-
                sys_s.A.dylib:/me/lib/libsys_s.A.dylib.

 

I need to determine how to make that work with frameworks instead of just dynamic libraries.

 

Or, the install_name_tool command can change the internal name of a framework. This hint (not yet tested and played with) works like

 

Code: Select all

install_name_tool -id /opt/local/Library/Frameworks/sfml-system.framework/Versions/Current/sfml-system /path/to/your/framework/sfml-system.framework/Versions/Current/sfml-system

 

followed by relinking anything that uses it.

 

Fundamentally, Mac Os has each shared library record where it thinks it will be installed, and that path is then recorded in any program that uses it. Where it was actually found is ignored. This permits executable-relative location of a shared library even if the compilation/linking scripts use absolute pathnames.

 


The full pathname issue for the rom file was identified by the SFML people as a function of the SFML library. Works great if the file being accessed is in the bundle, or the same directory as the executable.


Compiling on Mac OS X

Posted: Fri Oct 01, 2010 6:54 pm
by cheezgrater

Okay, I got this to build off the newest svn (r956).

 

There is, however, no usable GUI at all.

 

I can launch roms from terminal, but I have no way to set anything or do anything within the emulator, including changing controls.

 

How can I get at least a limited gui (with option like setting up a controller) working on os-x?


Compiling on Mac OS X

Posted: Fri Oct 01, 2010 10:56 pm
by Squall Leonhart

help spacy with his QT framework?


Compiling on Mac OS X

Posted: Sat Oct 02, 2010 7:46 am
by cheezgrater

Okay....no mac gui atm....roger.

 

Thanks for the quick reply!


Compiling on Mac OS X

Posted: Sun Nov 14, 2010 3:33 am
by Bop Louie

Okay....no mac gui atm....roger.

 

Hi-- little bit confused.

 

When someone recommended VBA-M to me, I checked google and found what appeared to be two different project pages for VBA-M. There was this site here and its sourceforge project. But there was also a Google Code project:

 

http://code.google.com/p/visualboyadvance-m/downloads/list

 

With an empty source repo but a bunch of uploaded files, all of them quite old (early 2009). However one of these files is a "VBA-M-MacOS-X-0.1.dmg". This installs a version of VBA-M with a quite decent mac GUI including HID gamepad setup. I would like if possible to be able to build this version of VBAM myself.

 

Are the Google Code and Sourceforge VBAM pages the same project?

 

I don't quite have VBAM built by the process above (I think I installed cmake wrong) yet, but-- if I get that working, will it build the "VBA-M-MacOS-X-0.1.dmg" version of VBAM or something else? (I assume something else if it builds without GUI on mac.) And how was "VBA-M-MacOS-X-0.1.dmg" built if not from the main vbam tree?

 

Also you say someone interested in mac gui should "help spacy with his QT framework"-- is spacy's qt version in the vbam/sourceforge svn tree or somewhere else?

 

Thanks!


Compiling on Mac OS X

Posted: Sun Nov 14, 2010 10:15 am
by Squall Leonhart

read the google code landing page.