Linux support

samsaga2

21-10-2008 14:27:43

I've write a CMakeLists.txt file for OgreOggSound but I've problems for compile it:


CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

PROJECT(OgreOggSound)

IF(CMAKE_BUILD_TYPE STREQUAL Debug)
ADD_DEFINITIONS(-D_DEBUG)
ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)

SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake-extensions/)
FIND_PACKAGE(PkgConfig)

PKG_CHECK_MODULES(OGRE OGRE)
PKG_CHECK_MODULES(OPENAL openal)
PKG_CHECK_MODULES(OGG ogg)
PKG_CHECK_MODULES(VORBIS vorbis)

AUX_SOURCE_DIRECTORY(src OGREOGGSOUND_SRCS)

ADD_DEFINITIONS(-DLINUX)
INCLUDE_DIRECTORIES(include ${OGRE_INCLUDE_DIRS} ${OPENAL_INCLUDE_DIRS} ${OGG_INCLUDE_DIRS} ${VORBIS_INCLUDE_DIRS} /usr/include/AL)
LINK_DIRECTORIES(${OGRE_LIBRARY_DIRS} ${OPENAL_LIBRARY_DIRS} ${OGG_INCLUDE_DIRS} ${VORBIS_INCLUDE_DIRS})
LINK_LIBRARIES(${OGRE_LIBRARIES} ${OPENAL_LIBRARIES} ${OGG_LIBRARIES} ${VORBIS_LIBRARIES})

ADD_LIBRARY(ogreoggsound STATIC ${OGREOGGSOUND_SRCS})


Errors:

