nothings / stb

stb single-file public domain libraries for C/C++
https://twitter.com/nothings
Other
25.76k stars 7.66k forks source link

stb_image_resize2: implicit declaration of function 'vld1q_f16' is invalid in C99 [-Werror,-Wimplicit-function-declaration] #1650

Open Martinfx opened 2 weeks ago

Martinfx commented 2 weeks ago

Describe the bug Hi, I am maintainer on FreeBSD and you have some problem on arm7 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279369

In file included from /wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/rtextures.c:216:
/wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/external/stb_image_resize2.h:2422:22: error: implicit declaration of function 'vld1q_f16' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    float16x8_t in = vld1q_f16(input);
                     ^
/wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/external/stb_image_resize2.h:2422:17: error: initializing 'float16x8_t' (vector of 8 'float16_t' values) with an expression of incompatible type 'int'
    float16x8_t in = vld1q_f16(input);
                ^    ~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/external/stb_image_resize2.h:2423:27: error: implicit declaration of function 'vcvt_f32_f16' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    vst1q_f32(output + 0, vcvt_f32_f16(vget_low_f16(in)));
                          ^
/wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/external/stb_image_resize2.h:2423:5: error: initializing 'float32x4_t' (vector of 4 'float32_t' values) with an expression of incompatible type 'int'
    vst1q_f32(output + 0, vcvt_f32_f16(vget_low_f16(in)));
    ^                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7/usr/lib/clang/14.0.5/include/arm_neon.h:26839:15: note: expanded from macro 'vst1q_f32'
  float32x4_t __s1 = __p1; \
              ^      ~~~~
In file included from /wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/rtextures.c:216:
/wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/external/stb_image_resize2.h:2424:27: error: implicit declaration of function 'vcvt_f32_f16' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    vst1q_f32(output + 4, vcvt_f32_f16(vget_high_f16(in)));
                          ^
/wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/external/stb_image_resize2.h:2424:5: error: initializing 'float32x4_t' (vector of 4 'float32_t' values) with an expression of incompatible type 'int'
    vst1q_f32(output + 4, vcvt_f32_f16(vget_high_f16(in)));
    ^                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/clang/14.0.5/include/arm_neon.h:26839:15: note: expanded from macro 'vst1q_f32'
  float32x4_t __s1 = __p1; \
              ^      ~~~~
In file included from /wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/rtextures.c:216:
/wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/external/stb_image_resize2.h:2429:24: error: implicit declaration of function 'vcvt_f16_f32' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    float16x4_t out0 = vcvt_f16_f32(vld1q_f32(input + 0));
                       ^
/wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/external/stb_image_resize2.h:2429:17: error: initializing 'float16x4_t' (vector of 4 'float16_t' values) with an expression of incompatible type 'int'
    float16x4_t out0 = vcvt_f16_f32(vld1q_f32(input + 0));
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/external/stb_image_resize2.h:2430:17: error: initializing 'float16x4_t' (vector of 4 'float16_t' values) with an expression of incompatible type 'int'
    float16x4_t out1 = vcvt_f16_f32(vld1q_f32(input + 4));
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/external/stb_image_resize2.h:2431:5: error: implicit declaration of function 'vst1q_f16' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    vst1q_f16(output, vcombine_f16(out0, out1));
    ^
/wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/external/stb_image_resize2.h:2436:27: error: implicit declaration of function 'vcvt_f32_f16' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    return vgetq_lane_f32(vcvt_f32_f16(vdup_n_f16(h)), 0);
                          ^
/wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/external/stb_image_resize2.h:2436:12: error: initializing 'float32x4_t' (vector of 4 'float32_t' values) with an expression of incompatible type 'int'
    return vgetq_lane_f32(vcvt_f32_f16(vdup_n_f16(h)), 0);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/clang/14.0.5/include/arm_neon.h:7788:15: note: expanded from macro 'vgetq_lane_f32'
  float32x4_t __s0 = __p0; \
              ^      ~~~~
In file included from /wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/rtextures.c:216:
/wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/external/stb_image_resize2.h:2441:26: error: implicit declaration of function 'vcvt_f16_f32' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    return vget_lane_f16(vcvt_f16_f32(vdupq_n_f32(f)), 0);
                         ^
/wrkdirs/usr/ports/devel/raylib/work/raylib-5.0/src/external/stb_image_resize2.h:2441:12: error: initializing 'float16x4_t' (vector of 4 'float16_t' values) with an expression of incompatible type 'int'
    return vget_lane_f16(vcvt_f16_f32(vdupq_n_f32(f)), 0);
           ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/clang/14.0.5/include/arm_neon.h:67449:15: note: expanded from macro 'vget_lane_f16'
  float16x4_t __s0_851 = __p0_851; \
              ^          ~~~~~~~~
jeffrbig2 commented 2 weeks ago

ARM 7 works fine for me - we don't use hardware half float on ARM unless you manually define STBIR_FP16C - maybe they did that by accident?

Martinfx commented 2 weeks ago

Jail has problem with arm7 code this from log from jail https://pkg-status.freebsd.org/ampere1/data/132releng-armv7-quarterly/5038d10feb88/logs/raylib-5.0.log

nothings commented 2 weeks ago

I'll give an actual answer in the next reply, but the immediate answer is: raylib ships with its own embedded copy of stb_image_resize2.h. Configuration (such as whether "STBIR_FP16C" is being defined) is done by raylib, and so initial bug reports should almost certainly go to raylib, not to us.

Edit: I see you had tried to report it to them and they were unhelpful. Sorry about that.

nothings commented 2 weeks ago

Now, to give an actual answer...

What is "jail" and what does it have to do with this compilation error? (If it doesn't matter for this compilation error, then don't explain it, we don't need to know.) What version of stb_image_resize2.h is being compiled? Did this work previously, and if so, what changed from when it worked before?

We're not raylib developers and we're not FreeBSD developers. We're stb library developers. You have to provide us with information that relates to how the library is being compiled if you want us to help.

jeffrbig2 commented 2 weeks ago

I got a older GCC build going and repro-ed the issue. Will be fixed shortly.