Opened 4 years ago

Closed 4 years ago

#61091 closed defect (fixed)

imlib2 @1.7.0 does not build on PPC Leopard, Mac OS X 10.5.8, because of "error: ‘l’ undeclared (first use in this function)"

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.6.3
Keywords: powerpc haspatch Cc:
Port: imlib2

Description

make[4]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_graphics_imlib2/imlib2/work/imlib2-1.7.0/src/modules/loaders'
  CC       argb_la-loader_argb.lo
loader_argb.c: In function ‘load2’:
loader_argb.c:55: error: ‘l’ undeclared (first use in this function)
loader_argb.c:55: error: (Each undeclared identifier is reported only once
loader_argb.c:55: error: for each function it appears in.)
make[4]: *** [argb_la-loader_argb.lo] Error 1
make[4]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_graphics_imlib2/imlib2/work/imlib2-1.7.0/src/modules/loaders'

The error happens here:

   54	#ifdef WORDS_BIGENDIAN
   55	        for (l = 0; l < im->w; l++)
   56	           SWAP_LE_32_INPLACE(ptr[l]);
   57	#endif

Obviously the programmers did not have a big endian hardware to test their software and so forgot to declare probably more than one variable…

I'll try to patch this and possibly other files in this port!

Attachments (2)

main.log (33.4 KB) - added by ballapete (Peter "Pete" Dyballa) 4 years ago.
Main.log from PPC Leopard
imlib2-fix-big_endian.diff (326 bytes) - added by ballapete (Peter "Pete" Dyballa) 4 years ago.
Patch to declare l on big-endian hardware

Download all attachments as: .zip

Change History (8)

Changed 4 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

Main.log from PPC Leopard

comment:1 Changed 4 years ago by ballapete (Peter "Pete" Dyballa)

It seems there is only spot that need to be fixed with a patch… (attached)

Changed 4 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: imlib2-fix-big_endian.diff added

Patch to declare l on big-endian hardware

comment:2 Changed 4 years ago by kencu (Ken)

Pete, can you check if this is just a gcc-4.2 thing, by trying to compile the unpatched port with gcc6 or gcc7?

I have a feeling this might be a range-based loop variable thing from c++11.

comment:3 in reply to:  2 Changed 4 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

Pete, can you check if this is just a gcc-4.2 thing, by trying to compile the unpatched port with gcc6 or gcc7?

Withe GCC7:

make[4]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_graphics_imlib2/imlib2/work/imlib2-1.7.0/src/modules/loaders'
  CC       argb_la-loader_argb.lo
loader_argb.c: In function 'load2':
loader_argb.c:55:14: error: 'l' undeclared (first use in this function)
         for (l = 0; l < im->w; l++)
              ^
loader_argb.c:55:14: note: each undeclared identifier is reported only once for each function it appears in
make[4]: *** [argb_la-loader_argb.lo] Error 1
make[4]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_graphics_imlib2/imlib2/work/imlib2-1.7.0/src/modules/loaders'

I produced a pre-processed output file (-dD -E). It showed clearly that l has no type. There is another loop with x which is initialised inside the big-endian code as int x;. To me it's clearly overseen that l needs a type the same way as x gets it. Outside the PPC world this error simply does not happen.

comment:4 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: powerpc haspatch added; leopard removed
Owner: set to ryandesign
Status: newaccepted

Here is the corresponding upstream commit, so I think we'll go with that:

https://git.enlightenment.org/legacy/imlib2.git/commit/?id=92d3153fee9f915cf2bdbc92a7551e5a83985e81

comment:5 Changed 4 years ago by kencu (Ken)

Looks like you pegged it, Pete! Thanks!

comment:6 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: acceptedclosed

In 59e975bb5c6041ad93c4fb5ce33c28db1b620176/macports-ports (master):

imlib2: Fix build on PowerPC

Closes: #61091

Note: See TracTickets for help on using tickets.