Export to GitHub

openjpeg - issue #72

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


Posted on Jun 15, 2011 by Grumpy Rhino

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.otest -f '../common/getopt.c' || echo '/root/s10-userland/components/openjpeg/openjpeg_v1_4_sources_r697/codec/'../common/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

Comment #1

Posted on Jun 16, 2011 by Quick Monkey
  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

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

include

include

  1. 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

Comment #2

Posted on Jun 18, 2011 by Quick Monkey

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

Comment #3

Posted on Jun 21, 2011 by Grumpy Rhino

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

Comment #4

Posted on Jun 21, 2011 by Grumpy Rhino

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

Comment #5

Posted on Jul 23, 2011 by Helpful Monkey

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

Comment #6

Posted on Sep 1, 2011 by Happy Rabbit

this issue has been entirely fixed since r907.

Status: Fixed

Labels:
Type-Defect Priority-Medium