Building gzdoom in linux with cmake

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

User avatar
GuntherDW
Posts: 117
Joined: Sat Nov 12, 2005 1:53
Location: Belgium, Antwerp
Contact:

Re: Building gzdoom in linux with cmake

Post by GuntherDW »

as i said in the other thread I got r400 to compile, the new renderer initialises well this time, but when you start the game, this is all you see,
and when i tried to open the map using tab, it crashed entirely.
I think this is because i did something wrong somewhere so i'm going to check this out, unless graf doesn't think it's necessary enough right now.
Spoiler: image
edit: hmm, I seem to be wrong, I guess it's nothing I created so i'll release the patch
I'm not happy with the "using namespace GLRendererOld;" in sdlglvideo.cpp though

I don't have enough knowledge of SDL code or your renderer so i'm not sure what to adjust, unless someone wants to volunteer?
I could check up on the code but I think i'll take too long to figure out the other stuff even though you're changing or removing more code.
Attachments
gzdoom.r400.linux.r1.patch.zip
patch
(1.7 KiB) Downloaded 114 times
User avatar
Daniele C.
Posts: 54
Joined: Sun Oct 21, 2007 23:24
Location: Roma

Re: Building gzdoom in linux with cmake

Post by Daniele C. »

I get a linking problem:


There are also warnings which should be cleared up, because they talk about dangerous facts.

Regarding your crashes: maybe we should not mix the new_renderer with the old_renderer?
Last edited by Daniele C. on Thu Jul 23, 2009 15:59, edited 1 time in total.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Building gzdoom in linux with cmake

Post by Graf Zahl »

Can you please retry with r401? I already applied Gunther's patch.
User avatar
Daniele C.
Posts: 54
Joined: Sun Oct 21, 2007 23:24
Location: Roma

Re: Building gzdoom in linux with cmake

Post by Daniele C. »

OK, I reverted everything and updated to r401 and I built the gzdoom executable.

I have attached the full build log (with my commands also).

These are the warnings only (extracted from the attached output), it might be the case to fix them:

Code: Select all

src/d_dehacked.cpp: In function ‘bool LoadDehSupp()’:
src/d_dehacked.cpp:2356: warning: ‘s.DEHSprName::c[3]’ may be used uninitialized in this function
src/d_dehacked.cpp:2356: warning: ‘s.DEHSprName::c[2]’ may be used uninitialized in this function
src/d_dehacked.cpp:2356: warning: ‘s.DEHSprName::c[1]’ may be used uninitialized in this function
src/d_dehacked.cpp:2356: warning: ‘s.DEHSprName::c[0]’ may be used uninitialized in this function
src/p_acs.cpp: In member function ‘int DLevelScript::RunScript()’:
src/p_acs.cpp:4462: warning: unknown conversion type character ‘B’ in format
src/p_acs.cpp:4462: warning: too many arguments for format
src/p_sight.cpp: In member function ‘bool SightCheck::PTR_SightTraverse(intercept_t*)’:
src/p_sight.cpp:184: warning: suggest parentheses around ‘&&’ within ‘||’
src/p_sight.cpp:185: warning: suggest parentheses around ‘&&’ within ‘||’
src/p_sight.cpp:186: warning: suggest parentheses around ‘&&’ within ‘||’
src/tarray.h: In member function ‘void UDMFParser::ParseTextMap(MapData*)’:
src/tarray.h:135: warning: ‘vt.vertex_t::angletime’ may be used uninitialized in this function
src/p_udmf.cpp:1437: note: ‘vt.vertex_t::angletime’ was declared here
src/tarray.h:135: warning: ‘vt.vertex_t::viewangle’ may be used uninitialized in this function
src/p_udmf.cpp:1437: note: ‘vt.vertex_t::viewangle’ was declared here
src/r_polymost.cpp: In member function ‘void PolyClipper::InitMosts(double*, double*, int)’:
src/r_polymost.cpp:143: warning: array subscript is below array bounds
src/gl/common/glc_sections.cpp: In function ‘void DumpSection(int, FGLSection*)’:
src/gl/common/glc_sections.cpp:558: warning: comparison between signed and unsigned integer expressions
In file included from src/gl/common/glc_translate.cpp:42:
src/gl/common/glc_translate.h: In static member function ‘static int GLTranslationPalette::GetIndex(int)’:
src/gl/common/glc_translate.h:51: warning: comparison between signed and unsigned integer expressions
src/gl/common/glc_translate.h:52: warning: comparison between signed and unsigned integer expressions
In file included from src/gl/common/glc_wipe.cpp:53:
src/gl/common/glc_translate.h: In static member function ‘static int GLTranslationPalette::GetIndex(int)’:
src/gl/common/glc_translate.h:51: warning: comparison between signed and unsigned integer expressions
src/gl/common/glc_translate.h:52: warning: comparison between signed and unsigned integer expressions
src/gl/old_renderer/gl1_flats.cpp: In member function ‘void GLRendererOld::GLFlat::ProcessSector(sector_t*, subsector_t*)’:
src/gl/old_renderer/gl1_flats.cpp:584: warning: comparison between signed and unsigned integer expressions
In file included from src/gl/old_renderer/gl1_renderer.cpp:60:
src/gl/common/glc_translate.h: In static member function ‘static int GLTranslationPalette::GetIndex(int)’:
src/gl/common/glc_translate.h:51: warning: comparison between signed and unsigned integer expressions
src/gl/common/glc_translate.h:52: warning: comparison between signed and unsigned integer expressions
src/gl/old_renderer/gl1_renderer.cpp: In member function ‘virtual void GLRendererOld::GL1Renderer::SetupLevel()’:
src/gl/old_renderer/gl1_renderer.cpp:251: warning: comparison between signed and unsigned integer expressions
In file included from src/gl/old_renderer/gl1_scene.cpp:65:
src/gl/gl_models.h:251: warning: ‘typedef’ was ignored in this declaration
src/gl/old_renderer/gl1_shader.cpp: In static member function ‘static GLRendererOld::GLShader* GLRendererOld::GLShader::Find(int)’:
src/gl/old_renderer/gl1_shader.cpp:589: warning: comparison between signed and unsigned integer expressions
In file included from src/gl/old_renderer/gl1_sprite.cpp:56:
src/gl/gl_models.h:251: warning: ‘typedef’ was ignored in this declaration
In file included from src/gl/old_renderer/gl1_texture.cpp:63:
src/gl/common/glc_translate.h: In static member function ‘static int GLTranslationPalette::GetIndex(int)’:
src/gl/common/glc_translate.h:51: warning: comparison between signed and unsigned integer expressions
src/gl/common/glc_translate.h:52: warning: comparison between signed and unsigned integer expressions
src/gl/old_renderer/gl1_texture.cpp: In function ‘void GLRendererOld::ModifyPalette(PalEntry*, PalEntry*, int, int)’:
src/gl/old_renderer/gl1_texture.cpp:324: warning: comparison between signed and unsigned integer expressions
src/gl/old_renderer/gl1_texture.cpp: In member function ‘const GLRendererOld::WorldTextureInfo* GLRendererOld::FGLTexture::Bind(int, int, int, int)’:
src/gl/old_renderer/gl1_texture.cpp:960: warning: comparison between signed and unsigned integer expressions
src/gl/old_renderer/gl1_texture.cpp:961: warning: comparison between signed and unsigned integer expressions
src/gl/old_renderer/gl1_texture.cpp: In member function ‘const GLRendererOld::PatchTextureInfo* GLRendererOld::FGLTexture::BindPatch(int, int, int)’:
src/gl/old_renderer/gl1_texture.cpp:1029: warning: comparison between signed and unsigned integer expressions
src/gl/old_renderer/gl1_texture.cpp:1030: warning: comparison between signed and unsigned integer expressions
src/gl/old_renderer/gl1_walls.cpp: In member function ‘void GLRendererOld::GLWall::ClipFFloors(seg_t*, F3DFloor*, sector_t*, fixed_t, fixed_t, fixed_t, fixed_t)’:
src/gl/old_renderer/gl1_walls.cpp:1225: warning: suggest parentheses around arithmetic in operand of ‘|’
In file included from src/gl/old_renderer/gl1_weapon.cpp:48:
src/gl/gl_models.h:251: warning: ‘typedef’ was ignored in this declaration
In file included from src/gl/new_renderer/gl2_renderer.cpp:46:
src/gl/common/glc_translate.h: In static member function ‘static int GLTranslationPalette::GetIndex(int)’:
src/gl/common/glc_translate.h:51: warning: comparison between signed and unsigned integer expressions
src/gl/common/glc_translate.h:52: warning: comparison between signed and unsigned integer expressions
In file included from src/gl/new_renderer/textures/gl2_texture.cpp:39:
src/gl/common/glc_translate.h: In static member function ‘static int GLTranslationPalette::GetIndex(int)’:
src/gl/common/glc_translate.h:51: warning: comparison between signed and unsigned integer expressions
src/gl/common/glc_translate.h:52: warning: comparison between signed and unsigned integer expressions
In file included from src/gl/new_renderer/textures/gl2_material.cpp:33:
src/gl/common/glc_translate.h: In static member function ‘static int GLTranslationPalette::GetIndex(int)’:
src/gl/common/glc_translate.h:51: warning: comparison between signed and unsigned integer expressions
src/gl/common/glc_translate.h:52: warning: comparison between signed and unsigned integer expressions
In file included from src/gl/gl_framebuffer.cpp:57:
src/gl/common/glc_translate.h: In static member function ‘static int GLTranslationPalette::GetIndex(int)’:
src/gl/common/glc_translate.h:51: warning: comparison between signed and unsigned integer expressions
src/gl/common/glc_translate.h:52: warning: comparison between signed and unsigned integer expressions
src/gl/gl_light.cpp: In function ‘void gl_SetFog(int, int, const FColormap*, bool)’:
src/gl/gl_light.cpp:428: warning: comparison between signed and unsigned integer expressions
src/gl/gl_light.cpp:431: warning: comparison between signed and unsigned integer expressions
In file included from src/gl/gl_models.cpp:47:
src/gl/gl_models.h:251: warning: ‘typedef’ was ignored in this declaration
In file included from src/gl/gl_models_md2.cpp:45:
src/gl/gl_models.h:251: warning: ‘typedef’ was ignored in this declaration
In file included from src/gl/gl_models_md3.cpp:43:
src/gl/gl_models.h:251: warning: ‘typedef’ was ignored in this declaration
Linking CXX executable ../gzdoom
CMakeFiles/zdoom.dir/tempfiles.o: In function `FTempFileName::FTempFileName(char const*)':
tempfiles.cpp:(.text+0x73): warning: the use of `tempnam' is dangerous, better use `mkstemp'
Scanning dependencies of target output_sdl
Linking C shared module liboutput_sdl.so
In my next post I will report the findings of running gzdoom.

Please also delete linux_gzdoom-v1.0.27.patch, linux_gzdoom-v1.0.27L.patch (which I once supplied) and gzdoom_my_diff_r131.diff which are no more useful
Attachments
build_output.txt
(37.21 KiB) Downloaded 113 times
User avatar
Daniele C.
Posts: 54
Joined: Sun Oct 21, 2007 23:24
Location: Roma

Re: Building gzdoom in linux with cmake

Post by Daniele C. »

No luck, crash at first sight.

This the result:

Code: Select all

GZDoom v1.2.1 - SVN revision 401 - SDL version
Compiled on Jul 23 2009

M_LoadDefaults: Load system defaults.


*** Fatal Error ***
Address not mapped to object (signal 11)

Generating zdoom-crash.log and killing process 29960, please wait... Killed
I have attached zdoom-crash.log
Attachments
zdoom-crash.log.txt
(5.47 KiB) Downloaded 126 times
User avatar
Daniele C.
Posts: 54
Joined: Sun Oct 21, 2007 23:24
Location: Roma

Re: Building gzdoom in linux with cmake

Post by Daniele C. »

I have built gzdoom with cmake -DCMAKE_BUILD_TYPE=Debug && make and now it works!

Anyway it should be fixed for the default (release?) build
User avatar
GuntherDW
Posts: 117
Joined: Sat Nov 12, 2005 1:53
Location: Belgium, Antwerp
Contact:

Re: Building gzdoom in linux with cmake

Post by GuntherDW »

It works like a charm here. Do you have GCC 4.3 or anything older?
I haven't tried building & running it with GCC 4.4 yet.

Also, i'm running it on a 64bit kernel. I'll have to try a 32b build as well i guess :).
I'll check the code and your log to see why it's crashing.
User avatar
Daniele C.
Posts: 54
Joined: Sun Oct 21, 2007 23:24
Location: Roma

Re: Building gzdoom in linux with cmake

Post by Daniele C. »

I have gcc 4.4.0-5.1 and running on 32bit Intel, looks like a conversion problem.

Maybe we should clear out those warnings first? I don't have time right now but will work on a patch for them tomorrow (if nobody does first).

Usually crashes which disappear with debug builds are due to uninitalized variables.

Anyway thanks to everybody for the help! :)
User avatar
Daniele C.
Posts: 54
Joined: Sun Oct 21, 2007 23:24
Location: Roma

Re: Building gzdoom in linux with cmake

Post by Daniele C. »

New revision (r402), new problems, but I think this can be easily fixable.
messages.txt
(7.68 KiB) Downloaded 109 times
We have a linking problem now:

Code: Select all

CMakeFiles/zdoom.dir/m_joy.o: In function `cvarfunc_use_joystick':
src/zstring.h:139: multiple definition of `use_joystick'
CMakeFiles/zdoom.dir/sdl/i_input.o:src/sdl/i_input.cpp:95: first defined here
CMakeFiles/zdoom.dir/tempfiles.o: In function `FTempFileName':
src/tempfiles.cpp:46: warning: the use of `tempnam' is dangerous, better use `mkstemp'
CMakeFiles/zdoom.dir/d_main.o: In function `D_ProcessEvents()':
src/d_main.cpp:245: undefined reference to `I_UpdateDeviceList()'
User avatar
Daniele C.
Posts: 54
Joined: Sun Oct 21, 2007 23:24
Location: Roma

Re: Building gzdoom in linux with cmake

Post by Daniele C. »

Hi guys,

as promised I come up with fixes for the g++ warnings, and a proper bugfix for the 2 compilation errors of r402.

With this patch r402 compiles without a hitch and runs greatly :D

I am happy to be able again to play GZDoom on my box!

Note: this patch does not implement the SDL Joystick re-scanning code, so there is a feature missing right now: on Windows platforms joysticks plugged after launching gzdoom will be recognized, on Linux not (yet). r402 was missing the function so I simply added a dummy one to compile (perfectly legal, no harm). Implementation should be feasible because we can re-init only the Joystick subsystem, but this should be checked for performance and joystick re-indexing.
Attachments
gzdoom-r402-bugfixes.diff.zip
(2.84 KiB) Downloaded 117 times
User avatar
Daniele C.
Posts: 54
Joined: Sun Oct 21, 2007 23:24
Location: Roma

Re: Building gzdoom in linux with cmake

Post by Daniele C. »

I forgot to add: this patch also fixes the crash in the 'Release' build, which was due to something weird being done with the exponent parameter of a dtoa() call in src/zstrformat.cpp.

All included in the previous patch; so now it builds correctly both with Debug and Release CMAKE_BUILD_TYPE.
User avatar
GuntherDW
Posts: 117
Joined: Sat Nov 12, 2005 1:53
Location: Belgium, Antwerp
Contact:

Re: Building gzdoom in linux with cmake

Post by GuntherDW »

Am I the only one using gzdoom in Linux with the "2x SDL video init" bug?
I've included the fix for that in numerous patches, but Graf never seems to include it.

I'm talking about the patch in v_video.cpp at line ~1500.

The change from

Code: Select all

	FBaseCVar::ResetColors ();
	C_NewModeAdjust();
	M_InitVideoModesMenu();
	BorderNeedRefresh = screen->GetPageCount ();
	setsizeneeded = true;
}
to

Code: Select all

	FBaseCVar::ResetColors ();
	C_NewModeAdjust();
	M_InitVideoModesMenu();
	BorderNeedRefresh = screen->GetPageCount ();
	setsizeneeded = true;
#ifdef __GNUC__
	setmodeneeded = false;
#endif
}
In a clean r404 without this change I get a black screen, and can't do anything. While some other times when it wants to load there's serious texture corruption and a crash when i try to start the game.
Spoiler: Screenshot of the corruption

Thanks Daniele C. for the patches, I've always wanted someone with some SDL knowledge to look at the code :).
I've got (some) knowledge of C/C++, but absolutely none with SDL.
User avatar
Daniele C.
Posts: 54
Joined: Sun Oct 21, 2007 23:24
Location: Roma

Re: Building gzdoom in linux with cmake

Post by Daniele C. »

GuntherDW wrote:Am I the only one using gzdoom in Linux with the "2x SDL video init" bug?
I've included the fix for that in numerous patches, but Graf never seems to include it.

I'm talking about the patch in v_video.cpp at line ~1500.
I have tested both binaries (with and without your patch) and I can witness that there is no side effect, plus with your patch the video is initialized only once (which is indeed a good thing!).

So if it also fixes a bug on your configuration (and most surely on many more) I think it could be easily be added (if Graf decides so).
GuntherDW wrote:Thanks Daniele C. for the patches, I've always wanted someone with some SDL knowledge to look at the code :).
I've got (some) knowledge of C/C++, but absolutely none with SDL.
Well I am not really an SDL fan, but I used it when I was a young programmer :) It's easy, but there are some drawbacks. Nowadays I prefer using GLFramework; still there is to say that the SDL input layer is a good one.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Building gzdoom in linux with cmake

Post by Graf Zahl »

That fix gets undone each time I update from ZDoom - because it's not in there. v_video is one of the files that I have marked as having no difference so it just gets copied over again.

If you can verify that your fix has no side effects on ZDoom itself I'll include it there, too.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Building gzdoom in linux with cmake

Post by Graf Zahl »

Can you please explain what you did in zstrformat? Your fix does not make much sense so unless you give a good explanation for it I'll revert it before committing.
Locked

Return to “GZDoom”