/home/victor/prjs/OgreOggSound/include/OgreOggSoundManager.h:27:19: error: efx.h: No such file or directory
/home/victor/prjs/OgreOggSound/src/OgreOggStaticWavSound.cpp:25:19: error: mmreg.h: No such file or directory
In file included from /home/victor/prjs/OgreOggSound/include/OgreOggISound.h:28,
from /home/victor/prjs/OgreOggSound/include/OgreOggStaticWavSound.h:31,
from /home/victor/prjs/OgreOggSound/src/OgreOggStaticWavSound.cpp:21:
/home/victor/prjs/OgreOggSound/include/OgreOggSoundCallback.h:35: error: expected initializer before ‘OOSCallback’
/home/victor/prjs/OgreOggSound/src/OgreOggStaticWavSound.cpp:505: error: expected `}' at end of input


efx.h doesn't exists on linux (at least on ubuntu) nor efx-util, efx-create.h, XRam.h and mmreg.h.

stickymango

21-10-2008 14:48:21

Unfortunately I don't know a whole lot about the linux filesystem/libraries so cannot offer much help.

I think maybe those header files aren't part of the normal openal distribution, is there not an openal_soft distribution which has that support?

If not I guess you'll need to remove all references to eax and efx from the library for the linux version. :?

Anonymous

21-10-2008 15:02:43

To drop efx I only have to delete those includes?

stickymango

21-10-2008 15:12:04

I'm afraid not, you'll also have to #ifdef all the EAX specific functions out of the sound manager I think..

manowar

21-10-2008 16:17:48

I have myself compiled it on linux (without EFX, WAV and XRAM). I simply used some #ifdef EAX...
Now I am confused about EAX on linux, I have linked it using 'openal soft' and apparently it should support EAX (not completely though). However efx.h is not part of the package too.
Can we simply grab the missing headers from the windows sdk ? What about copyrights ? Would it work ?
I have not tried it yet but I read something about doing it on open-soft mailing list archive.
I have simply used 'Codelite' IDE to make a project and compile it. Using CMake would be a much better solution indeed.

god4saken

06-02-2009 17:58:07

Can you post the #ifdef you put to compile it under linux?
I've tried to compile it under linux but I'm also getting lot of errors


include/OgreOggISound.h:60: error: 'GUID' does not name a type
include/OgreOggSoundPlugin.h:59: error: ISO C++ forbids declaration of 'OgreOggSoundManager' with no type
include/OgreOggSoundPlugin.h:59: error: expected ';' before '*' token
include/OgreOggSoundRecord.h:42: error: 'WAVEFORMATEX' does not name a type


I'm using the above CMakeLists.txt

stickymango

07-02-2009 14:05:33

Hi god4saken,

You need to wrap any/all code associated with WAVEFORMATEX, EAX and EFX with #ifdef #endif, as far as I know, what about putting your linux-ified code into a zip for me and I'll have a look at it to see if I can help get it building on linux?

god4saken

12-02-2009 01:00:35

I've made a patch for help you to try, here it is http://pastebin.com/m31dfe2de

I'm still getting some weird errors with the OgreOggSoundManager class:


include/OgreOggSoundPlugin.h:58: error: ISO C++ forbids declaration of 'OgreOggSoundManager' with no type
include/OgreOggSoundPlugin.h:58: error: expected ';' before '*' token
make[2]: *** [CMakeFiles/ogreoggsound.dir/src/OgreOggSoundPluginDllStart.cpp.o] Error 1
make[1]: *** [CMakeFiles/ogreoggsound.dir/all] Error 2
make: *** [all] Error 2

stickymango

12-02-2009 15:41:52

Hi god4saken,

I've been linux-ifying the code and have added/removed windows specific code as far as I know of, hopefully wrapped all EAX/XRAM code and removed DWORD/WORD/WAVEFORMATEX references, I've updated the SVN with these changes so if you get chance could you test out what else needs amending to get it compiling?

Thanks for your help!

god4saken

13-02-2009 19:50:21

There is still a few troubles in linux:

Linux is case sensitive, so, in src/OgreOggISound.cpp, i must replace
#include "OgreOggIsound.h" with #include "OgreOggISound.h"
and in include/OgreOggSoundRecord.h I replaced
#include "OgreOggSoundPreReqs.h" with #include "OgreOggSoundPrereqs.h"

I've also need to include #include <OGRE/OgrePlatform.h>
in OgreOggSoundPrereqs.h in order to get the macro OGRE_PLATFORM defined in linux

Other point is that the macro defined is LINUX, but the macro used for #ifdef...#endif is _LINUX_

There seems to be a few problems with the #includes in OgreOggSoundManager.h, I fix them
removing these includes
#include "OgreOggSoundPrereqs.h"
#include <string>
#include <OgreSingleton.h>
#include "OgreOggISound.h"
#include "OgreOggSoundPlugin.h"
And adding
#include "OgreOggSoundRecord.h"

After this, I get the following errors:

src/ogreoggsoundmanager.cpp: In member function 'bool OgreOggSound::OgreOggSoundManager::init(const std::string&)':
src/ogreoggsoundmanager.cpp:191: error: 'ALC_MAX_AUXILIARY_SENDS' was not declared in this scope
src/ogreoggsoundmanager.cpp: In member function 'Ogre::StringVector OgreOggSound::OgreOggSoundManager::getDeviceList()':
src/ogreoggsoundmanager.cpp:256: warning: NULL used in arithmetic
src/ogreoggsoundmanager.cpp: In member function 'void OgreOggSound::OgreOggSoundManager::updateBuffers()':
src/ogreoggsoundmanager.cpp:1633: error: 'Sleep' was not declared in this scope
src/ogreoggsoundmanager.cpp: In member function 'void OgreOggSound::OgreOggSoundManager::_release()':
src/ogreoggsoundmanager.cpp:1659: error: 'AL_DIRECT_FILTER' was not declared in this scope
src/ogreoggsoundmanager.cpp:1659: error: 'AL_FILTER_NULL' was not declared in this scope
src/ogreoggsoundmanager.cpp:1660: error: 'AL_AUXILIARY_SEND_FILTER' was not declared in this scope
src/ogreoggsoundmanager.cpp:1660: error: 'AL_EFFECTSLOT_NULL' was not declared in this scope
make[2]: *** [CMakeFiles/ogreoggsound.dir/src/ogreoggsoundmanager.cpp.o] Error 1
make[1]: *** [CMakeFiles/ogreoggsound.dir/all] Error 2


I think they should be because the OpenAL version, Im using the latest OpenAL (1.6.372) but I've also used one earlier version (1.5.304) getting the same errors.

Thanks you for the help!

stickymango

16-02-2009 12:00:31

Hi god4saken,

I'm up and running in Linux now and have taken a quick look, I wasn't aware of the case-sensitive issue so I'll correct that.

I tried using code::blocks to compile the lib and I got down to 1 error which was related to OgreTimer, which it complains about "OgrePrerequisites.h" I assume because the path "OGRE/" is missing.. :? I don't understand how to sort that, is there environment variables you can set?

Anyway, the errors you mention there are related to EAX/EFX so I #defined them out, if you try that and let me know if it compiles?

Are you using any IDE or just make?

stickymango

16-02-2009 23:53:24

Hi god4saken,

I'm as far as getting the library to compile with make, but now I'm unsure were to go next? should there be a 'sudo make install' next?

Any advice would be greatly appreciated.

Thanks.

god4saken

17-02-2009 09:59:08


Anyway, the errors you mention there are related to EAX/EFX so I #defined them out, if you try that and let me know if it compiles?

Did you mean the

src/ogreoggsoundmanager.cpp:1659: error: 'AL_DIRECT_FILTER' was not declared in this scope
src/ogreoggsoundmanager.cpp:1659: error: 'AL_FILTER_NULL' was not declared in this scope
src/ogreoggsoundmanager.cpp:1660: error: 'AL_AUXILIARY_SEND_FILTER' was not declared in this scope
...
errors??

Im using make, and i have only those errors now (it is important to remove the includes i wrote for OgreOggSoundManager.h in order to have OgreOggSound compilling in linux)

The next step is to do a "make install" but I need to fix the errors, that is the reason I was wondering which OpenAL are you using to compile OgreOggSound.

I have problems to write in English, unfortunately it is not as good as it should be, so if you think I am not understanding you, or if you dont understand me, please dont hesitate correcting me!

stickymango

17-02-2009 10:02:08

Hi,

If you checkout the latest SVN of OgreOggSound it should compile fine with cmake now, I corrected those problems on my system, once built I wasn't sure where to go next.. :?

And I'm using the latest openal-soft 1.6.x I think

god4saken

19-02-2009 18:49:28

Yeah, it compiles ok!!! :)

Thanks a lot!

stickymango

19-02-2009 20:11:02

Great news!

Where do you go from there? How do you link to the library from an application? Does the library need installing into the central repository in linux '/usr/lib' or '/usr/local/lib'?

Have you got a demo/example working yet which I could get a copy of?

p.s. is there a concept of Environment Variables in linux, I'm having problems in Code::Blocks not picking up source file paths for OGRE :?

Much appreciated

god4saken

03-03-2009 12:51:20

Sorry for the late response, i've been very busy last week :(

I still have no time to test it under linux, because firstly i need to wrap it to ruby using swig.
When i finally get an example working perfectly under linux, i'll tell to you and post the
working examples.

Thanks for everything, bye!

stickymango

03-03-2009 13:31:01

OKay, no problem, thanks.

kornerr

04-04-2010 10:30:55

I've changed alGetError to alcGetError under non-win32 platforms, and also made CMakeLists.txt with OGGSOUND_THREADED and install options.
Here's the patch
The ccmake /path/to/ogreoggsound will let you set OOGSOUND_THREADED to ON or OFF without a need to change sources, make install will install headers and the lib.

Hope to see it in the repository :)

stickymango

06-04-2010 10:09:14

Excellent, thanks a lot! :)