deathkiller / jazz2-native

🎮 · Jazz² Resurrection: Native C++ reimplementation of Jazz Jackrabbit 2
https://deat.tk/jazz2/
GNU General Public License v3.0
508 stars 33 forks source link

Error compiling on Fedora 40 #65

Open musuruan opened 1 week ago

musuruan commented 1 week ago

Jazz² Resurrection version

2.7.0

System information

Fedora 40

Issue description

When compiling on F40 with Fedora optflags I get the following error:

/builddir/build/BUILD/jazz2-native-2.7.0/Sources/simdjson/simdjson.cpp: In function ‘simdjson::fallback::(anonymous namespace)::stage2::tape_builder::parse_document<false>(simdjson::fallback::dom_parser_implementation&, simdjson::dom::document&)simdjson::error_code’:
/builddir/build/BUILD/jazz2-native-2.7.0/Sources/simdjson/simdjson.cpp:16640: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
16640 | simdjson_warn_unused simdjson_inline error_code json_iterator::walk_document(V &visitor) noexcept {
      |                                                 ^~~~~~~~~~~~~
/builddir/build/BUILD/jazz2-native-2.7.0/Sources/simdjson/simdjson.cpp:17077:39: note: called from here
17077 |   return iter.walk_document<STREAMING>(builder);
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/builddir/build/BUILD/jazz2-native-2.7.0/Sources/simdjson/simdjson.cpp:16640: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
16640 | simdjson_warn_unused simdjson_inline error_code json_iterator::walk_document(V &visitor) noexcept {
      |                                                 ^~~~~~~~~~~~~
/builddir/build/BUILD/jazz2-native-2.7.0/Sources/simdjson/simdjson.cpp:17077:39: note: called from here
17077 |   return iter.walk_document<STREAMING>(builder);
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
gmake[2]: *** [CMakeFiles/jazz2.dir/build.make:1367: CMakeFiles/jazz2.dir/Sources/simdjson/simdjson.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
/builddir/build/BUILD/jazz2-native-2.7.0/Sources/Jazz2/ContentResolver.cpp: In member function ‘Jazz2::ContentResolver::RequestMetadata(Death::Containers::BasicStringView<char const>)’:
/builddir/build/BUILD/jazz2-native-2.7.0/Sources/Jazz2/ContentResolver.cpp:571:48: warning: ‘count’ may be used uninitialized [-Wmaybe-uninitialized]
  571 |                                         } else if (count > 1) {
      |                                                ^~
/builddir/build/BUILD/jazz2-native-2.7.0/Sources/Jazz2/ContentResolver.cpp:486:40: note: ‘count’ was declared here
  486 |                                 size_t count;
      |                                        ^~~~~
gmake[2]: Leaving directory '/builddir/build/BUILD/jazz2-native-2.7.0/redhat-linux-build'
gmake[1]: Leaving directory '/builddir/build/BUILD/jazz2-native-2.7.0/redhat-linux-build'
gmake[1]: *** [CMakeFiles/Makefile2:103: CMakeFiles/jazz2.dir/all] Error 2
gmake: *** [Makefile:159: all] Error 2

optflags are:

$ rpm --eval %optflags
-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer

It is probably gcc14 related.

Steps to reproduce

I am compiling the SDL version.

Build log: build.log

deathkiller commented 1 week ago

The error is in simdjson which is 3rd party library (in combination with GCC), so I'm not sure how I would fix it. Disabling inline for entire simdjson (behind some CMake parameter) is probably all I can do for you. Or you can report it to simdjson repo to get some feedback from them. It works fine in my standard Fedora 40.

musuruan commented 1 week ago

I see that simdjson is already packaged for a lot of distributions: https://repology.org/project/simdjson/versions

Would it be feasible to use the library version instead of bundling it?

deathkiller commented 1 week ago

I would rather keep it as is and fix the cause properly than add an option to link to the system library (which would only be used by you). It would only increase the complexity of the build system.