Opened 3 years ago

Closed 3 years ago

#63718 closed defect (fixed)

zvbi: build fails on 10.6_x32, perhaps related to implicit declaration of 'setjmp'

Reported by: mascguy (Christopher Nielsen) Owned by: mascguy (Christopher Nielsen)
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: setjmp Cc: mkuron (Michael Kuron), kencu (Ken)
Port: zvbi ffmpeg-devel

Description

New port zvbi is failing to build on 10.6_x32, due to setjmp-related errors. Looking more closely, it appears that it might be an implicit function declaration.

However, the "architecture not supported" error is also a bit troubling. Need to dig into this a bit more though:

In file included from exp-gfx.c:1638:
In file included from /opt/local/include/png.h:335:
In file included from /opt/local/include/pngconf.h:51:
In file included from /usr/include/setjmp.h:26:
/usr/include/machine/setjmp.h:41:2: error: architecture not supported
#error architecture not supported
 ^
In file included from exp-gfx.c:1638:
/opt/local/include/png.h:828:65: error: expected identifier
PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef);
                                                                ^
/opt/local/include/png.h:950:15: error: unknown type name 'jmp_buf'
PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structrp png_ptr,
              ^
exp-gfx.c:1687:6: warning: implicit declaration of function 'setjmp' is invalid in C99 [-Wimplicit-function-declaration]
        if (PNG_SETJMP(png_ptr))
            ^
exp-gfx.c:1647:27: note: expanded from macro 'PNG_SETJMP'
#  define PNG_SETJMP(ptr) setjmp(png_jmpbuf(ptr))
                          ^
exp-gfx.c:1687:6: warning: declaration of built-in function 'setjmp' requires the declaration of the 'jmp_buf' type, commonly provided in the header <setjmp.h>. [-Wincomplete-setjmp-declaration]
exp-gfx.c:1647:27: note: expanded from macro 'PNG_SETJMP'
#  define PNG_SETJMP(ptr) setjmp(png_jmpbuf(ptr))
                          ^
exp-gfx.c:1687:6: error: use of undeclared identifier 'jmp_buf'
exp-gfx.c:1647:34: note: expanded from macro 'PNG_SETJMP'
#  define PNG_SETJMP(ptr) setjmp(png_jmpbuf(ptr))
                                 ^
/opt/local/include/png.h:953:57: note: expanded from macro 'png_jmpbuf'
      (*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf))))
                                                        ^
exp-gfx.c:1687:6: error: use of undeclared identifier 'longjmp'
exp-gfx.c:1647:34: note: expanded from macro 'PNG_SETJMP'
#  define PNG_SETJMP(ptr) setjmp(png_jmpbuf(ptr))
                                 ^
/opt/local/include/png.h:953:39: note: expanded from macro 'png_jmpbuf'
      (*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf))))
                                      ^
5 warnings and 5 errors generated.

https://build.macports.org/builders/ports-10.6_i386-builder/builds/42155/steps/install-port/logs/stdio

Change History (5)

comment:1 Changed 3 years ago by mascguy (Christopher Nielsen)

Port: ffmpeg-devel added

Since ffmpeg-devel is now dependent on zvbi, we need to fix this before reconciling ffmpeg with the latest updates. Worst-case, we can exclude use of zvbi for x86_x32, and/or PPC, if necessary.

But before we do that, just want to confirm: Is setjmp not supported on those architectures? Ken/anyone...?

comment:2 Changed 3 years ago by mascguy (Christopher Nielsen)

Interestingly enough, this port builds just fine on PPC; tested on a PowerBook G4, running 10.5. Though in that case, the compiler used was GCC 4.2.

On our 10.6_x32 buildbot, as well as on my 32-bit MacBookPro running 10.6, Clang 9.0 is being used. Dunno if that makes any difference...?

comment:3 Changed 3 years ago by kencu (Ken)

The header is extremely simple and the function should be defined:

#ifndef	_MACHINE_SETJMP_H_
#define	_MACHINE_SETJMP_H_

#if defined (__ppc__) || defined (__ppc64__)
#include "ppc/setjmp.h"
#elif defined (__i386__) || defined(__x86_64__)
#include "i386/setjmp.h"
#elif defined (__arm__)
#include "arm/setjmp.h"
#else
#error architecture not supported
#endif

#endif	/* _MACHINE_SETJMP_H_ */

comment:4 Changed 3 years ago by mascguy (Christopher Nielsen)

@mkuron found the problem: The port is undefining __i386__ up-front, causing the "architecture not supported" error when that header is included.

He submitted a PR with the fix, and I'll be testing it on my MacBookPro shortly:

https://github.com/macports/macports-ports/pull/12724

comment:5 Changed 3 years ago by Michael Kuron <m.kuron@…>

Resolution: fixed
Status: assignedclosed

In 992746351ec0e00b169c3e6a7998ab6fd6e58c7e/macports-ports (master):

zvbi: fix build on 10.6-i386

Closes: #63718

Note: See TracTickets for help on using tickets.