PowerSDL and noixemul
  • Paladin of the Pegasos
    Paladin of the Pegasos
    Intuition
    Posts: 1113 from 2013/5/24
    From: Nederland
    Either i'm an idiot (Highly likely) or I missed it in the docs somewhere that when writing code that uses the SDL framework one must pass the -noixemul flag to gcc otherwise running the compiled binary locks up MorphOS completely.

    Justy thought I'd mention it here to save anyone else a similar headache.
    1.67GHz 15" PowerBook G4, 1GB RAM, 128MB Radeon 9700M Pro, 64GB SSD, MorphOS 3.15

    2.7GHz DP G5, 4GB RAM, 512MB Radeon X1950 Pro, 500GB SSHD, MorphOS 3.9
  • »05.01.14 - 16:31
    Profile
  • MorphOS Developer
    Henes
    Posts: 507 from 2003/6/14
    Two more points:

    1. to compile a SDL source, the usage it to put `sdl-config --cflags` on the gcc commande line. This will add the -noixemul switch and the right include path. And use `sdl-config --libs` to link.

    2. -noixemul should pretty much be used for... everything. As soon as you make something doing any non-ixemul library call, use -noixemul. Always. An OpenGL call? An exec.library call? A z.library call? Anything not being part of ixemul's libc API? Use -noixemul.
  • »05.01.14 - 17:55
    Profile Visit Website
  • Paladin of the Pegasos
    Paladin of the Pegasos
    Intuition
    Posts: 1113 from 2013/5/24
    From: Nederland
    Quote:

    Henes wrote:
    Two more points:

    1. to compile a SDL source, the usage it to put `sdl-config --cflags` on the gcc commande line. This will add the -noixemul switch and the right include path. And use `sdl-config --libs` to link.

    2. -noixemul should pretty much be used for... everything. As soon as you make something doing any non-ixemul library call, use -noixemul. Always. An OpenGL call? An exec.library call? A z.library call? Anything not being part of ixemul's libc API? Use -noixemul.




    Thanks for the tips Henes.

    I generally use -noixemul but I left it off the command line by accident and spent the next half an hour convinced I was going mad. :)

    Will make sure to use sdl-config in future.
    1.67GHz 15" PowerBook G4, 1GB RAM, 128MB Radeon 9700M Pro, 64GB SSD, MorphOS 3.15

    2.7GHz DP G5, 4GB RAM, 512MB Radeon X1950 Pro, 500GB SSHD, MorphOS 3.9
  • »05.01.14 - 18:20
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    tolkien
    Posts: 544 from 2013/5/29
    A noob question. How do I include the SDLconfig file in the command line to compile properly?

    [ Edited by tolkien 05.01.2014 - 18:28 ]
    MorphOS: PowerMac G5 - PowerBook G4 - MacMini.
    Classic: Amiga 1200/060 - A500 PiStorm
  • »05.01.14 - 18:27
    Profile
  • MorphOS Developer
    Henes
    Posts: 507 from 2003/6/14
    The same way as on other systems:
    gcc -O3 `sdl-config --cflags` -c foo.c -o foo.o
    gcc `sdl-config --libs` foo.o -o foo

    Please notice the backtick usage.
  • »05.01.14 - 19:00
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    tolkien
    Posts: 544 from 2013/5/29
    Thanks Henes. I've never used the config file. Time to do thing right. ;)
    MorphOS: PowerMac G5 - PowerBook G4 - MacMini.
    Classic: Amiga 1200/060 - A500 PiStorm
  • »05.01.14 - 19:25
    Profile
  • Paladin of the Pegasos
    Paladin of the Pegasos
    Intuition
    Posts: 1113 from 2013/5/24
    From: Nederland
    Quote:

    tolkien wrote:
    A noob question. How do I include the SDLconfig file in the command line to compile properly?


    I can give you a makefile i knocked up if you want?
    1.67GHz 15" PowerBook G4, 1GB RAM, 128MB Radeon 9700M Pro, 64GB SSD, MorphOS 3.15

    2.7GHz DP G5, 4GB RAM, 512MB Radeon X1950 Pro, 500GB SSHD, MorphOS 3.9
  • »05.01.14 - 22:58
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    tolkien
    Posts: 544 from 2013/5/29
    Thanks Intuition! It will be useful when I repair my two macs.
    I was doing some SDL stuff.
    MorphOS: PowerMac G5 - PowerBook G4 - MacMini.
    Classic: Amiga 1200/060 - A500 PiStorm
  • »06.01.14 - 00:00
    Profile
  • Paladin of the Pegasos
    Paladin of the Pegasos
    Intuition
    Posts: 1113 from 2013/5/24
    From: Nederland
    Code:
    CXX = ppc-morphos-g++
    STRIP = ppc-morphos-strip

    CFLAGS = -O3 -Wall `sdl-config --cflags`
    LDFLAGS = `sdl-config --libs`

    SOURCES = image.cpp
    OBJECTS = $(SOURCES:.cpp=.o)
    EXECUTABLE = image

    all: $(SOURCES) $(EXECUTABLE)

    $(EXECUTABLE): $(OBJECTS)
    @echo "Linking object code and creating executable...."
    @$(CXX) $(CFLAGS) $(OBJECTS) -o $@ $(LDFLAGS)

    @echo "Stripping extraneous data from executable...."
    @$(STRIP) --strip-all $(EXECUTABLE)

    @echo LZMA-packing executable....
    @copy C:lzmaLoader $(EXECUTABLE).packed
    @lzma e $(EXECUTABLE) -so >>$(EXECUTABLE).packed
    @echo
    @echo "All done!"
    @echo
    @echo "Executable filename is: '$(EXECUTABLE)'"
    @echo "Packed executable filename is: '$(EXECUTABLE).packed'"
    @echo

    .cpp.o:
    @echo "Compiling object code...."
    @$(CXX) $(CFLAGS) -c $< -o $@

    clean:
    @rm -f $(OBJECTS) $(EXECUTABLE) $(EXECUTABLE).packed
    @echo "All objects and executables have been cleaned."
    @echo


    You can delete the LZMA-loader lines if you want, or just copy lzma, lzmaLoader and lzmaLoader_shared to C:

    http://morphos-files.net/remote/LZMALoader
    1.67GHz 15" PowerBook G4, 1GB RAM, 128MB Radeon 9700M Pro, 64GB SSD, MorphOS 3.15

    2.7GHz DP G5, 4GB RAM, 512MB Radeon X1950 Pro, 500GB SSHD, MorphOS 3.9
  • »06.01.14 - 00:09
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    tolkien
    Posts: 544 from 2013/5/29
    Great Intuition! Thanks so much. Ill change It as I need It.
    MorphOS: PowerMac G5 - PowerBook G4 - MacMini.
    Classic: Amiga 1200/060 - A500 PiStorm
  • »06.01.14 - 03:07
    Profile
  • Paladin of the Pegasos
    Paladin of the Pegasos
    Intuition
    Posts: 1113 from 2013/5/24
    From: Nederland
    Quote:

    tolkien wrote:
    Great Intuition! Thanks so much. Ill change It as I neeIt.d


    You're welcome. :)
    1.67GHz 15" PowerBook G4, 1GB RAM, 128MB Radeon 9700M Pro, 64GB SSD, MorphOS 3.15

    2.7GHz DP G5, 4GB RAM, 512MB Radeon X1950 Pro, 500GB SSHD, MorphOS 3.9
  • »06.01.14 - 03:45
    Profile