Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conflicts with gcc's <arm_neon.h> #12

Open
shawnl opened this issue Apr 11, 2019 · 2 comments
Open

conflicts with gcc's <arm_neon.h> #12

shawnl opened this issue Apr 11, 2019 · 2 comments

Comments

@shawnl
Copy link

shawnl commented Apr 11, 2019

<arm_neon.h> is defined by a spec that ARM releases, and implemented by compilers. It is not a "real" header file. This happen with either included first.

[2/244] Building CXX object CMakeFiles/zig.dir/src/tokenizer.cpp.o
FAILED: CMakeFiles/zig.dir/src/tokenizer.cpp.o 
/usr/bin/c++   -I../deps/lld/include -I/usr/lib/llvm-8/include -I../deps/SoftFloat-3e/source/include -I../ -I. -I../src -I../deps/SoftFloat-3e-prebuilt -I../deps/SoftFloat-3e/source/8086 -g   -std=c++11 -Werror -Wall -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fno-exceptions -fno-rtti  -Werror=strict-prototypes -Werror=old-style-definition -Werror=type-limits -Wno-missing-braces -MD -MT CMakeFiles/zig.dir/src/tokenizer.cpp.o -MF CMakeFiles/zig.dir/src/tokenizer.cpp.o.d -o CMakeFiles/zig.dir/src/tokenizer.cpp.o -c ../src/tokenizer.cpp
In file included from ../src/utf8/range2-neon.c:10,
                 from ../src/utf8/utf8.h:4,
                 from ../src/tokenizer.cpp:11:
/usr/lib/gcc/aarch64-linux-gnu/8/include/arm_neon.h:72:16: error: conflicting declaration ‘typedef __fp16 float16_t’
 typedef __fp16 float16_t;
                ^~~~~~~~~
In file included from ../deps/SoftFloat-3e/source/include/softfloat.h:51,
                 from ../src/softfloat.hpp:12,
                 from ../src/util.hpp:36,
                 from ../src/list.hpp:11,
                 from ../src/buffer.hpp:11,
                 from ../src/tokenizer.hpp:11,
                 from ../src/tokenizer.cpp:8:
../deps/SoftFloat-3e/source/include/softfloat_types.h:50:32: note: previous declaration as ‘typedef struct float16_t float16_t’
 typedef struct { uint16_t v; } float16_t;
                                ^~~~~~~~~
In file included from ../src/utf8/range2-neon.c:10,
                 from ../src/utf8/utf8.h:4,
                 from ../src/tokenizer.cpp:11:
/usr/lib/gcc/aarch64-linux-gnu/8/include/arm_neon.h:73:15: error: conflicting declaration ‘typedef float float32_t’
 typedef float float32_t;
               ^~~~~~~~~
In file included from ../deps/SoftFloat-3e/source/include/softfloat.h:51,
                 from ../src/softfloat.hpp:12,
                 from ../src/util.hpp:36,
                 from ../src/list.hpp:11,
                 from ../src/buffer.hpp:11,
                 from ../src/tokenizer.hpp:11,
                 from ../src/tokenizer.cpp:8:
../deps/SoftFloat-3e/source/include/softfloat_types.h:51:32: note: previous declaration as ‘typedef struct float32_t float32_t’
 typedef struct { uint32_t v; } float32_t;
                                ^~~~~~~~~
In file included from ../src/utf8/range2-neon.c:10,
                 from ../src/utf8/utf8.h:4,
                 from ../src/tokenizer.cpp:11:
/usr/lib/gcc/aarch64-linux-gnu/8/include/arm_neon.h:74:16: error: conflicting declaration ‘typedef double float64_t’
 typedef double float64_t;
                ^~~~~~~~~
In file included from ../deps/SoftFloat-3e/source/include/softfloat.h:51,
                 from ../src/softfloat.hpp:12,
                 from ../src/util.hpp:36,
                 from ../src/list.hpp:11,
                 from ../src/buffer.hpp:11,
                 from ../src/tokenizer.hpp:11,
                 from ../src/tokenizer.cpp:8:
../deps/SoftFloat-3e/source/include/softfloat_types.h:52:32: note: previous declaration as ‘typedef struct float64_t float64_t’
 typedef struct { uint64_t v; } float64_t;
                                ^~~~~~~~~

Perhaps softfloat does not work with <arm_neon.h>, in which case a preprocessor #error should give a more helpful error.

@GuillaumeDIDIER
Copy link

Just got affected by that issue using the spike simulator + the SDL library (which includes the arm_neon header on ARM in its public headers)

While I was able to use a preprocessor trick that defined floatXX_t to sdl_floatXX_t around the SDL.h include (and #undefining those afterwards), it would probably be better not add a prefix to those types in the soft float library to avoid such conflicts.

@invertego
Copy link

MSVC also ships versions of this header (arm_neon.h and arm64_neon.h) with typedefs for float32_t and float64_t (on arm64). Moreover, when building for arm this header is included indirectly by intrin.h, the umbrella MSVC header for intrinsics on all architectures. This creates conflicts for applications that don't even use NEON intrinsics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants