Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error: invalid conversion from ‘int’ to ‘boolean’ #46

Open
Ambrevar opened this issue Feb 28, 2020 · 20 comments
Open

Build error: invalid conversion from ‘int’ to ‘boolean’ #46

Ambrevar opened this issue Feb 28, 2020 · 20 comments

Comments

@Ambrevar
Copy link

On master:

[ 88%] Building CXX object client/CMakeFiles/warsow.dir/__/ref/mesh.cpp.o
cd /tmp/guix-build-warsow-qfusion-2.1.0-1.5ec6887.drv-0/source/build/client && /gnu/store/x3jx25cd3q363mr7nbgzrhrv1vza6cf7-gcc-7.4.0/bin/c++  -DAPPLICATION_VERSION_HEADER=\"version.warsow.h\" -DFREETYPELIB_RUNTIME -DLIBCURL_RUNTIME -DLIBJPEG_RUNTIME -DLIBPNG_RUNTIME -DOGGLIB_RUNTIME -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_QML_LIB -DQT_QUICK_LIB -DTHEORALIB_RUNTIME -DUSE_SDL2 -DVORBISLIB_RUNTIME -DZLIB_RUNTIME -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/tmp/guix-build-warsow-qfusion-2.1.0-1.5ec6887.drv-0/source/build/client/warsow_autogen/include -I/gnu/store/qx7p7hiq90mi7r78hcr9cyskccy2j4bg-zlib-1.2.11/include -I/gnu/store/4m8dlhrzis07787xznx73ang35c3lly1-curl-7.65.3/include -I/gnu/store/0i3ky5nr8z5zpz0nb5dl78wll30h90i7-libjpeg-9c/include -I/gnu/store/3snpwk7jl8i125bhiilvk9scqc4mnsx7-libpng-1.6.37/include -I/gnu/store/5xb0hi13dsazgsy6g0w56hl41763d34z-libogg-1.3.4/include -I/gnu/store/fxfks4f2f2h7cmk6g242kvs6lckn5i5c-libvorbis-1.3.6/include -I/gnu/store/n367si248svwbhhmfwsmv74zl98sa0qk-freetype-2.10.1/include/freetype2 -I/tmp/guix-build-warsow-qfusion-2.1.0-1.5ec6887.drv-0/source/source/client/../../third-party/magic_enum/include -I/gnu/store/5m7nbhd8hwfyy9j6g7g1gf6ql1kzllkz-sdl2-2.0.10/include/SDL2 -isystem /gnu/store/dg3f19yvgf0bv8ccyn3xrdmbqifdn7kf-qtbase-5.12.7/include/qt5 -isystem /gnu/store/dg3f19yvgf0bv8ccyn3xrdmbqifdn7kf-qtbase-5.12.7/include/qt5/QtCore -isystem /gnu/store/dg3f19yvgf0bv8ccyn3xrdmbqifdn7kf-qtbase-5.12.7/lib/qt5/mkspecs/linux-g++ -isystem /gnu/store/8mv5rvqpm4jf0yig89569rg71hckr9qa-qtdeclarative-5.12.7/include/qt5 -isystem /gnu/store/8mv5rvqpm4jf0yig89569rg71hckr9qa-qtdeclarative-5.12.7/include/qt5/QtQuick -isystem /gnu/store/8mv5rvqpm4jf0yig89569rg71hckr9qa-qtdeclarative-5.12.7/include/qt5/QtQml -isystem /gnu/store/dg3f19yvgf0bv8ccyn3xrdmbqifdn7kf-qtbase-5.12.7/include/qt5/QtNetwork -isystem /gnu/store/dg3f19yvgf0bv8ccyn3xrdmbqifdn7kf-qtbase-5.12.7/include/qt5/QtGui -isystem /gnu/store/cxnra20zy4zdbnw563q5s3bbgan20nmg-mesa-19.3.2/include  -pipe -Wall -Wno-unused-function -fvisibility=hidden -Winvalid-pch -O2 -g -DNDEBUG   -fPIC -std=gnu++1z -o CMakeFiles/warsow.dir/__/ref/mesh.cpp.o -c /tmp/guix-build-warsow-qfusion-2.1.0-1.5ec6887.drv-0/source/source/ref/mesh.cpp
/tmp/guix-build-warsow-qfusion-2.1.0-1.5ec6887.drv-0/source/source/ref/imagelib.cpp: In function ‘boolean q_jpg_fill_input_buffer(j_decompress_ptr)’:
/tmp/guix-build-warsow-qfusion-2.1.0-1.5ec6887.drv-0/source/source/ref/imagelib.cpp:765:9: error: invalid conversion from ‘int’ to ‘boolean’ [-fpermissive]
  return 1;
         ^
/tmp/guix-build-warsow-qfusion-2.1.0-1.5ec6887.drv-0/source/source/ref/imagelib.cpp: In function ‘bool WriteJPG(const char*, r_imginfo_t*, int)’:
/tmp/guix-build-warsow-qfusion-2.1.0-1.5ec6887.drv-0/source/source/ref/imagelib.cpp:958:37: error: cannot convert ‘bool’ to ‘boolean’ in argument passing
  qjpeg_start_compress( &cinfo, true );
                                     ^

I believe the following patch should cut it:

static boolean q_jpg_fill_input_buffer( j_decompress_ptr cinfo ) {
	Com_DPrintf( "Premature end of jpeg file\n" );
-	return 1;
+	return true;
}
@Ambrevar Ambrevar changed the title Build error: Cannot conver Build error: invalid conversion from ‘int’ to ‘boolean’ Feb 28, 2020
@Ambrevar
Copy link
Author

Sorry, it's TRUE, not true.
Full patch

diff --git a/source/ref/imagelib.cpp b/source/ref/imagelib.cpp
index 33337ac..bb9a156 100644
--- a/source/ref/imagelib.cpp
+++ b/source/ref/imagelib.cpp
@@ -762,7 +762,7 @@ static void q_jpg_noop( j_decompress_ptr cinfo ) {

 static boolean q_jpg_fill_input_buffer( j_decompress_ptr cinfo ) {
 	Com_DPrintf( "Premature end of jpeg file\n" );
-	return 1;
+	return TRUE;
 }

 static void q_jpg_skip_input_data( j_decompress_ptr cinfo, long num_bytes ) {
@@ -955,7 +955,7 @@ bool WriteJPG( const char *name, r_imginfo_t *info, int quality ) {
 	}

 	// start compression
-	qjpeg_start_compress( &cinfo, true );
+	qjpeg_start_compress( &cinfo, TRUE );

 	// feed scanline data
 	w3 = cinfo.image_width * info->samples;
--
2.25.1

@dnk777
Copy link
Member

dnk777 commented Feb 28, 2020

Thanks for reporting that. Not sure if this works for you. Removal of this libfoo clutter in favor of using STB stuff is the proprer solution. That was planned but postponed as a "cosmetic" fix while there is plenty of more important stuff to do. I'm going to do that ASAP. Please note the current master is in a super-WIP state and GCC builds are not really performed (either Clang or, rarely, MSVC builds are). Nice that you've figured out specifying Qt prefix path.

@Ambrevar
Copy link
Author

Ambrevar commented Feb 29, 2020 via email

@dnk777
Copy link
Member

dnk777 commented Feb 29, 2020

I do not recommend doing that at this stage, sorry.

@Ambrevar
Copy link
Author

Ambrevar commented Feb 29, 2020 via email

@dnk777
Copy link
Member

dnk777 commented Feb 29, 2020

Building and packaging. Reasons are:

  1. The game and the engine is/was unfinished and in a super-WIP state
  2. There are some proprietary assets (licensed by Soundsnap.com for Warsow) in recent distributions ("2.5 beta"). Not sure if your policy permits packaging this stuff.

@Ambrevar
Copy link
Author

Ambrevar commented Feb 29, 2020 via email

@dnk777
Copy link
Member

dnk777 commented Feb 29, 2020

I wanted to hesitate providing the actual commit but you can pick this c4de15d
This corresponds to the "2.5 beta" version of the game (and its assets) that is downloadable from the website and is at least marginally playable offline. The current master is super-WIP and older versions of the game are completely dead.

@Ambrevar
Copy link
Author

Ambrevar commented Feb 29, 2020 via email

@Ambrevar
Copy link
Author

Ambrevar commented Apr 9, 2020

Sorry for the long time I took to get back to this :)

I've successfully built c4de15d however it fails to start with the "Failed to load UI dll" message.

Here is the output after the video information:

Video memory information:
not available
Cannot load file 'glsl/defaultKawaseBlur.vert.glsl'
Cannot load file 'glsl/defaultKawaseBlur.frag.glsl'
Failed to link object for program defaultKawaseBlur
error: vertex shader lacks `main'

Loaded libpng16.so.16
Initializing Shaders:
...loading 'scripts/36.shader'
...loading 'scripts/baxandall.shader'
...loading 'scripts/billboard.shader'
...loading 'scripts/blx.shader'
...loading 'scripts/blx_ca.shader'
...loading 'scripts/blx_grey.shader'
...loading 'scripts/blx_houses.shader'
...loading 'scripts/blx_tech2.shader'
...loading 'scripts/blx_wt3.shader'
...loading 'scripts/blx_wt3_vertex.shader'
...loading 'scripts/blxbis.shader'
...loading 'scripts/boqu.shader'
...loading 'scripts/bricks_vertex.shader'
...loading 'scripts/cha0swsw.shader'
...loading 'scripts/cleansurface.shader'
...loading 'scripts/cleansurface_vertex.shader'
...loading 'scripts/concrete.shader'
...loading 'scripts/courtyard.shader'
...loading 'scripts/decals.shader'
...loading 'scripts/deleo.shader'
...loading 'scripts/etrtex.shader'
...loading 'scripts/exwsw.shader'
...loading 'scripts/exwsw_vertex.shader'
...loading 'scripts/factory.shader'
...loading 'scripts/format.shader'
...loading 'scripts/glass.shader'
...loading 'scripts/grates.shader'
...loading 'scripts/grates_vertex.shader'
...loading 'scripts/hazelh.shader'
...loading 'scripts/hexagons.shader'
...loading 'scripts/hud.shader'
...loading 'scripts/jewels.shader'
...loading 'scripts/lights.shader'
...loading 'scripts/metal.shader'
...loading 'scripts/metal_vertex.shader'
...loading 'scripts/nate.shader'
...loading 'scripts/nature.shader'
...loading 'scripts/neon.shader'
...loading 'scripts/noir.shader'
...loading 'scripts/plastic.shader'
...loading 'scripts/plastic_vertex.shader'
...loading 'scripts/russus.shader'
...loading 'scripts/scifi_interior.shader'
...loading 'scripts/sky.shader'
...loading 'scripts/solidfake.shader'
...loading 'scripts/supersymmetry.shader'
...loading 'scripts/terrain.shader'
...loading 'scripts/tiles.shader'
...loading 'scripts/wdm11.shader'
...loading 'scripts/window.shader'
...loading 'scripts/wood.shader'
...loading 'scripts/wood_vertex.shader'
...loading 'scripts/wsw_cave1.shader'
...loading 'scripts/wsw_city1.shader'
...loading 'scripts/wsw_flareshalos.shader'
...loading 'scripts/zone_neutre.shader'
--------------------------------------
------- sound initialization -------
AL lib: (EE) ALCplaybackOSS_open: Could not open /dev/dsp: No such file or directory
AL lib: (WW) alcSetError: Error generated on device (nil), code 0xa004
Failed to open device
------------------------------------
Loaded font 'Droid Sans Bold' from 'DroidSans-Bold.ttf'
Loaded font 'Droid Sans Regular' from 'DroidSans.ttf'
Loaded font 'Droid Sans Mono Regular' from 'DroidSansMono.ttf'
Loaded font 'warsow Regular' from 'ldrwswbeta.ttf'
Loaded font 'Silhouette Medium' from 'Silhouette.ttf'
Loaded font 'Virtue Regular' from 'Virtue.ttf'
Loaded font 'Warsow Crosshairs Regular' from 'WarsowCrosshairs.ttf'
Loaded font 'Hemi Head Bold Italic' from 'hemihead-bd-it.otf'
Loaded font 'Droid Sans Fallback Regular' from 'DroidSansFallback.ttf'
Opening UDP/IP socket: *:0
Opening UDP/IPv6 socket: *:0
Loaded libogg.so.0
Loaded libvorbis.so.0
WARNING: shader gfx/ui/console has a stage with no image: gfx/ui/console
------- UI initialization -------
********************
ERROR: Failed to load UI dll
********************
SVStatsowFacade: Shutting down...

I am using the game data from 2.1.2.

@dnk777
Copy link
Member

dnk777 commented Apr 10, 2020

It is not supposed to work with 2.1 data. The bundle data currently available at https://warsow.net/download should be used instead. You should put the built UI shared library in the same directory the built executable is located in.

Please note that an important part of game binaries is bundled within the game data. I'm talking about modules... .pk3. A custom build of the game executable should still load these binaries fine (it extracts these libraries into a temporary directory and tries to perform a dynamic loading). This is a legacy of Quake distribution model (back then the Quake engine was the bee's knees and was proprietary and closed-source. Dynamically loaded game libraries built based on a SDK used to allow some modding capabilities). Nowadays there's no reason to follow that model but switching to static linking of the game code to the executable is not an easy task (a huge portion of the game state relies on being cleaned up naturally upon the library unloading). However, this is in our plans.

Note that modifying modules... pk3 content (as well as modifying any "pure" content) makes connection to "pure" servers fail.

@Ambrevar
Copy link
Author

Thanks, this explains a lot! :)

Regarding module...pkg3, how do I build it?

I'm surprised the download bundle works in Guix since this distrubition does not respect the FHS and does not have /lib/ld-linux-x86-64.so.2. Inspecting the module file, I see that the libraries have no dependency and don't even specify the interpreter (ld-linux-x86-64.so) which is lucky since then it works anywhere. Something to keep in mind! ;)

@Ambrevar
Copy link
Author

I'll try again against the 2.5 beta bundle.

@dnk777
Copy link
Member

dnk777 commented Apr 11, 2020

modules_25.pk3 contains packaged game libraries that are located in build/base or build/basewsw (in a subdirectory of a directory that contains the built executable). A *.pk3 file is just a ZIP archive.

@Ambrevar
Copy link
Author

Ambrevar commented Apr 11, 2020 via email

@dnk777
Copy link
Member

dnk777 commented Apr 11, 2020

No. And modifying pk3 contents is considered "cheating" (that's how the current system works). One can't just easily build a game library on their own.

@Ambrevar
Copy link
Author

Ambrevar commented Apr 11, 2020 via email

@dnk777
Copy link
Member

dnk777 commented Apr 11, 2020

It's unlikely to happen for various reasons that are complicated. However most of the assets can be considered already being in the source form inside *.pk3.

@Ambrevar
Copy link
Author

Ambrevar commented May 2, 2020 via email

@Ambrevar
Copy link
Author

Ambrevar commented May 2, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants