| View previous topic :: View next topic |
| Author |
Message |
kbluck
Joined: 24 Aug 2006 Posts: 10
|
Posted: Thu Sep 14, 2006 4:11 pm Post subject: #undef _IRR_USE_NON_SYSTEM_JPEG_LIB_ causes #include clash |
|
|
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 |
|
 |
hybrid Admin
Joined: 19 Apr 2006 Posts: 9643 Location: Oldenburg(Oldb), Germany
|
Posted: Thu Sep 14, 2006 8:10 pm Post subject: |
|
|
| Yes, sounds reasonable. |
|
| Back to top |
|
 |
sax
Joined: 22 Sep 2006 Posts: 2
|
Posted: Fri Sep 22, 2006 12:43 am Post subject: |
|
|
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 |
|
 |
hybrid Admin
Joined: 19 Apr 2006 Posts: 9643 Location: Oldenburg(Oldb), Germany
|
Posted: Fri Sep 22, 2006 7:20 am Post subject: |
|
|
| 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 |
|
 |
sax
Joined: 22 Sep 2006 Posts: 2
|
Posted: Tue Oct 03, 2006 12:34 am Post subject: |
|
|
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 |
|
 |
|