noobdoesre / openjpeg

Automatically exported from code.google.com/p/openjpeg
Other
0 stars 0 forks source link

Unable to compile openjpeg on Solaris 10 due to #pragma directives in convert.c #72

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Build openjpeg on Solaris 10 with gcc 4.4.5

What is the expected output? What do you see instead?

Expected output is a successful compilation. Instead we get:

Making all in codec
gmake[3]: Entering directory 
`/root/s10-userland/components/openjpeg/build/i86/codec'
/ec/bin/gcc -DHAVE_CONFIG_H -I. 
-I/root/s10-userland/components/openjpeg/openjpeg_v1_4_sources_r697/codec -I.. 
-I.. -I. -I../libopenjpeg -I../common  -I/ec/include/libpng15      -Wall 
-DOPJ_EXPORTS  -I.. -I. -I../libopenjpeg -I../common  -I/ec/include/libpng15   
-MT getopt.o -MD -MP -MF .deps/getopt.Tpo -c -o getopt.o `test -f 
'../common/getopt.c' || echo 
'/root/s10-userland/components/openjpeg/openjpeg_v1_4_sources_r697/codec/'`../co
mmon/getopt.c
mv -f .deps/getopt.Tpo .deps/getopt.Po
/ec/bin/gcc -DHAVE_CONFIG_H -I. 
-I/root/s10-userland/components/openjpeg/openjpeg_v1_4_sources_r697/codec -I.. 
-I.. -I. -I../libopenjpeg -I../common  -I/ec/include/libpng15      -Wall 
-DOPJ_EXPORTS  -I.. -I. -I../libopenjpeg -I../common  -I/ec/include/libpng15   
-MT index.o -MD -MP -MF .deps/index.Tpo -c -o index.o 
/root/s10-userland/components/openjpeg/openjpeg_v1_4_sources_r697/codec/index.c
mv -f .deps/index.Tpo .deps/index.Po
/ec/bin/gcc -DHAVE_CONFIG_H -I. 
-I/root/s10-userland/components/openjpeg/openjpeg_v1_4_sources_r697/codec -I.. 
-I.. -I. -I../libopenjpeg -I../common  -I/ec/include/libpng15      -Wall 
-DOPJ_EXPORTS  -I.. -I. -I../libopenjpeg -I../common  -I/ec/include/libpng15   
-MT convert.o -MD -MP -MF .deps/convert.Tpo -c -o convert.o 
/root/s10-userland/components/openjpeg/openjpeg_v1_4_sources_r697/codec/convert.
c
/root/s10-userland/components/openjpeg/openjpeg_v1_4_sources_r697/codec/convert.
c:96: warning: #pragma pack(push[, id], <n>) is not supported on this target
/root/s10-userland/components/openjpeg/openjpeg_v1_4_sources_r697/codec/convert.
c:118: warning: #pragma pack(pop[, id], <n>) is not supported on this target
/root/s10-userland/components/openjpeg/openjpeg_v1_4_sources_r697/codec/convert.
c: In function 'imagetopng':
/root/s10-userland/components/openjpeg/openjpeg_v1_4_sources_r697/codec/convert.
c:2435: error: 'Z_BEST_COMPRESSION' undeclared (first use in this function)
/root/s10-userland/components/openjpeg/openjpeg_v1_4_sources_r697/codec/convert.
c:2435: error: (Each undeclared identifier is reported only once
/root/s10-userland/components/openjpeg/openjpeg_v1_4_sources_r697/codec/convert.
c:2435: error: for each function it appears in.)
gmake[3]: *** [convert.o] Error 1
gmake[3]: Leaving directory 
`/root/s10-userland/components/openjpeg/build/i86/codec'
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Leaving directory `/root/s10-userland/components/openjpeg/build/i86'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/root/s10-userland/components/openjpeg/build/i86'
make: *** [/root/s10-userland/components/openjpeg/build/i86/.built] Error 2

What version of the product are you using? On what operating system?

openjpeg_v1_4_sources_r697 on Solaris 10 update 8 (s10x_u8wos_08a).

Cheers,

Alasdair

Original issue reported on code.google.com by alasd...@apps.everycity.co.uk on 15 Jun 2011 at 9:16

GoogleCodeExporter commented 9 years ago
1. Please make the following change and report whether the change works:

#if defined(sun)
#pragma pack(1)
#else
#pragma pack(push, 1)
#endif

//TGA structure

#if defined(sun)
#pragma pack()
#else
#pragma pack(pop)
#endif

2. You use a 'new' libpng library version. The 'new' png.h
   does no longer '#include <zlib.h>'. Please enter in
   convert.c :

#include <png.h>
#include <zlib.h>

3. If you have 'svn' installed: please try to download the newest
   OpenJPEG-1.4.0 revision with:

svn checkout http://openjpeg.googlecode.com/svn/trunk openjpeg

The newest revision 787 has many bugs fixed.
The PRAGMA change you must add even in revision 787.
The ZLIB change is contained in revision 787.
If you use 'configure': you must call 'bootstrap.sh' to get
a working 'configure'.

winfried

Original comment by szukw...@arcor.de on 16 Jun 2011 at 4:34

GoogleCodeExporter commented 9 years ago
As Alasdair - unfortunately - is a tourist, I have looked up some files.

The GCC testsuite files use '__sun__', whereas the file
 http://developers.sun.com/sunstudio/documentation/ss12u1/mr/READMEs/c++_faq.html
uses '__sun'.

The simplest solutution seems to be:

#if defined(__sun) || defined(__sun__)
#pragma pack(1)
#else
#pragma pack(push, 1)
#endif

//TGA structure

#if defined(__sun) || defined(__sun__)
#pragma pack()
#else
#pragma pack(pop)
#endif

winfried

Original comment by szukw...@arcor.de on 18 Jun 2011 at 11:18

GoogleCodeExporter commented 9 years ago
Hi,

Thank you very much for looking into this, it's very much appreciated!

I will give the above suggestions a go and get back to you shortly.

Cheers,

Alasdair

Original comment by alasd...@apps.everycity.co.uk on 21 Jun 2011 at 9:39

GoogleCodeExporter commented 9 years ago
Hi,

The above changes have fixed the app and it now builds. I had to make some 
other modifications too, which can be found here:

http://pastie.org/pastes/2101568/text?key=dxwcwnrncgtvkaxttida

Thanks for your help with this! :-)

Cheers,

Alasdair

Original comment by alasd...@apps.everycity.co.uk on 21 Jun 2011 at 2:21

GoogleCodeExporter commented 9 years ago
the #define must not be done on the architecture, but the compiler. In 
addition, these pragma directives might not run on some compilers. Here is an 
example of what I used (must be modified for this issue) :

#if defined (_MSC_VER) || (defined (__SUNPRO_C) && __SUNPRO_C < 0x5100)
# pragma pack(1)
# define EMBRYO_STRUCT_PACKED
#elif defined (__GNUC__) || (defined (__SUNPRO_C) && __SUNPRO_C >= 0x5100)
# define EMBRYO_STRUCT_PACKED __attribute__((packed))
#else
# define EMBRYO_STRUCT_PACKED
#endif

Vincent

Original comment by vincent....@gmail.com on 23 Jul 2011 at 8:57

GoogleCodeExporter commented 9 years ago
this issue has been entirely fixed since r907.

Original comment by antonin on 1 Sep 2011 at 1:10