Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 830231

Summary: dev-libs/libzip: revdeps fail to compile with differing CC (was: dev-util/rizin-0.3.1-r2 fails to compile: zip.h:285:21: error: expected ‘:, ‘,, ‘;, ‘} or ‘__attribute__ before ‘str)
Product: Gentoo Linux Reporter: Agostino Sarubbo <ago>
Component: Current packagesAssignee: Gentoo KDE team <kde>
Status: CONFIRMED ---    
Severity: normal CC: ajak, ionen, sam, srcshelton, telans, waebbl-gentoo
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/nih-at/libzip/issues/253
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 408963    
Attachments: build.log

Description Agostino Sarubbo gentoo-dev 2021-12-29 13:50:11 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: dev-util/rizin-0.3.1-r2 fails to compile.
Discovered on: amd64 (internal ref: tinderbox)

NOTE:
This machine uses clang as a compiler and lld as a linker
Comment 1 Agostino Sarubbo gentoo-dev 2021-12-29 13:50:14 UTC
Created attachment 760751 [details]
build.log

build log and emerge --info
Comment 2 Agostino Sarubbo gentoo-dev 2021-12-29 13:50:15 UTC
Error(s) that match a know pattern in addition to what has been reported in the summary:


Library util found: NO
Program node found: NO
Program tree-sitter found: NO
Run-time dependency xxhash found: NO (tried pkgconfig and cmake)
/usr/include/zip.h:285:21: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘str’
Comment 3 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2021-12-30 14:30:04 UTC
The actual errors:

../rizin-v0.3.1/librz/io/p/io_zip.c:145:48: error: ‘struct zip_stat’ has no member named ‘size’
  145 |                         ut8 *buf = calloc(1, sb.size);
      |                                                ^
../rizin-v0.3.1/librz/io/p/io_zip.c:147:57: error: ‘struct zip_stat’ has no member named ‘size’
  147 |                                 zip_fread(zFile, buf, sb.size);
      |                                                         ^
../rizin-v0.3.1/librz/io/p/io_zip.c:148:65: error: ‘struct zip_stat’ has no member named ‘size’
  148 |                                 rz_buf_set_bytes(zfo->b, buf, sb.size);
      |                                                                 ^
../rizin-v0.3.1/librz/io/p/io_zip.c: In function ‘rz_io_zip_get_files’:
../rizin-v0.3.1/librz/io/p/io_zip.c:180:38: error: ‘struct zip_stat’ has no member named ‘name’
  180 |                 if ((name = strdup(sb.name))) {
      |                                      ^
../rizin-v0.3.1/librz/io/p/io_zip.c: In function ‘rz_io_zip_flush_file’:
../rizin-v0.3.1/librz/io/p/io_zip.c:204:32: warning: implicit declaration of function ‘zip_source_buffer’; did you mean ‘zip_source_free’? [-Wimplicit-function-declaration]
  204 |         struct zip_source *s = zip_source_buffer(zipArch, tmp, tmpsz, 0);
      |                                ^~~~~~~~~~~~~~~~~
      |                                zip_source_free
../rizin-v0.3.1/librz/io/p/io_zip.c:204:32: warning: initialization of ‘struct zip_source *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
../rizin-v0.3.1/librz/io/p/io_zip.c: In function ‘rz_io_zip_create_new_file’:
../rizin-v0.3.1/librz/io/p/io_zip.c:241:43: error: ‘struct zip_stat’ has no member named ‘name’
  241 |                 zfo->name = strdup(sb ? sb->name : filename);
      |                                           ^~
../rizin-v0.3.1/librz/io/p/io_zip.c:242:43: error: ‘struct zip_stat’ has no member named ‘index’
  242 |                 zfo->entry = !sb ? -1 : sb->index;
      |                                           ^~
../rizin-v0.3.1/librz/io/p/io_zip.c: In function ‘rz_io_zip_alloc_zipfileobj’:
../rizin-v0.3.1/librz/io/p/io_zip.c:265:23: error: ‘struct zip_stat’ has no member named ‘name’
  265 |                 if (sb.name != NULL) {
      |                       ^
../rizin-v0.3.1/librz/io/p/io_zip.c:266:38: error: ‘struct zip_stat’ has no member named ‘name’
  266 |                         if (strcmp(sb.name, filename) == 0) {
      |                                      ^
../rizin-v0.3.1/librz/io/p/io_zip.c: In function ‘rz_io_zip_get_by_file_idx’:
../rizin-v0.3.1/librz/io/p/io_zip.c:368:45: error: ‘struct zip_stat’ has no member named ‘name’
  368 |                         filename = strdup(sb.name);
      |                                             ^
Comment 4 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2021-12-30 14:41:03 UTC
(In reply to John Helmert III from comment #3)
> The actual errors:
> 
> ../rizin-v0.3.1/librz/io/p/io_zip.c:145:48: error: ‘struct zip_stat’ has no
> member named ‘size’
>   145 |                         ut8 *buf = calloc(1, sb.size);
>       |                                                ^
> ../rizin-v0.3.1/librz/io/p/io_zip.c:147:57: error: ‘struct zip_stat’ has no
> member named ‘size’
>   147 |                                 zip_fread(zFile, buf, sb.size);
>       |                                                         ^
> ../rizin-v0.3.1/librz/io/p/io_zip.c:148:65: error: ‘struct zip_stat’ has no
> member named ‘size’
>   148 |                                 rz_buf_set_bytes(zfo->b, buf,
> sb.size);
>       |                                                                 ^
> ../rizin-v0.3.1/librz/io/p/io_zip.c: In function ‘rz_io_zip_get_files’:
> ../rizin-v0.3.1/librz/io/p/io_zip.c:180:38: error: ‘struct zip_stat’ has no
> member named ‘name’
>   180 |                 if ((name = strdup(sb.name))) {
>       |                                      ^
> ../rizin-v0.3.1/librz/io/p/io_zip.c: In function ‘rz_io_zip_flush_file’:
> ../rizin-v0.3.1/librz/io/p/io_zip.c:204:32: warning: implicit declaration of
> function ‘zip_source_buffer’; did you mean ‘zip_source_free’?
> [-Wimplicit-function-declaration]
>   204 |         struct zip_source *s = zip_source_buffer(zipArch, tmp,
> tmpsz, 0);
>       |                                ^~~~~~~~~~~~~~~~~
>       |                                zip_source_free
> ../rizin-v0.3.1/librz/io/p/io_zip.c:204:32: warning: initialization of
> ‘struct zip_source *’ from ‘int’ makes pointer from integer without a cast
> [-Wint-conversion]
> ../rizin-v0.3.1/librz/io/p/io_zip.c: In function ‘rz_io_zip_create_new_file’:
> ../rizin-v0.3.1/librz/io/p/io_zip.c:241:43: error: ‘struct zip_stat’ has no
> member named ‘name’
>   241 |                 zfo->name = strdup(sb ? sb->name : filename);
>       |                                           ^~
> ../rizin-v0.3.1/librz/io/p/io_zip.c:242:43: error: ‘struct zip_stat’ has no
> member named ‘index’
>   242 |                 zfo->entry = !sb ? -1 : sb->index;
>       |                                           ^~
> ../rizin-v0.3.1/librz/io/p/io_zip.c: In function
> ‘rz_io_zip_alloc_zipfileobj’:
> ../rizin-v0.3.1/librz/io/p/io_zip.c:265:23: error: ‘struct zip_stat’ has no
> member named ‘name’
>   265 |                 if (sb.name != NULL) {
>       |                       ^
> ../rizin-v0.3.1/librz/io/p/io_zip.c:266:38: error: ‘struct zip_stat’ has no
> member named ‘name’
>   266 |                         if (strcmp(sb.name, filename) == 0) {
>       |                                      ^
> ../rizin-v0.3.1/librz/io/p/io_zip.c: In function ‘rz_io_zip_get_by_file_idx’:
> ../rizin-v0.3.1/librz/io/p/io_zip.c:368:45: error: ‘struct zip_stat’ has no
> member named ‘name’
>   368 |                         filename = strdup(sb.name);
>       |                                             ^

Actually, this is just some of a wall of errors.
Comment 5 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2021-12-30 15:54:06 UTC
(In reply to Agostino Sarubbo from comment #0)
> https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/
> 
> Issue: dev-util/rizin-0.3.1-r2 fails to compile.
> Discovered on: amd64 (internal ref: tinderbox)
> 
> NOTE:
> This machine uses clang as a compiler and lld as a linker

This build doesn't actually seem to be using Clang, so you seem to be setting it wrong.

Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS

C compiler for the host machine: x86_64-pc-linux-gnu-gcc (gcc 11.2.1 "x86_64-pc-linux-gnu-gcc (Gentoo 11.2.1_p20211127 p0) 11.2.1 20211127")
C linker for the host machine: x86_64-pc-linux-gnu-gcc ld.bfd 2.37

I'm really not sure how to reproduce this.
Comment 6 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2021-12-30 16:34:35 UTC
Thanks to sultan and ionen's sleuthing in #gentoo-dev, the problem is caused by libzip being compiled with Clang and Rizin being compiled with GCC (and this issue could probably be exposed by any revdep). It seems that libzip's declaration of _Nullable needs to be changed (sultan's suggestion):

#if defined(__has_feature)
  #if !__has_feature(nullability)
    #define _Nullable
  #endif
#else
  #define _Nullable
#endif

Reassigning to kde@ as it seems to be an issue in libzip and simply exposed by a consumer.
Comment 7 Andreas Sturmlechner gentoo-dev 2021-12-30 16:38:01 UTC
Sure, whoever wants to fix clang issues, step up.
Comment 8 Ionen Wolkens gentoo-dev 2022-04-23 09:26:34 UTC
*** Bug 830896 has been marked as a duplicate of this bug. ***