Bah.mod Freeimage.mod

Started by _PJ_, September 22, 2024, 18:25:51

Previous topic - Next topic

_PJ_

I have been trying to build and use this mod, but it fails to build::

The only other 3rd party mod are: "bah.registry" and "bah.speech"

Here's the end snippet of the output log showing where it breaks:

Quote[ 26%] Compiling:PluginG3.cpp
C:/Program Files/BlitzMax/MinGW32x64/bin/gcc.exe -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod" -I"C:/Program Files/BlitzMax/mod" -I"C:/Program Files/BlitzMax/mod/brl.mod/pixmap.mod" -I"C:/Program Files/BlitzMax/mod/brl.mod/max2d.mod" -I"C:/Program Files/BlitzMax/mod/brl.mod/endianstream.mod" -I"C:/Program Files/BlitzMax/mod/brl.mod/standardio.mod" -I"C:/Program Files/BlitzMax/mod/brl.mod/blitz.mod" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/FreeImage" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/FreeImageToolkit" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/LibJPEG" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/LibTIFF4" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/Metadata" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/LibRawLite" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/LibRawLite/dcraw" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/LibRawLite/internal" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/LibRawLite/libraw" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/LibRawLite/src" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/ZLib"  -fexceptions -DPNG_iTXt_SUPPORTED -DPNG_PREFIX -DHAVE_PROTOTYPES -DFREEIMAGE_LIB -DOPJ_STATIC -DUSE_JPIP -DZ_PREFIX -DFREEIMAGE_JPEG_EXTERNAL_NAMES -DLIBRAW_NODLL -DLIBRAW_LIBRARY_BUILD -D__ANSI__ -D_GLIBCXX_USE_C99_DYNAMIC -DTHREADED  -w -DBMX_NG -m64 -ffast-math  -c -O3 -msse3 -s  -g -o "C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/FreeImage/.bmx/fsF_PluginG3.cpp.debug.win32.x64.o" "C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/FreeImage/PluginG3.cpp"
Build Error: failed to compile (1) C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/freeimageglue.cpp

I only use (and only intend to use) WIN32 platform, x64 architecture - so try to build with these options - might that be the reason for the failure?

If it turns out this mod is incompatible with x64 -  then at least I know, otherwise,. is there anything that can be done?

William

#1
i know how aggravating and disappointing that can be, i've had my fare share of luck. if only i had the skill to actually get modules i want working since most of the work had been done already.

now maxgui and openb3d isnt compatible with what linux is now using wayland and people are dissing linux as a viable and better alternative than windows that some people actually use as a better platform.

i use and like both but i'm a hardcore linux fanboy when it comes to development and performance and efficiency and open source and systems.

i dont understand the compiler errors, is that in verbose mode? i recommend turning it off and sharing the actual compile error output.
im still interested in game app development even if its oldschool. i have ideas i want to try myself in this project if i can ever accomplish it.

William

also, isnt freeimage a mod included outside of the unsupported bah modules, a separate and updated repository? i'm thinking of image.mod. @_PJ_
im still interested in game app development even if its oldschool. i have ideas i want to try myself in this project if i can ever accomplish it.

_PJ_

Thanks for the reply, William.

Yeah, the debuglog was in Verbose mode - Here's the "normal" version  ::

Building Modules
[  0%] Processing:source_jxr.bmx
[  0%] Processing:source_openexr.bmx
[  0%] Processing:source_openjpeg.bmx
[  0%] Processing:source_webp.bmx
[  3%] Processing:source.bmx
[  5%] Processing:common.bmx
[ 13%] Processing:freeimage.bmx
[ 25%] Compiling:freeimageglue.cpp
[ 25%] Compiling:BitmapAccess.cpp
[ 25%] Compiling:CacheFile.cpp
[ 25%] Compiling:ColorLookup.cpp
[ 25%] Compiling:Conversion.cpp
[ 25%] Compiling:Conversion16_555.cpp
[ 25%] Compiling:Conversion16_565.cpp
[ 25%] Compiling:Conversion24.cpp
[ 25%] Compiling:Conversion32.cpp
[ 25%] Compiling:Conversion4.cpp
[ 25%] Compiling:Conversion8.cpp
[ 25%] Compiling:ConversionFloat.cpp
[ 25%] Compiling:ConversionRGB16.cpp
[ 25%] Compiling:ConversionRGBA16.cpp
[ 25%] Compiling:ConversionRGBAF.cpp
[ 25%] Compiling:ConversionRGBF.cpp
[ 25%] Compiling:ConversionType.cpp
[ 25%] Compiling:ConversionUINT16.cpp
[ 25%] Compiling:FreeImage.cpp
[ 25%] Compiling:FreeImageC.c
[ 25%] Compiling:FreeImageIO.cpp
[ 25%] Compiling:GetType.cpp
[ 25%] Compiling:Halftoning.cpp
[ 25%] Compiling:J2KHelper.cpp
[ 25%] Compiling:LFPQuantizer.cpp
[ 25%] Compiling:MNGHelper.cpp
[ 25%] Compiling:MemoryIO.cpp
[ 25%] Compiling:MultiPage.cpp
[ 25%] Compiling:NNQuantizer.cpp
[ 26%] Compiling:PSDParser.cpp
[ 26%] Compiling:PixelAccess.cpp
[ 26%] Compiling:Plugin.cpp
[ 26%] Compiling:PluginBMP.cpp
[ 26%] Compiling:PluginCUT.cpp
[ 26%] Compiling:PluginDDS.cpp
[ 26%] Compiling:PluginEXR.cpp
[ 26%] Compiling:PluginG3.cpp
[ 26%] Compiling:PluginGIF.cpp
Build Error: failed to compile (1) C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/freeimageglue.cpp
Process complete

