Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (512)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  OSX need help  (Read 8681 times)
0 Members and 1 Guest are viewing this topic.
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Posted 2003-10-13 03:11:46 »

I need to throw away the current build.xml file because it absolutely won't work on OSX and many other platforms. What i need to find now is where the gcc command is defined that the build.xml keeps kicking off so I can edit it for OSX. I don't see it anywhere in the joal hive Sad

Stuck. Once I can get past this - won't take long. Have tested out the new OSX OpenAL and its performance doesn't suck for a change Smiley

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline sugarshark

Junior Duke




Sugar to the sharks.


« Reply #1 - Posted 2003-10-16 12:06:15 »

Quote
What i need to find now is where the gcc command is defined that the build.xml keeps kicking off so I can edit it for OSX.


Hi Greg,

look into $JOAL_HOME/src/native/build.xml

Ole

I used to think that the brain was the most wonderful organ in my body.  
Then I realized who was telling me this.
-- Emo Phillips
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Reply #2 - Posted 2003-10-18 04:06:43 »

Much appreciated. FInding that solved a great many problems. Now to just figure out why gcc still isn't seeing the header files when its invoking

1  
gcc -I/System/Library/Frameworks/JavaVM.framework/Headers -I/Library/Frameworks/OpenAL.framework/Headers  -O3 -D_X11 -shared -Wl,-soname -Wl,libjoal.so -Wl,-export-dynamic  -o ../../lib/libjoal.so extal.c eaxfactory.c eaxbind.c alfactory.c alcbind.c albind.c


Even when its looking at the directories where the headers are located, its still saying that they aren't there. Driving me nuts Smiley

Any ideas? I'm not too familiar with gcc.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Reply #3 - Posted 2003-10-18 22:54:10 »

Found the source of the problem - 10.2.8 is just horribly broken. I had to change the system to compile with JDK1.3.1.

1  
gcc -I/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Headers -I/Library/Frameworks/OpenAL.framework/Headers  -dynamiclib -framework JavaVM  -framework OpenAL -o ../../lib/libjoal.jnilib extal.c eaxfactory.c eaxbind.c alfactory.c alcbind.c albind.c


So now I have it to where everything should build IF I weren't getting some issues with the definitions of the functions:

Quote

    [exec] extal.h:161: undefined type, found `ALCdevice'
    [exec] extal.h:162: undefined type, found `ALCdevice'
    [exec] extal.h:163: undefined type, found `ALCdevice'
    [exec] extal.h:164: undefined type, found `ALCdevice'
    [exec] extal.h:165: undefined type, found `ALCcontext'
    [exec] extal.h:165: undefined type, found `ALCdevice'


Taking a look at the header file extal.h I've run across

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
#ifdef _WIN32
 #ifdef _OPENAL32LIB
  #define ALCAPI __declspec(dllexport)
 #else
  #define ALCAPI __declspec(dllimport)
 #endif

 typedef struct ALCdevice_struct ALCdevice;
 typedef struct ALCcontext_struct ALCcontext;

 #define ALCAPIENTRY __cdecl
#else
 #ifdef TARGET_OS_MAC
  #if TARGET_OS_MAC

 typedef struct ALCdevice_struct ALCdevice;
 typedef struct ALCcontext_struct ALCcontext;
 
   #pragma export on
  #endif

 typedef struct ALCdevice_struct ALCdevice;
 typedef struct ALCcontext_struct ALCcontext;

 #endif
 #define ALCAPI
 #define ALCAPIENTRY


So I'm not sure why its saying that they don't exist.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline aNt

Senior Duke




AFK


« Reply #4 - Posted 2003-10-25 09:51:35 »

r we still stuck on this?
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Reply #5 - Posted 2003-10-27 02:01:04 »

yeah, still stuck on this. Haven't gone back to it in a few - went to a bachelor party and still recovering....

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline Athomas Goldberg

Junior Duke




Grrrrrr...


« Reply #6 - Posted 2003-11-23 01:38:29 »

I've updated extal.c & extal.h from the latest version of the LWJGL (from which the original was taken) There have been a number of changes made to the files, especially around OSX, so it may be worth taking another look at getting it working. I don't currently have a Mac available or I'd try to figure it out myself. Hope this helps!

Athomas Goldberg
Project Lead / Wildcard
Game Technologies Group
Sun Microsystems, Inc.
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Reply #7 - Posted 2003-11-23 02:00:10 »

I'm on it. Downloading now.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline Athomas Goldberg

Junior Duke




Grrrrrr...


« Reply #8 - Posted 2003-11-23 02:06:09 »

Great! I can't promise anything, since 1) I didn't write extal.c or extal.h, I merely borrowed them from LWJGL and 2) I haven't really done any development for OS X. That said, I figured it was worth mentioning that the files had been upgraded in the hopes that it will make a difference. Good luck!

Athomas Goldberg
Project Lead / Wildcard
Game Technologies Group
Sun Microsystems, Inc.
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Reply #9 - Posted 2003-11-23 02:15:36 »

We still need to fix the ant build script. It still thinks the build succeeds even if compile-native-lib throws errors.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Athomas Goldberg

Junior Duke




Grrrrrr...


« Reply #10 - Posted 2003-11-23 02:45:32 »

Quote
We still need to fix the ant build script. It still thinks the build succeeds even if compile-native-lib throws errors.

I'm open to suggestions.  I haven't figured out a graceful way to let ant know that the gcc compile has failed. I'll keep looking around on the web, though, maybe somebody's figured it out already.

Athomas Goldberg
Project Lead / Wildcard
Game Technologies Group
Sun Microsystems, Inc.
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Reply #11 - Posted 2003-11-23 02:54:00 »

I've gotten it to build. Haven't actually tried to do anything with it. I had to make some pretty significant changes to the build scripts in order to make it happen and for now I'm going to leave that as an excercise for the 'file merge specialists' to determine. I do know that the "isUnix" thing is problematic because OSX "isUnix" just as Linux is  Grin

Here is the build file I used to get the compile for OSX natives

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
<project name="Sun Games Initiative Client Technologies" basedir="." default="all">

    <target name="init">
    <property name="cc" value ="gcc"/>
    <property name="no_cygwin" value="-mno-cygwin"/>
    <property name="sources" value="common_tools.c extal.c eaxfactory.c eaxbind.c alfactory.c alcbind.c albind.c"/>
    <property name="specs" value="-specs='./specs.new'"/>
    <condition property="isUnix">
            <os family="unix" />
    </condition>

    </target>

 
    <target name="compile-jnilib" depends="init" if="isUnix">
        <echo message="Compiling shared library for OSX" />
        <antcall target="compile-native-lib">
            <param name="include" value="-I${jdk.home}/include -I${openal.home}/Headers" />
            <param name="compilerflags" value ="-O3 -D_AGL -bundle "/>
            <param name="output" value="../../lib/libjoal.jnilib"/>
        </antcall>
    </target>

    <target name="compile-native-lib">
      <echo message="${cc} ${include} ${compilerflags} -o ${output} ${sources}" />
        <exec executable="${cc}">
            <arg line=" ${include} ${compilerflags} -o ${output} ${sources}"/>
        </exec>
    </target>

    <target name="compile" depends="compile-jnilib">
     </target>

    <target name="javadoc" depends="init">
        <ant dir="src/java" target="javadoc"/>
    </target>
   
   
    <target name="all" depends="init,compile" description="Build everything.">
        <echo message="Application built."/>
    </target>
   
    <target name="clean" description="Clean all build products.">
        <delete file="../../lib/libjoal.jnilib" />
    </target>
</project>

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Reply #12 - Posted 2003-11-23 02:58:27 »

Cannot yet speak to whether or not it works. It should, but there were some warnings that cropped up:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
     [exec] In file included from extal.c:34:
     [exec] extal.h:82: warning: redefinition of `ALCboolean'
     [exec] /Library/Frameworks/OpenAL.framework/Headers/alctypes.h:30: warning: `ALCboolean'
previously declared here
     [exec] extal.h:85: warning: redefinition of `ALCbyte'
     [exec] /Library/Frameworks/OpenAL.framework/Headers/alctypes.h:33: warning: `ALCbyte'
previously declared here
     [exec] extal.h:88: warning: redefinition of `ALCubyte'
     [exec] /Library/Frameworks/OpenAL.framework/Headers/alctypes.h:36: warning: `ALCubyte'
previously declared here
     [exec] extal.h:91: warning: redefinition of `ALCshort'
     [exec] /Library/Frameworks/OpenAL.framework/Headers/
     [exec] /Library/Frameworks/OpenAL.framework/Headers/alctypes.h:60: warning: `ALCvoid'
previously declared here
     [exec] ld: warning -prebind has no effect with -bundle


(Note that the list was trimmed to fit within the boundary of legal messages for the forum, bit the trim was done in the middle with the prebind warning being the last in the file)

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline Athomas Goldberg

Junior Duke




