vayerx / shadowgrounds

Shadowgrounds and Shadowgrounds Survivor games
Other
53 stars 18 forks source link

build error in SoundLib.cpp #5

Closed roughl closed 12 years ago

roughl commented 12 years ago

current git does not build on my system:

[ 16%] Building CXX object CMakeFiles/shadowgrounds_sound.dir/sound/openal/SoundLib.cpp.o
In file included from /usr/include/boost/thread/pthread/mutex.hpp:14:0,
                 from /usr/include/boost/thread/mutex.hpp:16,
                 from /usr/include/boost/thread/pthread/thread_data.hpp:12,
                 from /usr/include/boost/thread/thread.hpp:17,
                 from /usr/include/boost/thread.hpp:13,
                 from /home/roughl/proggen/shadowgrounds/sound/openal/SoundLib.cpp:17:
/usr/include/boost/thread/xtime.hpp:23:5: error: expected identifier before numeric constant
/usr/include/boost/thread/xtime.hpp:23:5: error: expected '}' before numeric constant
/usr/include/boost/thread/xtime.hpp:23:5: error: expected unqualified-id before numeric constant
/usr/include/boost/thread/xtime.hpp:46:14: error: expected type-specifier before 'system_time'
In file included from /usr/include/boost/thread/pthread/mutex.hpp:14:0,
                 from /usr/include/boost/thread/mutex.hpp:16,
                 from /usr/include/boost/thread/pthread/thread_data.hpp:12,
                 from /usr/include/boost/thread/thread.hpp:17,
                 from /usr/include/boost/thread.hpp:13,
                 from /home/roughl/proggen/shadowgrounds/sound/openal/SoundLib.cpp:17:
/usr/include/boost/thread/xtime.hpp: In function 'int xtime_get(xtime*, int)':
/usr/include/boost/thread/xtime.hpp:73:40: error: 'get_system_time' was not declared in this scope
/usr/include/boost/thread/xtime.hpp:73:40: note: suggested alternative:
In file included from /usr/include/boost/thread/locks.hpp:12:0,
                 from /usr/include/boost/thread/pthread/mutex.hpp:12,
                 from /usr/include/boost/thread/mutex.hpp:16,
                 from /usr/include/boost/thread/pthread/thread_data.hpp:12,
                 from /usr/include/boost/thread/thread.hpp:17,
                 from /usr/include/boost/thread.hpp:13,
                 from /home/roughl/proggen/shadowgrounds/sound/openal/SoundLib.cpp:17:
/usr/include/boost/thread/thread_time.hpp:19:24: note:   'boost::get_system_time'
In file included from /usr/include/boost/thread/pthread/mutex.hpp:14:0,
                 from /usr/include/boost/thread/mutex.hpp:16,
                 from /usr/include/boost/thread/pthread/thread_data.hpp:12,
                 from /usr/include/boost/thread/thread.hpp:17,
                 from /usr/include/boost/thread.hpp:13,
                 from /home/roughl/proggen/shadowgrounds/sound/openal/SoundLib.cpp:17:
/usr/include/boost/thread/xtime.hpp: At global scope:
/usr/include/boost/thread/xtime.hpp:88:1: error: expected declaration before '}' token
make[2]: *** [CMakeFiles/shadowgrounds_sound.dir/sound/openal/SoundLib.cpp.o] Error 1
make[1]: *** [CMakeFiles/shadowgrounds_sound.dir/all] Error 2
make: *** [all] Error 2
vayerx commented 12 years ago

Thanks, I'll have a look at the evening. What boost/compiler/platform/etc are you using? Are you compiling 'linux' branch?

roughl commented 12 years ago

boost: 1.49.0-2 compiler: gcc 4.7.1-4.1 cmake version 2.8.8 platform: Linux tuxbox 3.4.4-3-ARCH #1 SMP PREEMPT Tue Jul 3 14:36:44 UTC 2012 x86_64 GNU/Linux

and yes I'm using the linux branch

I also get some warnings when using cmake:

CMake Warning (dev) in /home/roughl/proggen/shadowgrounds/build/CMakeTmp/CMakeLists.txt: 
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 2.8)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:3 (ADD_EXECUTABLE):
  Policy CMP0003 should be set before this line.  Add code such as

    if(COMMAND cmake_policy)
      cmake_policy(SET CMP0003 NEW)
    endif(COMMAND cmake_policy)

  as early as possible but after the most recent call to
  cmake_minimum_required or cmake_policy(VERSION).  This warning appears
  because target "DetermineSoundLibs" links to some libraries for which the
  linker must search:

    -lpthread

  and other libraries with known full path:

    /lib64/libSDL_sound.so

  CMake is adding directories in the second list to the linker search path in
  case they are needed to find libraries from the first list (for backwards
  compatibility with CMake 2.4).  Set policy CMP0003 to OLD or NEW to enable
  or disable this behavior explicitly.  Run "cmake --help-policy CMP0003" for
  more information.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: /home/roughl/proggen/shadowgrounds/build
vayerx commented 12 years ago

I couldn't reproduce your problem on my system. Are you sure, that your boost distribution isn't broken and checkout is in pristine state? "'get_system_time' was not declared in this scope" error in boost/thread/xtime.hpp seems to be boost issue. Could you add "#include <boost/thread/thread_time.hpp>" before "#include <boost/thread.hpp>" in hadowgrounds/sound/openal/SoundLib.cpp and check if error still reproduces.

Cmake warnings belongs to cmake's FindSDL_sound module (http://public.kitware.com/Bug/view.php?id=13401).

roughl commented 12 years ago

after upgrading to a boost 1.50.0-2 Some errors disappeared with it, but some new appeared:

[ 18%] Building CXX object CMakeFiles/shadowgrounds_sound.dir/sound/openal/SoundLib.cpp.o
In file included from /usr/include/boost/system/system_error.hpp:14:0,
                 from /usr/include/boost/thread/exceptions.hpp:22,
                 from /usr/include/boost/thread/pthread/thread_data.hpp:10,
                 from /usr/include/boost/thread/thread.hpp:17,
                 from /usr/include/boost/thread.hpp:13,
                 from /home/roughl/proggen/shadowgrounds/sound/openal/SoundLib.cpp:17:
/usr/include/boost/system/error_code.hpp:400:50: Fehler: expected unqualified-id before »throw«
/usr/include/boost/system/error_code.hpp:400:50: Fehler: expected initializer before »throw«
/usr/include/boost/system/error_code.hpp:409:31: Fehler: expected unqualified-id before »throw«
/usr/include/boost/system/error_code.hpp:409:31: Fehler: expected initializer before »throw«
make[2]: *** [CMakeFiles/shadowgrounds_sound.dir/sound/openal/SoundLib.cpp.o] Fehler 1
make[1]: *** [CMakeFiles/shadowgrounds_sound.dir/all] Fehler 2
make: *** [all] Fehler 2

But it seems to be a boost issue

vayerx commented 12 years ago

Maybe you should try more stable gcc version. Something like 4.5.3 or 4.6.3, for example. I haven't tried out boost 1.50 yet.

Are you using boost & gcc from your system repository or do you download and build them manually?

roughl commented 12 years ago

I am using boost & gcc from my system repository. This is an archlinux system, which is rolling release, hence I always get the latest releases of any software. But I may try to build gcc 4.6.3 manually. Btw: I found an upstream boost bugreport which may be related to my issue: https://svn.boost.org/trac/boost/ticket/6165

vayerx commented 12 years ago

Feel free to reopen this issue if you still experience problems with stable versions of compilers/libraries.

sswam commented 11 years ago

I had the same problem.

These two files: ./container/LinkedList.h ./container/Stack.h

both #define throws, which seems to break newer boost.

To fix it, I added before the final #endif in each file:

undef throws

#undef null

(there was also #define null ...)

I am attempting to port to an ARM handheld, the Open Pandora. There was also an i386 / x86_64 assumption in shadowgrounds.cpp. Shadowgrounds builds with this patch: http://sam.nipl.net/shadowgrounds-patch.txt but it doesn't work yet on the Pandora.