Opened 3 years ago

Closed 13 months ago

Last modified 13 months ago

#17040 closed bug (fixed)

uchar.h not self-contained

Reported by: cocobean Owned by: nobody
Priority: normal Milestone: R1/beta5
Component: System/POSIX Version: R1/Development
Keywords: r1beta4-fixes Cc:
Blocked By: Blocking:
Platform: All

Description (last modified by cocobean)

Tested on hrev55203 x86_64 with Blender 2.83.16.

Haiku's fixed-width integer types implementation "randomly" conflict or produce 'unknown type names' seen during FOSS (i.e. Free and Open Source Software) compilations. These macros randomly break FOSS builds with different results between the Haiku x86 and Haiku x86_64 platforms - a FOSS build that passes on Haiku x86 may break on Haiku x86_64 (and vice-versa).

Example: posix/uchar.h - now get 'unknown type name' with Blender 2.83.16.

typedef uint_least16_t char16_t;
typedef uint_least32_t char32_t;

NOTE: Blender 2.83.x compilation(s) worked previously with Haiku R1B2 (+123).

Change History (12)

comment:1 by cocobean, 3 years ago

Description: modified (diff)

comment:2 by cocobean, 3 years ago

Description: modified (diff)

comment:3 by pulkomandy, 3 years ago

What do you mean, these are standard types from POSIX.

Also, please provide a build log with the exact error you're getting, because it is impossible to see what the problem is otherwise.

comment:4 by korli, 3 years ago

Keywords: uchar.h stdint.h cstdint posix C99 removed
Priority: highnormal

comment:5 by cocobean, 3 years ago

  1. haikuporter blender --get-dependencies --no-source-packages (blender 2.83.16)
    [267/3986] Building C object extern/wc...keFiles/extern_wcwidth.dir/wcwidth.c.o
    FAILED: extern/wcwidth/CMakeFiles/extern_wcwidth.dir/wcwidth.c.o 
    /bin/cc -DNDEBUG -DWITH_OPENGL -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D__LITTLE_ENDIAN__ -D__MMX__ -D__SSE2__ -D__SSE__ -I../extern/wcwidth -Wall -Wcast-align      -Wno-char-subscripts -Wno-unknown-pragmas -Wpointer-arith   -Wlogical-op  -Winit-self -Wmissing-include-dirs -Wno-div-by-zero -Wtype-limits -Wformat-signedness -Wrestrict -Wnonnull -Wuninitialized   -Wno-error=unused-but-set-variable -Wimplicit-fallthrough=5  -fopenmp -std=gnu11   -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing -msse2  -Wno-deprecated-declarations -Wno-unused-parameter -Wno-unused-function -Wno-type-limits -Wno-int-in-bool-context -Wno-format -Wno-switch -Wno-implicit-fallthrough -Wno-error=unused-but-set-variable -O2 -DNDEBUG -MD -MT extern/wcwidth/CMakeFiles/extern_wcwidth.dir/wcwidth.c.o -MF extern/wcwidth/CMakeFiles/extern_wcwidth.dir/wcwidth.c.o.d -o extern/wcwidth/CMakeFiles/extern_wcwidth.dir/wcwidth.c.o -c ../extern/wcwidth/wcwidth.c
    In file included from ../extern/wcwidth/wcwidth.h:29,
                     from ../extern/wcwidth/wcwidth.c:62:
    /boot/system/develop/headers/posix/uchar.h:17:9: error: unknown type name 'uint_least32_t'
     typedef uint_least32_t char32_t;
             ^~~~~~~~~~~~~~
    /boot/system/develop/headers/posix/uchar.h:18:9: error: unknown type name 'uint_least16_t'
     typedef uint_least16_t char16_t;
             ^~~~~~~~~~~~~~
    [270/3986] Building CXX object intern/...n_quadriflow.dir/quadriflow_capi.cpp.o
    ninja: build stopped: subcommand failed.
    Warning: Command '['bash', '-c', '. /wrapper-script']' returned non-zero exit status 1.
    Error: Build has failed - stopping.
    ~/haikuports/media-gfx/blender>
    

NOTE: Blender 2.83.12+ builds were compiling successfully on earlier nightly revisions from Haiku R1B2 x86_64. Blender 2.79b still compiles successfully. Blender 2.93.1 passed this error.

comment:6 by korli, 3 years ago

Summary: Fixed-width integer types either conflict or are unknown type names seen during FOSS compilationsuchar.h not self-contained

comment:7 by bhaible, 13 months ago

The bug is still present in the r1beta4.

How to reproduce: foo.c is

#include <uchar.h>

On 32-bit r1beta4:

$ gcc-x86 -c foo.c -Wall
In file included from foo.c:1:
/boot/system/develop/headers/posix/uchar.h:17:9: error: unknown type name 'uint_least32_t'
   17 | typedef uint_least32_t char32_t;
      |         ^~~~~~~~~~~~~~
/boot/system/develop/headers/posix/uchar.h:18:9: error: unknown type name 'uint_least16_t'
   18 | typedef uint_least16_t char16_t;
      |         ^~~~~~~~~~~~~~

and

$ gcc -c foo.c -Wall
In file included from /boot/home/foo.c:1:
/boot/system/develop/headers/posix/uchar.h:17: parse error before `char32_t'
/boot/system/develop/headers/posix/uchar.h:17: warning: data definition has no type or storage class
/boot/system/develop/headers/posix/uchar.h:18: parse error before `char16_t'
/boot/system/develop/headers/posix/uchar.h:18: warning: data definition has no type or storage class
/boot/system/develop/headers/posix/uchar.h:29: parse error before `char32_t'
/boot/system/develop/headers/posix/uchar.h: In function `c16rtomb':
/boot/system/develop/headers/posix/uchar.h:31: `wc' undeclared (first use in this function)
/boot/system/develop/headers/posix/uchar.h:31: (Each undeclared identifier is reported only once
/boot/system/develop/headers/posix/uchar.h:31: for each function it appears in.)
/boot/system/develop/headers/posix/uchar.h:32: `dest' undeclared (first use in this function)
/boot/system/develop/headers/posix/uchar.h:32: `mbState' undeclared (first use in this function)
/boot/system/develop/headers/posix/uchar.h: At top level:
/boot/system/develop/headers/posix/uchar.h:37: parse error before `*'
/boot/system/develop/headers/posix/uchar.h: In function `mbrtoc32':
/boot/system/develop/headers/posix/uchar.h:39: `dest' undeclared (first use in this function)
/boot/system/develop/headers/posix/uchar.h:39: `src' undeclared (first use in this function)
/boot/system/develop/headers/posix/uchar.h:39: `srcLength' undeclared (first use in this function)
/boot/system/develop/headers/posix/uchar.h:39: `mbState' undeclared (first use in this function)
/boot/system/develop/headers/posix/uchar.h: At top level:
/boot/system/develop/headers/posix/uchar.h:44: parse error before `char32_t'
/boot/system/develop/headers/posix/uchar.h: In function `c32rtomb':
/boot/system/develop/headers/posix/uchar.h:46: `dest' undeclared (first use in this function)
/boot/system/develop/headers/posix/uchar.h:46: `wc' undeclared (first use in this function)
/boot/system/develop/headers/posix/uchar.h:46: `mbState' undeclared (first use in this function)

To fix this, you just need to add a #include <stdint.h> to the top of uchar.h.

comment:8 by waddlesplash, 13 months ago

Milestone: UnscheduledR1/beta5
Resolution: fixed
Status: newclosed

Fixed in hrev56904.

comment:9 by bhaible, 13 months ago

Thank you!

comment:10 by kallisti5, 13 months ago

Milestone: R1/beta5R1/beta4

Cherry-picked to r1beta4 too. Expect the next r1beta4 update to contain this fix.

comment:11 by pulkomandy, 13 months ago

Milestone: R1/beta4R1/beta5

I don't think we should put things in the beta4 milestone when they are added to the branch after the release. It makes it hard to know what changed between one release and the next.

comment:12 by pulkomandy, 13 months ago

Keywords: r1beta4-fixes added
Note: See TracTickets for help on using tickets.