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

3.6.4: build fails with gcc 14.x #2116

Closed
kloczek opened this issue Feb 4, 2024 · 9 comments
Closed

3.6.4: build fails with gcc 14.x #2116

kloczek opened this issue Feb 4, 2024 · 9 comments

Comments

@kloczek
Copy link

kloczek commented Feb 4, 2024

Looks like last version build fails with latest gcc 14.x which is now used in fedora rawhide.

Build fails with
[tkloczko@pers-jacek x86_64-redhat-linux-gnu]$ make -k
/usr/bin/cmake -S/home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4 -B/home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/x86_64-redhat-linux-gnu --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/x86_64-redhat-linux-gnu/CMakeFiles /home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/x86_64-redhat-linux-gnu//CMakeFiles/progress.marks
make  -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/x86_64-redhat-linux-gnu'
make  -f CMakeFiles/simdjson.dir/build.make CMakeFiles/simdjson.dir/depend
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/x86_64-redhat-linux-gnu'
cd /home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/x86_64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4 /home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4 /home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/x86_64-redhat-linux-gnu /home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/x86_64-redhat-linux-gnu /home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/x86_64-redhat-linux-gnu/CMakeFiles/simdjson.dir/DependInfo.cmake "--color="
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/x86_64-redhat-linux-gnu'
make  -f CMakeFiles/simdjson.dir/build.make CMakeFiles/simdjson.dir/build
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/x86_64-redhat-linux-gnu'
[ 50%] Building CXX object CMakeFiles/simdjson.dir/src/simdjson.cpp.o
/usr/bin/g++ -DSIMDJSON_AVX512_ALLOWED=1 -DSIMDJSON_THREADS_ENABLED=1 -DSIMDJSON_UTF8VALIDATION=1 -Dsimdjson_EXPORTS -I/home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/include -I/home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/src -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -DNDEBUG -std=c++17 -fPIC -mno-avx256-split-unaligned-load -mno-avx256-split-unaligned-store -MD -MT CMakeFiles/simdjson.dir/src/simdjson.cpp.o -MF CMakeFiles/simdjson.dir/src/simdjson.cpp.o.d -o CMakeFiles/simdjson.dir/src/simdjson.cpp.o -c /home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/src/simdjson.cpp
In file included from /home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/src/fallback.cpp:15,
                 from /home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/src/simdjson.cpp:27:
/home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/src/generic/stage2/json_iterator.h: In function ‘simdjson::fallback::(anonymous namespace)::stage2::tape_builder::parse_document<false>(simdjson::fallback::dom_parser_implementation&, simdjson::dom::document&)simdjson::error_code’:
/home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/src/generic/stage2/json_iterator.h:119:49: error: inlining failed in call to ‘always_inline’ ‘simdjson::fallback::(anonymous namespace)::stage2::json_iterator::walk_document<false, simdjson::fallback::(anonymous namespace)::stage2::tape_builder>(simdjson::fallback::(anonymous namespace)::stage2::tape_builder&)simdjson::error_code’: target specific option mismatch
  119 | simdjson_warn_unused simdjson_inline error_code json_iterator::walk_document(V &visitor) noexcept {
      |                                                 ^~~~~~~~~~~~~
In file included from /home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/src/fallback.cpp:17:
/home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/src/generic/stage2/tape_builder.h:105:39: note: called from here
  105 |   return iter.walk_document<STREAMING>(builder);
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/src/generic/stage2/json_iterator.h:119:49: error: inlining failed in call to ‘always_inline’ ‘simdjson::fallback::(anonymous namespace)::stage2::json_iterator::walk_document<false, simdjson::fallback::(anonymous namespace)::stage2::tape_builder>(simdjson::fallback::(anonymous namespace)::stage2::tape_builder&)simdjson::error_code’: target specific option mismatch
  119 | simdjson_warn_unused simdjson_inline error_code json_iterator::walk_document(V &visitor) noexcept {
      |                                                 ^~~~~~~~~~~~~
/home/tkloczko/rpmbuild/BUILD/simdjson-3.6.4/src/generic/stage2/tape_builder.h:105:39: note: called from here
  105 |   return iter.walk_document<STREAMING>(builder);
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
make[2]: *** [CMakeFiles/simdjson.dir/build.make:79: CMakeFiles/simdjson.dir/src/simdjson.cpp.o] Error 1
make[2]: Target 'CMakeFiles/simdjson.dir/build' not remade because of errors.
@lemire
Copy link
Member

lemire commented Feb 4, 2024

The latest version of GCC is 13. We do not support unreleased compilers.

If you believe that there is a bug in simdjson, pull requests are always invited.

I am closing this issue.

@lemire lemire closed this as completed Feb 4, 2024
@kloczek
Copy link
Author

kloczek commented Feb 4, 2024

IMO it would be good to keep that ticket opened to prevent opening the same issues by other people. 🤔

@lemire
Copy link
Member

lemire commented Feb 4, 2024

IMO it would be good to keep that ticket opened to prevent opening the same issues by other people

I will do so if you provide evidence that the issue is with simdjson.

The assumption with an unreleased compiler is that the issue is with the compiler.

@kloczek
Copy link
Author

kloczek commented Feb 5, 2024

I will do so if you provide evidence that the issue is with simdjson.

The assumption with an unreleased compiler is that the issue is with the compiler.

That compiler has been tested ~two weeks ago on scale of whole fedora rawhide distribution.

@furkanusta
Copy link
Contributor

Are you building with any additional parameters?
In your compiler flags I see -flto which is disabled by default in simdjson

# LTO seems to create all sorts of fun problems. Let us

and -g (which is on by default if you don't specify a build type)

and there are a few GCC bug reports that always_inline doesn't work well with both flags present
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113203
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107931

It is possible that Fedora does not enable LTO by default or doesn't enable debug symbols (they might be being distributed separately) or the code in Fedora repos don't use always_inline attribute

@kloczek
Copy link
Author

kloczek commented Feb 5, 2024

Are you building with any additional parameters?

Yes. I;m using below set of flags

[tkloczko@pers-jacek build]$ rpm -E %set_build_flags

ASMFLAGS="-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security";
CFLAGS="-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security";
CXXFLAGS="-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security";
FFLAGS="-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -I/usr/lib64/gfortran/modules";
FCFLAGS="-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -I/usr/lib64/gfortran/modules";
LDFLAGS="-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--gc-sections -Wl,--as-needed -Wl,--build-id=sha1 -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,pack-relative-relocs -flto=auto -fuse-linker-plugin";
RUSTFLAGS="-C codegen-units=1 -C debuginfo=2 -C opt-level=2 -C link-arg=-Wl,--as-needed -C link-arg=-Wl,--build-id=sha1 -C link-arg=-Wl,-z,now -C link-arg=-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -C link-arg=-Wl,-z,pack-relative-relocs -C link-arg=-Wl,-z,relro -C link-arg=-flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS --cap-lints=warn" ;
VALAFLAGS="-g" ;
CC="/usr/bin/gcc"; CXX="/usr/bin/g++"; FC="/usr/bin/gfortran";
AR="/usr/bin/gcc-ar"; NM="/usr/bin/gcc-nm"; RANLIB="/usr/bin/gcc-ranlib";
export ASMFLAGS CFLAGS CXXFLAGS FFLAGS FCFLAGS LDFLAGS VALAFLAGS CC CXX FC AR NM RANLIB RUSTFLAGS VALAFLAGS;

@noloader
Copy link

noloader commented Feb 23, 2024

The Fedora Rawhide (F40 as of this writing) issue is at https://bugzilla.redhat.com/show_bug.cgi?id=2261694.

It is unfortunate this bug was closed. This bug report was a good opportunity to get ahead of the upcoming problems. Waiting until Fedora 40 is released will put the project and users behind, and everyone will have to play catch-up. That includes opening the same bug in the future.


If you look at the build.log attachment of the 2261694 bug, you will find:

/builddir/build/BUILD/simdjson-3.6.3/src/generic/stage2/json_iterator.h:119:49: error: inlining failed in call to ‘always_inline’ ‘simdjson::fallback::(anonymous namespace)::stage2::json_iterator::walk_document<false, simdjson::fallback::(anonymous namespace)::stage2::tape_builder>(simdjson::fallback::(anonymous namespace)::stage2::tape_builder&)simdjson::error_code’: target specific option mismatch

And if you look at the compile line, you will see you are missing arch specific options to use isa's like AVX512 in simdjson.cpp. So you can't use _mm512_cvtepu8_epi32, _mm512_extracti32x4_epi32, _mm512_storeu_si512 and friends. So the inlining fails.

I guess this can be food for thought until you allow the real bug report to come in.

@kloczek
Copy link
Author

kloczek commented Feb 23, 2024

I guess this can be food for thought until you allow the real bug report to come in.

So it has not to much to do with compiler version.
Good to know.
May I ask to reopen this ticket? 🤔

@lemire
Copy link
Member

lemire commented Feb 23, 2024

@kloczek

We are committed to quickly fixing issues with widely available compiler versions. The core team does not support experimental/unreleased compilers.

However, we do invite pull requests, bug reports and other contributions. We are about to release a new version of simdjson. If you believe that there is a bug in simdjson, I do invite you to help identify it (where is the bug, can you provide an analysis?) and ideally fix it (can you provide a change that fixes the issue you are encountering?).

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

No branches or pull requests

4 participants