VCMI svn-rev1610 Linux build errors

Hi all!

I hope you may help me out on some issues I struggle with for some days. I’m using the SVN revision 1610, which builds fine on my Ubuntu machine. So I assume the code is somewhat okay, but while building in my Scratchbox with ARMEL target I got the following error:

In file included from ../CGameInterface.h:7,
                 from ../CGameInterface.cpp:2:
../client/FunctionList.h:122:24: warning: no newline at end of file
In file included from ../hch/CMusicHandler.h:6,
                 from ../CGameInterface.h:8,
                 from ../CGameInterface.cpp:2:
../hch/CSoundBase.h:1038:27: warning: no newline at end of file
g++ -DPACKAGE_NAME=\"vcmi\" -DPACKAGE_TARNAME=\"vcmi\" -DPACKAGE_VERSION=\"0.8\" -DPACKAGE_STRING=\"vcmi\ 0.8\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"vcmi\" -DVERSION=\"0.8\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_BOOST_FILESYSTEM=/\*\*/ -DHAVE_BOOST_THREAD=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_LIBSDL=1 -DHAVE_LIBSDL_MIXER=1 -DHAVE_LIBSDL_IMAGE=1 -DHAVE_LIBSDL_TTF=1 -DHAVE_LIBAVFORMAT=1 -DHAVE_LIBSWSCALE=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_BOOST_FILESYSTEM_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_REPLACE_HPP=1 -DHAVE_BOOST_FILESYSTEM_OPERATIONS_HPP=1 -DHAVE_BOOST_ASSIGN_STD_VECTOR_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_FIND_HPP=1 -DHAVE_BOOST_FUNCTION_HPP=1 -DHAVE_BOOST_BIND_HPP=1 -DHAVE_ATEXIT=1 -DHAVE_MEMSET=1 -DHAVE_POW=1 -DHAVE_SELECT=1 -DHAVE_SQRT=1 -I.   -pthread -I/usr/include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT   -O0 -ggdb -Wall -Wcast-align -Wpointer-arith -DDATA_DIR=\"/usr/share/vcmi\" -DBIN_DIR=\"/usr/bin\" -DLIB_DIR=\"/usr/lib/vcmi\" -c -o vcmiclient-CThreadHelper.o `test -f '../CThreadHelper.cpp' || echo './'`../CThreadHelper.cpp
../CThreadHelper.cpp:46:2: warning: no newline at end of file
g++ -DPACKAGE_NAME=\"vcmi\" -DPACKAGE_TARNAME=\"vcmi\" -DPACKAGE_VERSION=\"0.8\" -DPACKAGE_STRING=\"vcmi\ 0.8\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"vcmi\" -DVERSION=\"0.8\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_BOOST_FILESYSTEM=/\*\*/ -DHAVE_BOOST_THREAD=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_LIBSDL=1 -DHAVE_LIBSDL_MIXER=1 -DHAVE_LIBSDL_IMAGE=1 -DHAVE_LIBSDL_TTF=1 -DHAVE_LIBAVFORMAT=1 -DHAVE_LIBSWSCALE=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_BOOST_FILESYSTEM_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_REPLACE_HPP=1 -DHAVE_BOOST_FILESYSTEM_OPERATIONS_HPP=1 -DHAVE_BOOST_ASSIGN_STD_VECTOR_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_FIND_HPP=1 -DHAVE_BOOST_FUNCTION_HPP=1 -DHAVE_BOOST_BIND_HPP=1 -DHAVE_ATEXIT=1 -DHAVE_MEMSET=1 -DHAVE_POW=1 -DHAVE_SELECT=1 -DHAVE_SQRT=1 -I.   -pthread -I/usr/include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT   -O0 -ggdb -Wall -Wcast-align -Wpointer-arith -DDATA_DIR=\"/usr/share/vcmi\" -DBIN_DIR=\"/usr/bin\" -DLIB_DIR=\"/usr/lib/vcmi\" -c -o vcmiclient-CDefHandler.o `test -f '../hch/CDefHandler.cpp' || echo './'`../hch/CDefHandler.cpp
../hch/CDefHandler.cpp: In member function 'void CDefHandler::openFromMemory(unsigned char*, const std::string&)':
../hch/CDefHandler.cpp:55: warning: cast from 'unsigned char*' to 'SDefEntry*' increases required alignment of target type
../hch/CDefHandler.cpp:79: warning: cast from 'unsigned char*' to 'SDefEntryBlock*' increases required alignment of target type
../hch/CDefHandler.cpp:98: warning: cast from 'unsigned char*' to 'const Uint32*' increases required alignment of target type
../hch/CDefHandler.cpp: In member function 'SDL_Surface* CDefHandler::getSprite(int, const unsigned char*, const BMPPalette*) const':
../hch/CDefHandler.cpp:147: warning: cast from 'const unsigned char*' to 'const SSpriteDef*' increases required alignment of target type
../hch/CDefHandler.cpp:220: warning: cast from 'const unsigned char*' to 'const unsigned int*' increases required alignment of target type
../hch/CDefHandler.cpp:268: warning: cast from 'const unsigned char*' to 'const Uint16*' increases required alignment of target type
../hch/CDefHandler.cpp:312: warning: cast from 'const unsigned char*' to 'const Uint16*' increases required alignment of target type
../hch/CDefHandler.cpp: At global scope:
../hch/CDefHandler.cpp:18: warning: 'long long int pow(long long int, int)' defined but not used
g++ -DPACKAGE_NAME=\"vcmi\" -DPACKAGE_TARNAME=\"vcmi\" -DPACKAGE_VERSION=\"0.8\" -DPACKAGE_STRING=\"vcmi\ 0.8\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"vcmi\" -DVERSION=\"0.8\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_BOOST_FILESYSTEM=/\*\*/ -DHAVE_BOOST_THREAD=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_LIBSDL=1 -DHAVE_LIBSDL_MIXER=1 -DHAVE_LIBSDL_IMAGE=1 -DHAVE_LIBSDL_TTF=1 -DHAVE_LIBAVFORMAT=1 -DHAVE_LIBSWSCALE=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_BOOST_FILESYSTEM_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_REPLACE_HPP=1 -DHAVE_BOOST_FILESYSTEM_OPERATIONS_HPP=1 -DHAVE_BOOST_ASSIGN_STD_VECTOR_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_FIND_HPP=1 -DHAVE_BOOST_FUNCTION_HPP=1 -DHAVE_BOOST_BIND_HPP=1 -DHAVE_ATEXIT=1 -DHAVE_MEMSET=1 -DHAVE_POW=1 -DHAVE_SELECT=1 -DHAVE_SQRT=1 -I.   -pthread -I/usr/include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT   -O0 -ggdb -Wall -Wcast-align -Wpointer-arith -DDATA_DIR=\"/usr/share/vcmi\" -DBIN_DIR=\"/usr/bin\" -DLIB_DIR=\"/usr/lib/vcmi\" -c -o vcmiclient-CMusicHandler.o `test -f '../hch/CMusicHandler.cpp' || echo './'`../hch/CMusicHandler.cpp
In file included from ../hch/CMusicHandler.h:6,
                 from ../hch/CMusicHandler.cpp:11:
../hch/CSoundBase.h:1038:27: warning: no newline at end of file
In file included from ../hch/CMusicHandler.cpp:11:
../hch/CMusicHandler.h:24: error: using typedef-name 'Mix_Chunk' after 'struct'
/usr/include/SDL/SDL_mixer.h:90: error: 'Mix_Chunk' has a previous declaration here
make[2]: *** [vcmiclient-CMusicHandler.o] Error 1
make[2]: Leaving directory `/home/slash/MyDocs/vcmi_armel/vcmi-0.81-svn1610/client'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/slash/MyDocs/vcmi_armel/vcmi-0.81-svn1610'
make: *** [debian/stamp-makefile-build] Error 2

Google told me that it might help to include the SDL_mixer.h in that file, and to remove the Mix_Chunk struct declaration. Doing so it complains about the missing declaration though. I hope you may have a suggestion what could be wrong here. One guy suggested to check the libsdl-mixer version, which is lbsdl-mixer1.2 1:1.2.6-5+0m5. Any problem with that one?

Thank you in advance!
Daniel

PS: If you need more output or other logs/configs, please let me know!

If I have deciphered the version number correctly, you’re using SDL_mixer 1.2.6. It’s old version (from 2004?) and that may be causing the issue.

Please try looking in your SDL_mixer.h header for the definition of MIX_Chunk. Mine version is below:

/* The internal format for an audio chunk */
typedef struct Mix_Chunk {
	int allocated;
	Uint8 *abuf;
	Uint32 alen;
	Uint8 volume;		/* Per-sample volume, 0-128 */
} Mix_Chunk;

The error message you pasted looks as if first “Mix_Chunk” name (the one after “struct”) were missing.

@Tow
nope

it rather looks like double declared typename
(one structure with diffrent name typedefed to Mix_Chunk, and one structure oryginally with name Mix_chunk)

or it can be even global variable with name Mix_Chunk confunded by compiler with those structure type
(I had similair problem with allegro with error “fixed does not name a type” were just conflict between std::fixed and allegro fixed (allegro is plain C so no namespace, only global one) … all were fixed by remove “using namespace std;” from my code

however not depending at low-level structure of code, there are at least two things named Mix_Chunk

the most real way to eliminate error is to fix includes (or get the new version of included files as Tow said), because its most possibly a non-compability between in-vcmi code and used header

PS: Isn’t typedeffing thing by itself name invalid?

Do you want to bet? :stuck_out_tongue:

(Read the error message, and read this lists.libsdl.org/pipermail/sdl-l … 58115.html )

so it says nope :stuck_out_tongue:
the problem is there is
typedef Mix_Chunk {…} Mix_Chunk;
no that there it isn’t

so its baisicaly double declared Mix_Chunk which even works but makes other statements ambignous (as “struct Mix_Chunk;”)

funny it’s near like it’s uncompatible with itself :stuck_out_tongue:
in fact line is partially incompatible with itself… what an irony!

Have we read the same text?

If you still don’t believe, try compiling it yourself :wink:

ummm confused ;/
better I shut up

It works! :slight_smile: Thank you so much! libsdl-mixer >= 1.2.8 is what you need!

Any chance you’d let me change a few lines of the Debian files in the SVN? Would make things easier and I’d not have to change it again on the next build. If yes, I’ll just post the (minor) changes here and one of you magicians could edit the files. Just let me know…

Once again: Thanks!

Cheers,
Daniel

You’re welcome :slight_smile:

Absolutely. Just post here your changes (patch/diff file would be probably most convenient but if changes are minor I can make them manually) and I’ll be happy to upload them to the repository.

Here we go, patch is attached. It’s a really tiny change, too bad the boost libs use the version number in their name. It turns out the libsdl-mixer1.2-dev ist the only thing you may optimize. At least it works now :wink:

Weird, but even tho the upload is like 1 KiB it says “Sorry, but the maximum filesize for all Attachments is reached. Please contact the Board Administrator if you have questions.” Going to just post the patch as it’s really a small one…

--- control     2010-06-28 09:20:16.762703207 +0200
+++ control     2010-06-28 09:18:04.494270923 +0200
@@ -2,7 +2,7 @@
 Section: games
 Priority: extra
 Maintainer: frank zago <[email protected]>
-Build-Depends: debhelper (>= 7), cdbs (>= 0.4.49), autotools-dev, libsdl-image1.2-dev, libsdl-ttf2.0-dev, libsdl-mixer1.2-dev, zlib1g-dev, libavformat-dev, libswscale-dev, libboost1.37-dev | libboost1.38-dev | libboost1.42-dev, libboost-thread1.37-dev | libboost-thread1.38-dev | libboost-thread1.42-dev, libboost-system1.37-dev | libboost-system1.38-dev | libboost-system1.42-dev, libboost-filesystem1.37-dev | libboost-filesystem1.38-dev | libboost-filesystem1.42-dev, libboost-iostreams1.37-dev | libboost-iostreams1.38-dev | libboost-iostreams1.42-dev
+Build-Depends: debhelper (>= 7), cdbs (>= 0.4.48), autotools-dev, libsdl-image1.2-dev, libsdl-ttf2.0-dev, libsdl-mixer1.2-dev (>= 1.2.8), zlib1g-dev, libavformat-dev, libswscale-dev, libboost1.37-dev | libboost1.38-dev | libboost1.42-dev, libboost-thread1.37-dev | libboost-thread1.38-dev | libboost-thread1.42-dev, libboost-system1.37-dev | libboost-system1.38-dev | libboost-system1.42-dev, libboost-filesystem1.37-dev | libboost-filesystem1.38-dev | libboost-filesystem1.42-dev, libboost-iostreams1.37-dev | libboost-iostreams1.38-dev | libboost-iostreams1.42-dev
 Standards-Version: 3.8.0
 Homepage: http://vcmi.eu

Thanks. I only applied the libsdl-mixer1.2-dev change.

Is the cdbs change also necessary ?

Oh, forgot that one… I only have 0.4.48 available, so I just tried it. It works fine, you could just change it. Guess other people probably have a newer version anyways, but in fact 0.4.48 is enough. :slight_smile: