Compiling SRB2 Linux using CMake Unix Makefiles

Status
Not open for further replies.

HitCoder

Launcher Blaster
Hello,
I'm trying to compile SRB2 on Linux (mainly so I can help guide a friend on compiling it for mac).
I've installed all documented dependencies, and I've followed the instructions given on http://wiki.srb2.org/wiki/Source_code_compiling/CMake

I'm using the Unix Makefiles generator with "Use default native compilers" radio button checked.

I'm setting MAKE_BUILD_TYPE to Release

I also would like to build the 32bit binary for it but I'm not sure how; I did install NASM but there seems to be no NASM option (though there's one for YASM, so if I would need to use that instead to build 32bit I can easily install that).

Though right now the problem is that the main build process is failing, here is the build log from my terminal window:

Code:
[hitcoder@HitCoder-Desktop new-srb2-bin]$ make
[  0%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/am_map.c.o
[  1%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/b_bot.c.o
[  2%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/command.c.o
[  3%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/comptime.c.o
[  4%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/console.c.o
[  4%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/d_clisrv.c.o
[  5%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/d_main.c.o
[  6%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/d_net.c.o
[  7%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/d_netcmd.c.o
[  8%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/d_netfil.c.o
[  8%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/dehacked.c.o
[  9%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/f_finale.c.o
[ 10%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/f_wipe.c.o
[ 11%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/filesrch.c.o
[ 12%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/g_game.c.o
[ 12%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/g_input.c.o
[ 13%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/hu_stuff.c.o
[ 14%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/i_tcp.c.o
[ 15%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/info.c.o
[ 16%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/lzf.c.o
[ 16%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/m_aatree.c.o
[ 17%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/m_anigif.c.o
[ 18%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/m_argv.c.o
[ 19%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/m_bbox.c.o
[ 20%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/m_cheat.c.o
[ 20%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/m_cond.c.o
[ 21%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/m_fixed.c.o
[ 22%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/m_menu.c.o
[ 23%] Building C object src/sdl/CMakeFiles/SRB2SDL2.dir/__/m_misc.c.o
/home/hitcoder/srb2-2119/src/m_misc.c:782:50: error: macro "PNG_EXPORT" requires 4 arguments, but only 2 given
 typedef PNG_EXPORT(png_uint_32, (*P_png_set_acTL)) PNGARG((png_structp png_ptr,
                                                  ^
/home/hitcoder/srb2-2119/src/m_misc.c:782:9: warning: type defaults to ‘int’ in declaration of ‘PNG_EXPORT’ [-Wimplicit-int]
 typedef PNG_EXPORT(png_uint_32, (*P_png_set_acTL)) PNGARG((png_structp png_ptr,
         ^~~~~~~~~~
/home/hitcoder/srb2-2119/src/m_misc.c:784:52: error: macro "PNG_EXPORT" requires 4 arguments, but only 2 given
 typedef PNG_EXPORT (void, (*P_png_write_frame_head)) PNGARG((png_structp png_ptr,
                                                    ^
In file included from /usr/include/png.h:370:0,
                 from /home/hitcoder/srb2-2119/src/m_misc.c:86:
/home/hitcoder/srb2-2119/src/m_misc.c:784:74: error: expected ‘)’ before ‘png_ptr’
 typedef PNG_EXPORT (void, (*P_png_write_frame_head)) PNGARG((png_structp png_ptr,
                                                                          ^
/home/hitcoder/srb2-2119/src/m_misc.c:791:52: error: macro "PNG_EXPORT" requires 4 arguments, but only 2 given
 typedef PNG_EXPORT (void, (*P_png_write_frame_tail)) PNGARG((png_structp png_ptr,
                                                    ^
In file included from /usr/include/png.h:370:0,
                 from /home/hitcoder/srb2-2119/src/m_misc.c:86:
/home/hitcoder/srb2-2119/src/m_misc.c:791:74: error: expected ‘)’ before ‘png_ptr’
 typedef PNG_EXPORT (void, (*P_png_write_frame_tail)) PNGARG((png_structp png_ptr,
                                                                          ^
/home/hitcoder/srb2-2119/src/m_misc.c:793:8: error: unknown type name ‘P_png_set_acTL’
 static P_png_set_acTL apng_set_acTL = NULL;
        ^~~~~~~~~~~~~~
/home/hitcoder/srb2-2119/src/m_misc.c:793:39:  warning: initialization  makes integer from pointer without a cast  [-Wint-conversion]
 static P_png_set_acTL apng_set_acTL = NULL;
                                       ^~~~
/home/hitcoder/srb2-2119/src/m_misc.c:794:8: error: unknown type name ‘P_png_write_frame_head’
 static P_png_write_frame_head apng_write_frame_head = NULL;
        ^~~~~~~~~~~~~~~~~~~~~~
/home/hitcoder/srb2-2119/src/m_misc.c:794:55:  warning: initialization  makes integer from pointer without a cast  [-Wint-conversion]
 static P_png_write_frame_head apng_write_frame_head = NULL;
                                                       ^~~~
/home/hitcoder/srb2-2119/src/m_misc.c:795:8: error: unknown type name ‘P_png_write_frame_tail’
 static P_png_write_frame_tail apng_write_frame_tail = NULL;
        ^~~~~~~~~~~~~~~~~~~~~~
/home/hitcoder/srb2-2119/src/m_misc.c:795:55:  warning: initialization  makes integer from pointer without a cast  [-Wint-conversion]
 static P_png_write_frame_tail apng_write_frame_tail = NULL;
                                                       ^~~~
/home/hitcoder/srb2-2119/src/m_misc.c: In function ‘M_PNGLib’:
/home/hitcoder/srb2-2119/src/m_misc.c:824:16: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
  apng_set_acTL = hwSym("png_set_acTL", pnglib);
                ^
/home/hitcoder/srb2-2119/src/m_misc.c:825:24: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
  apng_write_frame_head = hwSym("png_write_frame_head", pnglib);
                        ^
/home/hitcoder/srb2-2119/src/m_misc.c:826:24: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
  apng_write_frame_tail = hwSym("png_write_frame_tail", pnglib);
                        ^
/home/hitcoder/srb2-2119/src/m_misc.c: In function ‘M_PNGFrame’:
/home/hitcoder/srb2-2119/src/m_misc.c:850:3: error: called object ‘apng_set_acTL’ is not a function or function pointer
   apng_set_acTL(apng_ptr, apng_info_ptr, apng_frames, 0);
   ^~~~~~~~~~~~~
/home/hitcoder/srb2-2119/src/m_misc.c:793:23: note: declared here
 static P_png_set_acTL apng_set_acTL = NULL;
                       ^~~~~~~~~~~~~
/home/hitcoder/srb2-2119/src/m_misc.c:861:3: error: called object ‘apng_write_frame_head’ is not a function or function pointer
   apng_write_frame_head(apng_ptr, apng_info_ptr, row_pointers,
   ^~~~~~~~~~~~~~~~~~~~~
/home/hitcoder/srb2-2119/src/m_misc.c:794:31: note: declared here
 static P_png_write_frame_head apng_write_frame_head = NULL;
                               ^~~~~~~~~~~~~~~~~~~~~
/home/hitcoder/srb2-2119/src/m_misc.c:876:3: error: called object ‘apng_write_frame_tail’ is not a function or function pointer
   apng_write_frame_tail(apng_ptr, apng_info_ptr);
   ^~~~~~~~~~~~~~~~~~~~~
/home/hitcoder/srb2-2119/src/m_misc.c:795:31: note: declared here
 static P_png_write_frame_tail apng_write_frame_tail = NULL;
                               ^~~~~~~~~~~~~~~~~~~~~
/home/hitcoder/srb2-2119/src/m_misc.c: In function ‘M_PNGfind_acTL’:
/home/hitcoder/srb2-2119/src/m_misc.c:894:8:  warning: implicit  declaration of function ‘png_memcmp’; did you mean  ‘png_sig_cmp’?  [-Wimplicit-function-declaration]
   if (!png_memcmp(cn+4, acTL_cn, 4)) //cmp for chuck header
        ^~~~~~~~~~
        png_sig_cmp
/home/hitcoder/srb2-2119/src/m_misc.c: In function ‘M_PNGfix_acTL’:
/home/hitcoder/srb2-2119/src/m_misc.c:908:3: error: called object ‘apng_set_acTL’ is not a function or function pointer
   apng_set_acTL(png_ptr, png_info_ptr, apng_frames, 0);
   ^~~~~~~~~~~~~
/home/hitcoder/srb2-2119/src/m_misc.c:793:23: note: declared here
 static P_png_set_acTL apng_set_acTL = NULL;
                       ^~~~~~~~~~~~~
/home/hitcoder/srb2-2119/src/m_misc.c:914:9:  error: dereferencing  pointer to incomplete type ‘png_struct {aka struct  png_struct_def}’
  png_ptr->num_frames_to_write = apng_frames;
         ^~
/home/hitcoder/srb2-2119/src/m_misc.c: In function ‘M_SetupaPNG’:
/home/hitcoder/srb2-2119/src/m_misc.c:976:3: error: called object ‘apng_set_acTL’ is not a function or function pointer
   apng_set_acTL(apng_ptr, apng_info_ptr, PNG_UINT_31_MAX, 0);
   ^~~~~~~~~~~~~
/home/hitcoder/srb2-2119/src/m_misc.c:793:23: note: declared here
 static P_png_set_acTL apng_set_acTL = NULL;
                       ^~~~~~~~~~~~~
make[2]: *** [src/sdl/CMakeFiles/SRB2SDL2.dir/build.make:735: src/sdl/CMakeFiles/SRB2SDL2.dir/__/m_misc.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:104: src/sdl/CMakeFiles/SRB2SDL2.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

This is after running configure and generate and then cd-ing into the directory for building binaries is specified, and running "make"

If any more information is needed to allow you to help me resolve this issue, I am happy to oblige. Help would be much appreciated, though I'm currently messing around trying to get it working myself. If I find a solution before anyone else does I'll make sure to detail where I was going wrong.

Also, other notes are that I copied all of the default assets from a (fresh) windows extract of srb2, and put it in the assets folder of the cloned git repository before running cmake. Without doing this I recieved this log in cmake:

p, li { white-space: pre-wrap; } Target is 64-bit
Found GME
Found SDL2_MIXER
Found SDL2
CMake Error at assets/CMakeLists.txt:22 (file):
file MD5 failed to read file "/home/hitcoder/srb2-2119/assets/srb2.srb": No
such file or directory

CMake Error at assets/CMakeLists.txt:22 (file):
file MD5 failed to read file "/home/hitcoder/srb2-2119/assets/player.dta":
No such file or directory

CMake Error at assets/CMakeLists.txt:22 (file):
file MD5 failed to read file "/home/hitcoder/srb2-2119/assets/rings.dta":
No such file or directory

CMake Error at assets/CMakeLists.txt:22 (file):
file MD5 failed to read file "/home/hitcoder/srb2-2119/assets/zones.dta":
No such file or directory

CMake Error at assets/CMakeLists.txt:22 (file):
file MD5 failed to read file "/home/hitcoder/srb2-2119/assets/patch.dta":
No such file or directory

Configuring incomplete, errors occurred!
See also "/home/hitcoder/Documents/new-srb2-bin/CMakeFiles/CMakeOutput.log".

Along with this I'm seeing the target by default is "64-bit" where I want 32bit. I'm gonna mess with params to see if I can figure out CMake since I usually just use make.

Kind regards.
 
Last edited:
Seems your main build processing is failing when it gets to the png-related code for whatever reason, hm...

I did install NASM but there seems to be no NASM option (though there's one for YASM, so if I would need to use that instead to build 32bit I can easily install that).

From what I'm aware, SRB2_CONFIG_USEASM is the option that turns on support for NASM/YASM. If you don't turn on the YASM option, it just uses NASM by default as far as I can tell.
 
Okay, the conclusion I've come to here regarding the PNG code errors in m_misc.c is that the errors are most likely because our code is for an outdated version of libpng (seems to be 1.2.46 I think?), whereas more recent versions of libpng have made changes we haven't accounted for.

I'm not exactly sure how to get around that... maybe Alam can jump in and help here?
 
Thanks Iestyn; I'll see if I can install an older version of libpng, and I'll report anything else.

Also, if I check SRB2_CONFIG_USEASM will it give me a 32bit build to compile?

EDIT: it only lets me use 1.2.57
 
Last edited:
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top