Grrrrrr...


« Reply #13 - Posted 2003-11-23 03:00:55 »

Once you've gotten something that runs (he said crossing his fingers) I'll take a look at merging the build files.  At least this is a step in the right direction!

Athomas Goldberg
Project Lead / Wildcard
Game Technologies Group
Sun Microsystems, Inc.
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Reply #14 - Posted 2003-11-23 03:02:37 »

Note that the runtests task will fail because the OpenALTest code is trying to open up the hardcoded DirectSound3D device. Don't know enough about OpenAL yet to fix that, but I'll take a look and report back tonight (this morning) if I find out what OSX expects.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline Athomas Goldberg

Junior Duke




Grrrrrr...


« Reply #15 - Posted 2003-11-23 03:05:14 »

You can try replacing "DirectSound3D" with null, which should cause it to use the default device.

Athomas Goldberg
Project Lead / Wildcard
Game Technologies Group
Sun Microsystems, Inc.
Offline Athomas Goldberg

Junior Duke




Grrrrrr...


« Reply #16 - Posted 2003-11-23 03:11:38 »

I just updated OpenALTest and Sound3DTest to use null instead of "DirectSound3D". Once you've updated the source, you should be able to call the "runtests" task in the build.xml file.

Athomas Goldberg
Project Lead / Wildcard
Game Technologies Group
Sun Microsystems, Inc.
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Reply #17 - Posted 2003-11-23 03:23:13 »

Throwing a NullPointerException when trying to get the device. I'll open it up in a debugger and see what's up.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline Athomas Goldberg

Junior Duke




Grrrrrr...


« Reply #18 - Posted 2003-11-23 03:24:29 »

Keep me posted...

Also, you probably did this, but make sure you update everything, not just the native files.

Athomas Goldberg
Project Lead / Wildcard
Game Technologies Group
Sun Microsystems, Inc.
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Reply #19 - Posted 2003-11-23 03:35:53 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
    /**
     * Initialize the OpenAL environment
     *
     * @return true is OpenAL was able to initialize,
     *         false if OpenAL was not able to intialize
     */

    public static boolean initialize() throws OpenALException {
        String osProperty = System.getProperty("os.name");
        if(osProperty.startsWith("Win")) {
            isInitialized = init(new String[] { "OpenAL32.dll" });
        } else if(osProperty.startsWith("Linux")) {
            isInitialized = init(new String[] { "libopenal.so" });
        } else {
            // OSX            
        }
        return isInitialized;
    }


I believe this is the culprit Smiley Naughty naughty piece of code... Clearly there is something here that wants a platform specific. Its evil because its buried fairly deeply in source code. After this I need to figure out that the native init method wants to do with it.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Reply #20 - Posted 2003-11-23 03:44:25 »

Next up is to figure out exactly what the init call is expecting, because then you pass it OpenAL.framework all you get is:

net.java.games.joal.OpenALException: Could not open openal library.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline Athomas Goldberg

Junior Duke




Grrrrrr...


« Reply #21 - Posted 2003-11-23 03:46:22 »

Hmm... Yeah, that would cause a problem.  :-/ Basically, this should contain the name of the OpenAL shared library for the platform, it's needed by extal.c to dynamically load OpenAL in to the environment. I've been meaning to look into a more graceful way of dealing with this. In the meantime, you should be able to specify the name of the shared object (my guess is that it'll be similar to the linux entry, but don't quote me on that) for OS X and let the native code take it from there.

Athomas Goldberg
Project Lead / Wildcard
Game Technologies Group
Sun Microsystems, Inc.
Offline Athomas Goldberg

Junior Duke




Grrrrrr...


« Reply #22 - Posted 2003-11-23 03:51:44 »

You probably want to take a look at LoadOpenAL() in extal.c since this is where the OpenAL libraries actually get loaded. (and where that exception is thrown)

Athomas Goldberg
Project Lead / Wildcard
Game Technologies Group
Sun Microsystems, Inc.
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Reply #23 - Posted 2003-11-23 03:52:50 »

Unfortunately there is no such animal in OSX outside of frameworks. A framework is a shared bundle of libraries and respective resources on OSX. The mechanism for loading function pointers from it is a tad different though.

I'll table this for now because this is going to become a reasonably substantial change to the way the LWJGL code works - which is why I never ported their OpenAL code in the first place. They made a lot of assumptions about how things should work which just fall apart on OSX.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Reply #24 - Posted 2003-11-23 03:54:35 »

Quote
You probably want to take a look at LoadOpenAL() in extal.c since this is where the OpenAL libraries actually get loaded. (and where that exception is thrown)


Yeah, that's what I'm looking at now and now I remember why I didn't port OpenAL for LWJGL. To use the approach that they've chosen would require revamping the OpenAL framework such that its compiled into a shared library - which is not how its distributed.

This is the offending line of code:

1  
2  
3  
#ifdef _AGL
            handleOAL = NSAddImage(path_str,NSADDIMAGE_OPTION_RETURN_ON_ERROR);
#endif

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline Athomas Goldberg

Junior Duke




Grrrrrr...


« Reply #25 - Posted 2003-11-23 03:58:16 »

Sorry.  Sad

I was hopeful, since IIRC they've apparently gotten AF running on OS X. As I noted earlier my mac dev experience is next to nil (what little native development I *have* done for the mac was almost 10 years ago, so I doubt very much of it applies today!)

I hope this wasn't too big a waste of your time.  :-/

Athomas Goldberg
Project Lead / Wildcard
Game Technologies Group
Sun Microsystems, Inc.
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Reply #26 - Posted 2003-11-23 04:04:18 »

Never a waste of time. What would become necessary is a change to the build of OpenAL and some changes to JOAL. The biggie is to patch ALFactory.java so that it at least does the init call which it doesn't now (and if this is from their current codebase I'm not sure how they're playing sounds witout calling init).

After recompiling OpenAL into a shared library and taking on the distribution responsibility for that (because it doesn't come that way from creative), then we can use the methodology that they're using. Its not the ideal way of doing things however.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline Athomas Goldberg

Junior Duke




Grrrrrr...


« Reply #27 - Posted 2003-11-23 04:09:14 »

Quote
Yeah, that's what I'm looking at now and now I remember why I didn't port OpenAL for LWJGL. To use the approach that they've chosen would require revamping the OpenAL framework such that its compiled into a shared library - which is not how its distributed.

Is the answer to have the OS X version just import the OpenAL headers directly? (instead of extal.h) There are a few other calls you'd have to ifdef out (mostly the load and initialize calls), but otherwise it should work. It's not the prettiest solution, but it might at least get us up and running.

EDIT: How is the OS X distribution of OpenAL packaged?

Athomas Goldberg
Project Lead / Wildcard
Game Technologies Group
Sun Microsystems, Inc.
Offline Athomas Goldberg

Junior Duke




Grrrrrr...


« Reply #28 - Posted 2003-11-23 04:13:01 »

Quote
Never a waste of time. What would become necessary is a change to the build of OpenAL and some changes to JOAL. The biggie is to patch ALFactory.java so that it at least does the init call which it doesn't now (and if this is from their current codebase I'm not sure how they're playing sounds witout calling init).

Well, I have to admit ALFactory is mine. It's just the calls it's making are theirs.
Quote
After recompiling OpenAL into a shared library and taking on the distribution responsibility for that (because it doesn't come that way from creative), then we can use the methodology that they're using. Its not the ideal way of doing things however.

While not ideal, it's also not a showstopper if it means getting something up and running in the near-term.

EDIT: Of course the question is just how much work rebuilding OpenAL as a shared library is going to be. Once again, my OS X ignorance is showing...

Athomas Goldberg
Project Lead / Wildcard
Game Technologies Group
Sun Microsystems, Inc.
Offline gregorypierce

Senior Duke




I come upon thee like the blue screen of death....


« Reply #29 - Posted 2003-11-23 04:23:07 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
    /**
     * Initialize the OpenAL environment
     *
     * @return true is OpenAL was able to initialize,
     *         false if OpenAL was not able to intialize
     */

    public static boolean initialize() throws OpenALException {
        String osProperty = System.getProperty("os.name");
        if(osProperty.startsWith("Win")) {
            isInitialized = init(new String[] { "OpenAL32.dll" });
        } else if(osProperty.startsWith("Linux")) {
            isInitialized = init(new String[] { "libopenal.so" });
        } else {
            isInitialized = init(new String[] { "/Library/Frameworks/OpenAL.framework/Versions/Current/OpenAL"});
        }
        return isInitialized;
    }



Okay, I will update CVS. I've got it working properly. Had to make a couple of changes for OSX specifics. Will work with the OpenAL.framework that you can download from Creative and will work with Garin to make sure that version is up-to-date.

JOAL OSX is done Smiley

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (50 views)
2014-10-17 03:59:02

Norakomi (39 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (35 views)
2014-10-15 16:18:58

TehJavaDev (66 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (55 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!