Irrlicht Engine Forum Index Irrlicht Engine
Official forum of the Irrlicht Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

#undef _IRR_USE_NON_SYSTEM_JPEG_LIB_ causes #include clash

 
Post new topic   Reply to topic    Irrlicht Engine Forum Index -> Bug reports
View previous topic :: View next topic  
Author Message
kbluck



Joined: 24 Aug 2006
Posts: 10

PostPosted: Thu Sep 14, 2006 4:11 pm    Post subject: #undef _IRR_USE_NON_SYSTEM_JPEG_LIB_ causes #include clash Reply with quote

Undefining symbol _IRR_USE_NON_SYSTEM_JPEG_LIB_ should cause Irrlicht to use a system-built JPEG lib. However, Irrlicht will still attempt to include its own version of jconfig.h in this case.

Since by definition a system library has already been built outside of the Irrlicht build process, including a custom jconfig.h is at best ineffectual and at worst will introduce obscure bugs as Irrlicht and the prebuilt libjpeg may have different assumptions about the JPEG object code.

Even when _IRR_USE_NON_SYSTEM_JPEG_LIB_ is #defined, if jconfig.h is found in the same folder as jpeglib.h as it is in Irrlicht, there should not be any need to explicitly #include jconfig.h anyway, nor to explicitly #define JCONFIG_INCLUDED. If using a system lib, then its the programmer's problem to make sure their system libjpeg is set up properly for build.

Therefore, I suggest removing altogether the lines referencing jconfig.h and JCONFIG_INCLUDED from lines 15-16 of file source/CImageLoaderJPG.h and line 13 of file source/CImageWriterJPG.cpp

--- Kevin
Back to top
View user's profile Send private message
hybrid
Admin


Joined: 19 Apr 2006
Posts: 9643
Location: Oldenburg(Oldb), Germany

PostPosted: Thu Sep 14, 2006 8:10 pm    Post subject: Reply with quote

Yes, sounds reasonable.
Back to top
View user's profile Send private message Visit poster's website
sax



Joined: 22 Sep 2006
Posts: 2

PostPosted: Fri Sep 22, 2006 12:43 am    Post subject: Reply with quote

After fighting a little today with the gentoo build for Irrlicht. It would not load the jpeg textures. It gave me:
JPEG FATAL ERROR: JPEG parameter struct mismatch: library thinks size is 464, caller expects 428

I applied the changes mentioned by Kevin (kbluck.)

There is however one thing missing:
In the Makefile it is needed to change
CXXINCS = -I../../include -Izlib -Ijpeglib -Ilibpng
to not have the -Ijpeglib

The gentoo ebuild was set up to use the system libs for zlib and libpng also, so I changed the line to:
CXXINCS = -I../../include

After this I could run the demo (also this needed a modified makefile to link with the libs: -lz -ljpeg -lpng and some path changes because of the places gentoo install things)

I will also fill in a bug report with the patch at gentoo.org.

I have not considered a nice way to differentiate in the Makefile between the use of system or irrlitch provided libs.

I have not checked the build files for other systems, but I guess they must have similiar problems.

-Sax
Back to top
View user's profile Send private message
hybrid
Admin


Joined: 19 Apr 2006
Posts: 9643
Location: Oldenburg(Oldb), Germany

PostPosted: Fri Sep 22, 2006 7:20 am    Post subject: Reply with quote

This would require some configure script to set up the Makefiles, you cannot decide this based on other information inside the Makefile easily. So the Irrlicht Makefiles will stay unchanged, I'll add this hint in the Readme, though.
Back to top
View user's profile Send private message Visit poster's website
sax



Joined: 22 Sep 2006
Posts: 2

PostPosted: Tue Oct 03, 2006 12:34 am    Post subject: Reply with quote

Checked up on the source.
You could actually make the change I did to the Makefile without problems for other builds as far as I can see.

That is replace:
CXXINCS = -I../../include -Izlib -Ijpeglib -Ilibpng
with:
CXXINCS = -I../../include

It can be done because all includes use either <xxx.h> or "ddd/xxx.h"

I checked all source files with the following command:
for d in `ls -F | grep '/'`; do for i in `ls ${d}*.h`; do grep -n "${i#${d}}" * | grep -v "${d}" | grep -v "${d%/}"'\\'; done; done

Pseudo code:
for each dir 'd'
for each header 'i' in 'd'
find 'i' in all files (in current dir) with the dir part striped of
do not show lines with the dir prefixed (both / and \ )

All the places uses the #ifndef _IRR_USE_NON_SYSTEM_LIB_XXX_ construction and <xxx.h>
The only exceptions is not related to the linux Makefile. It is the 'Irrlicht.opt' which is a M$ Windows file for some IDE I guess and some OSX stuff:
COpenGLDriver.h:36: #include "CIrrDeviceMacOSX.h"
COSOperator.cpp:15:#include "OSXClipboard.h"

The linking of the demo/examples is ofcourse another problem but is not as important so a note in the Readme is fine I think.

Thanks for a nice library,
-Sax
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Irrlicht Engine Forum Index -> Bug reports All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
SourceForge.net Logo


Powered by phpBB © 2001, 2005 phpBB Group