Compilation with Code::Blocks and MinGW

Assertion with 32 bit, 64 bit crashes inside SDL, currently only 32 bit with new dlls works.

Impossible. All the releases up till 0.94 were send out with the DLLs from the package I have linked. If the SDL_mixer from the package were faulty, it would have failed assertion for last few years.
What are the exact modification dates of the files you refer to as “old dll” and “new dll”?
The Aug 2011 SDL_mixer.dll should not fail on that assertion. The Jan 2014 SDL_mixer.dll should behave exactly the same. Everything older (like 2006 build from older packages) will fail.

I am going to upload the new libraries pack anyway (it’ll take a day or two, since I have it on another machine + need to finally sort out some dependencies issues) but the issue you describe sounds inexplicable to me.

I have uploaded a new libraries pack, that I have used to build last development releases:

  • these are C libraries, so they should work across all popular compilers (including MSVC and MinGW). Both 32 and 64-bit binaries are provided. I have not tested 64-bit binaries.
  • pack was compiled with Visual 2013, so libraries depends on MSVC runtime (they need msvcp120.dll and msvcr120.dll — you can copy them from last dev package)
  • I believe the libraries does not require anything else. (if they fail to run due to a missing dependency, please report this)
  • you can extract additional DLLs (like libpng15-15.dll) that will be used as plugins by the library from pack. *

Link: download.vcmi.eu/msvc-pack.2014.1.7z*

Thanks for updated libs.

Problem with assertion solved, but it was different problem - “redundant” SDL mixer plugin smpeg.

BTW. Found the bug report about gcc crash with large PCH gcc.gnu.org/bugzilla/show_bug.cgi?id=56926.

Thanks for sharing this discovery. I wasn’t aware that SDL_mixer prefers using SMPEG plugin even when it was compiled with libmad.

Nice found. Still, it seems there is nothing we can do about it.

32bit gcc + debug simbols = out of memory compiling registertypes.cpp o_O (again about 64 bit)

registertypes.cpp compiles at the beginning, right? I had the same issue on 4%, vcmi’s compilation ate all memory.

Even 64 bit gcc 492 just crushes with precompiled header enabled …

Any tips for build vcmi with code::blocks? :blush:

Are any particular problems or you are asking for complete guide?

If you can give me a complete guide, i’ll be happy, but if you say what libraries are needed, or something like that it can help me too.

Libraries: zlib, boost, ffmpeg, SDL2, SDL2_image, SDL2_mixer, SDL2_ttf
(also QT5 needed for launcher but there is no C::B project for launcher yet)

Hmm I can’t build it -_-

C:\Users\Vampir\AppData\Local\Temp\ccoA7Llf.s: Assembler messages:
C:\Users\Vampir\AppData\Local\Temp\ccoA7Llf.s: Fatal error: can't write .objs\client\Client.o: File too big
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/as.exe: .objs\client\Client.o: too many sections (61905)
C:\Users\Vampir\AppData\Local\Temp\ccoA7Llf.s: Fatal error: can't close .objs\client\Client.o: File too big
Process terminated with status 1 (0 minute(s), 43 second(s))
0 error(s), 6 warning(s) (0 minute(s), 43 second(s))

Set “Settings-Compiler-Other settings-Compiler logging” to Full command line and post here several messages from Build log.

-------------- Build: Debug Win32 in VCMI_client (compiler: GNU GCC Compiler)---------------

x86_64-w64-mingw32-c++.exe -std=c++11 -I\include -I. -c "C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\client\Client.cpp" -o .objs\client\Client.o
In file included from ./boost/thread.hpp:24:0,
                 from C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\client\../Global.h:157,
                 from C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\client\StdInc.h:3,
                 from C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\client\Client.cpp:1:
./boost/thread/future.hpp:101:5: warning: inline function 'boost::system::error_code boost::system::make_error_code(boost::future_errc)' declared as  dllimport: attribute ignored -Wattributes]
./boost/thread/future.hpp:108:5: warning: inline function 'boost::system::error_condition boost::system::make_error_condition(boost::future_errc)' declared as  dllimport: attribute ignored -Wattributes]
In file included from ./boost/interprocess/errors.hpp:37:0,
                 from ./boost/interprocess/exceptions.hpp:20,
                 from ./boost/interprocess/sync/scoped_lock.hpp:27,
                 from C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\client\../lib/Interprocess.h:3,
                 from C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\client\Client.cpp:24:
./boost/interprocess/detail/win32_api.hpp:821:116: warning: declaration of 'void* boost::interprocess::winapi::CreateMutexA(boost::interprocess::winapi::interprocess_security_attributes*, int, const char*)' with C language linkage [enabled by default]
In file included from ./boost/thread/win32/thread_data.hpp:12:0,
                 from ./boost/thread/thread.hpp:15,
                 from ./boost/thread.hpp:13,
                 from C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\client\../Global.h:157,
                 from C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\client\StdInc.h:3,
                 from C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\client\Client.cpp:1:
./boost/thread/win32/thread_primitives.hpp:119:55: warning: conflicts with previous declaration 'void* boost::detail::win32::CreateMutexA(boost::detail::win32::_SECURITY_ATTRIBUTES*, int, const char*)' [enabled by default]
In file included from ./boost/interprocess/errors.hpp:37:0,
                 from ./boost/interprocess/exceptions.hpp:20,
                 from ./boost/interprocess/sync/scoped_lock.hpp:27,
                 from C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\client\../lib/Interprocess.h:3,
                 from C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\client\Client.cpp:24:
./boost/interprocess/detail/win32_api.hpp:826:127: warning: declaration of 'void* boost::interprocess::winapi::CreateSemaphoreA(boost::interprocess::winapi::interprocess_security_attributes*, long int, long int, const char*)' with C language linkage [enabled by default]
In file included from ./boost/thread/win32/thread_data.hpp:12:0,
                 from ./boost/thread/thread.hpp:15,
                 from ./boost/thread.hpp:13,
                 from C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\client\../Global.h:157,
                 from C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\client\StdInc.h:3,
                 from C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\client\Client.cpp:1:
./boost/thread/win32/thread_primitives.hpp:120:55: warning: conflicts with previous declaration 'void* boost::detail::win32::CreateSemaphoreA(boost::detail::win32::_SECURITY_ATTRIBUTES*, long int, long int, const char*)' [enabled by default]
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/as.exe: .objs\client\Client.o: too many sections (61905)
C:\Users\Vampir\AppData\Local\Temp\ccWGCWJ5.s: Assembler messages:
C:\Users\Vampir\AppData\Local\Temp\ccWGCWJ5.s: Fatal error: can't write .objs\client\Client.o: File too big
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/as.exe: .objs\client\Client.o: too many sections (61905)
C:\Users\Vampir\AppData\Local\Temp\ccWGCWJ5.s: Fatal error: can't close .objs\client\Client.o: File too big
Process terminated with status 1 (0 minute(s), 47 second(s))

there should be at least -Og optimization level. Threre is that option is C::B projects.

-------------- Clean: Debug-win32 in minizip (compiler: GNU GCC Compiler)---------------

Cleaned "minizip - Debug-win32"

-------------- Build: Debug-win32 in minizip (compiler: GNU GCC Compiler)---------------

mingw32-gcc.exe -Wall -g -DBUILD_DLL -O -Wextra -Wall -I"C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\zlib-1.2.8\win32\include" -c C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c -o ..\..\obj\minizip\Debug\x86\ioapi.o
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c: In function 'fopen_file_func':
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c:95:49: warning: unused parameter 'opaque' -Wunused-parameter]
 static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
                                                 ^
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c: In function 'fopen64_file_func':
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c:113:51: warning: unused parameter 'opaque' -Wunused-parameter]
 static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
                                                   ^
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c: In function 'fread_file_func':
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c:132:48: warning: unused parameter 'opaque' -Wunused-parameter]
 static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
                                                ^
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c: In function 'fwrite_file_func':
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c:139:49: warning: unused parameter 'opaque' -Wunused-parameter]
 static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
                                                 ^
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c: In function 'ftell_file_func':
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c:146:47: warning: unused parameter 'opaque' -Wunused-parameter]
 static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
                                               ^
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c: In function 'ftell64_file_func':
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c:154:53: warning: unused parameter 'opaque' -Wunused-parameter]
 static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
                                                     ^
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c: In function 'fseek_file_func':
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c:161:48: warning: unused parameter 'opaque' -Wunused-parameter]
 static long ZCALLBACK fseek_file_func (voidpf  opaque, voidpf stream, uLong offset, int origin)
                                                ^
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c: In function 'fseek64_file_func':
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c:184:50: warning: unused parameter 'opaque' -Wunused-parameter]
 static long ZCALLBACK fseek64_file_func (voidpf  opaque, voidpf stream, ZPOS64_T offset, int origin)
                                                  ^
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c: In function 'fclose_file_func':
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c:210:47: warning: unused parameter 'opaque' -Wunused-parameter]
 static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
                                               ^
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c: In function 'ferror_file_func':
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\ioapi.c:217:47: warning: unused parameter 'opaque' -Wunused-parameter]
 static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
                                               ^
mingw32-gcc.exe -Wall -g -DBUILD_DLL -O -Wextra -Wall -I"C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\zlib-1.2.8\win32\include" -c C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\unzip.c -o ..\..\obj\minizip\Debug\x86\unzip.o
mingw32-gcc.exe -Wall -g -DBUILD_DLL -O -Wextra -Wall -I"C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\zlib-1.2.8\win32\include" -c C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\zip.c -o ..\..\obj\minizip\Debug\x86\zip.o
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\zip.c: In function 'zipOpenNewFileInZip4_64':
C:\Users\Vampir\Documents\vcmi-dev\vcmi-develop\lib\minizip\zip.c:1075:5: warning: statement with no effect -Wunused-value]
     (crcForCrypting);
     ^
mingw32-g++.exe -shared  -Wl,--out-implib=..\..\libminizip.a -Wl,--dll -L"C:\Users\Vampir\Downloads\vcmi-develop (1)\vcmi-develop\zlib-1.2.8\win32\lib" ..\..\obj\minizip\Debug\x86\ioapi.o ..\..\obj\minizip\Debug\x86\unzip.o ..\..\obj\minizip\Debug\x86\zip.o  -o ..\..\minizip.dll -lz  
c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lz
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 1 second(s))
1 error(s), 11 warning(s) (0 minute(s), 1 second(s))
 

I think i have to use another ide -_-

“cannot find -lz” - zlib not found

But there is zlib, when there wasn’t there was an error with

#include "zlib.h"

Headers and object files are in different places.