William

#4
its not outputting the actual error but i'm of no help anyway. sometimes i can hack/fix one but then another error and then it may break things anyway.

i can try freeimage on my end. i might get to get if i have spare time. best wishes :) edit: btw i only know basic programming.
im still interested in game app development even if its oldschool. i have ideas i want to try myself in this project if i can ever accomplish it.

William

okay definitely outside my skillset i tried compiling it. but i checked and image.mod is the equivalent do you need to save image files or something, why freeimage instead of image.mod. i don't know whether image.mod allows saving image files to the different formats.
im still interested in game app development even if its oldschool. i have ideas i want to try myself in this project if i can ever accomplish it.

_PJ_

I was needing something to both load and save DDS format - even if I write an exporter (based on the info here: https://nwn.wiki/display/NWN1/DDS )
I still need to be able to check they can load in again.

As this is for a tool for use by others in  a community, I have no control over the source files loaded in, - but at least I only have to worry about writing DTX1,3, or 5 versions
 

_PJ_

Well, it's been some time and I've not made much progress - 
I did notice the most recent changes to Freeimage.mod on GIThub seemed to be changes to a variable name representing the "bits per pixel" which was earlier named "bpp" but in a numebr of cases was changed to "dst_bpp"
HOWEVER 
in PluginBMP.cpp at least, lines 1421 - 1422

#ifdef FREEIMAGE_BIGENDIAN
 } else if (bpp == 16) {

The reference is to "bpp" - so maybe this needs to be changed to "dst_bpp"?


___________________
Though, this doesn't seem to directly relate to the issue I have with building the mod, which appears to be more assocaited with "PluginGIF.cpp" - but thought I should mention it, maybe can help with other issues...?

----
My investigation continues . . .


_PJ_

I have now got some better debug output from the compiler::

Quote[ 26%] Compiling:PluginGIF.cpp
C:/Program Files/BlitzMax/MinGW32x64/bin/gcc.exe -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod" -I"C:/Program Files/BlitzMax/mod" -I"C:/Program Files/BlitzMax/mod/brl.mod/pixmap.mod" -I"C:/Program Files/BlitzMax/mod/brl.mod/max2d.mod" -I"C:/Program Files/BlitzMax/mod/brl.mod/endianstream.mod" -I"C:/Program Files/BlitzMax/mod/brl.mod/standardio.mod" -I"C:/Program Files/BlitzMax/mod/brl.mod/blitz.mod" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/FreeImage" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/FreeImageToolkit" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/LibJPEG" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/LibTIFF4" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/Metadata" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/LibRawLite" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/LibRawLite/dcraw" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/LibRawLite/internal" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/LibRawLite/libraw" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/LibRawLite/src" -I"C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/ZLib"  -fexceptions -DPNG_iTXt_SUPPORTED -DPNG_PREFIX -DHAVE_PROTOTYPES -DFREEIMAGE_LIB -DOPJ_STATIC -DUSE_JPIP -DZ_PREFIX -DFREEIMAGE_JPEG_EXTERNAL_NAMES -DLIBRAW_NODLL -DLIBRAW_LIBRARY_BUILD -D__ANSI__ -D_GLIBCXX_USE_C99_DYNAMIC -DTHREADED  -w -DBMX_NG -m64 -ffast-math  -c -O3 -msse3 -s  -g -o "C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/FreeImage/.bmx/fsF_PluginGIF.cpp.debug.win32.x64.o" "C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/FreeImage/PluginGIF.cpp"
C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/freeimageglue.cpp: In function 'MaxFreeImageTag* bmx_freeimage_GetMetadata(MaxFreeImage*, int, BBString*)':
C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/freeimageglue.cpp:1089:37: error: invalid conversion from 'unsigned char*' to 'char*' [-fpermissive]
 1089 |         char * t = bbStringToCString(tag);
      |                    ~~~~~~~~~~~~~~~~~^~~~~
      |                                     |
      |                                     unsigned char*
C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/freeimageglue.cpp: In function 'int bmx_freeimage_SetMetadata(MaxFreeImage*, int, BBString*, MaxFreeImageTag*)':
C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/freeimageglue.cpp:1110:38: error: invalid conversion from 'unsigned char*' to 'char*' [-fpermissive]
 1110 |                 k = bbStringToCString(key);
      |                     ~~~~~~~~~~~~~~~~~^~~~~
      |                                      |
      |                                      unsigned char*
C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/freeimageglue.cpp: In function 'MaxMultiFreeImage* bmx_multifreeimage_new(void*, BBString*, int, int)':
C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/freeimageglue.cpp:1296:36: error: invalid conversion from 'unsigned char*' to 'char*' [-fpermissive]
 1296 |         char *p = bbStringToCString( filename );
      |                   ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
      |                                    |
      |                                    unsigned char*
C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/freeimageglue.cpp: In function 'int bmx_freeimagetag_setkey(MaxFreeImageTag*, BBString*)':
C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/freeimageglue.cpp:1389:37: error: invalid conversion from 'unsigned char*' to 'char*' [-fpermissive]
 1389 |         char * k = bbStringToCString(key);
      |                    ~~~~~~~~~~~~~~~~~^~~~~
      |                                     |
      |                                     unsigned char*
C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/freeimageglue.cpp: In function 'int bmx_freeimagetag_setdescription(MaxFreeImageTag*, BBString*)':
C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/freeimageglue.cpp:1396:37: error: invalid conversion from 'unsigned char*' to 'char*' [-fpermissive]
 1396 |         char * d = bbStringToCString(description);
      |                    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
      |                                     |
      |                                     unsigned char*
Build Error: failed to compile (1) C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/freeimageglue.cpp
Process complete

It also pops up a notification stating:

QuoteCompile Error

error: invalid conversion from 'unsigned char*' to 'char*'
[-fpermissive]

So it seems like, for a few instances, there is some casting difference between the function / their return values and the expected type...?


Midimaster

I think the module is out-of-date. 

You should contact Derron here. He knows all troubles, that happen between old modules and current BlitzMax.

You can also find him on BlitzMax's DISCORD channel. There his name is GWRon

Here is an invitation for the channel: https://discord.gg/8K2YkHJq
...On the way to Norway to watch Polar Lights

_PJ_

Quote from: Midimaster on October 12, 2024, 18:49:08I think the module is out-of-date.

You should contact Derron here. He knows all troubles, that happen between old modules and current BlitzMax.

You can also find him on BlitzMax's DISCORD channel. There his name is GWRon

Here is an invitation for the channel: https://discord.gg/8K2YkHJq
Thanks so much, midimister.
I made sure to download the latest version of the mod from github, but the only date I have is the date for the repo as a whole which is April 2024

--

I will hop onto Discord at some point and see if I can contact Ron - he's always been excellent on these forums.

Derron

https://github.com/maxmods/bah.mod/issues/104

someone raised an issue for this already this August.

bye
Ron

Henri

Hi,

automatic conversion from 'unsigned char*' to 'char *' is not allowed by default in modern c++ compilers due to potential errors it might produce. -fpermissive flag will suppress this error message when used, but is only a temporary fix.

You could explicitly cast all offending lines in freeimageglue.cpp to 'char*' by searching every instance of 'bbStringToCString' and replacing it with '(char *)bbStringToCString'.

-Henri
- Got 01100011 problems, but the bit ain't 00000001

Derron

@Henri 
the notification about dynamic exceptions "error: ISO C++17 does not allow dynamic exception specifications" is the issue I guess, the char-cast had to be done in other modules already so people might be able to solve that on their own. The error about the exception sounds as if the freeimage library needs some update (and then the wrapper surely needs adjustments too).


bye
Ron

Henri

Hi Ron,

I didn't encounter dynamic exception error, only char * cast when I tried it. My compiler is probably not the most recent where these are deprecated according to ISO C++17.

The issue seems to be limited only to OpenEXR library inside Freeimage, so updating that to most recent would certainly fix the issue, but I understand that this is beyond your average user.

What you can try other that updating (from hardest to easiest):

1. Fix the offending code to be compliant https://en.cppreference.com/w/cpp/language/except_spec
2. Comment out the Throws or something to that effect.
3. Rename OpenEXR folder and comment out any includes to it. Most users don't need the EXR file format

-Henri
- Got 01100011 problems, but the bit ain't 00000001