Try / OpenGothic

Reimplementation of Gothic 2 Notr
MIT License
1.14k stars 80 forks source link

Issue in install from AUR #521

Open Cyrylow opened 11 months ago

Cyrylow commented 11 months ago

Hello when i am trying install OG via paru i have errors what canceling installing proccess

[100%] Linking CXX executable opengothic/Gothic2Notr /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/script.hh:408:15: error: type ‘struct symbol’ violates the C++ One Definition Rule [-Werror=odr] 408 | class symbol final { | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/script.hh:408:15: note: a different type is defined in another translation unit 408 | class symbol final { | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/script.hh:658:21: note: the first difference of corresponding definitions is field ‘_m_value’ 658 | _m_value; | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/script.hh:658:21: note: a field of same name but different type is defined in another translation unit 658 | _m_value; | ^ /usr/include/c++/13.2.1/variant:1337:11: note: type ‘struct variant’ itself violates the C++ One Definition Rule 1337 | class variant | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:45:15: error: type ‘struct VfsNode’ violates the C++ One Definition Rule [-Werror=odr] 45 | class VfsNode { | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:45:15: note: a different type is defined in another translation unit 45 | class VfsNode { | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:73:60: note: the first difference of corresponding definitions is field ‘_m_data’ 73 | std::variant<std::vector, buffer> _m_data; | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:73:60: note: a field of same name but different type is defined in another translation unit 73 | std::variant<std::vector, buffer> _m_data; | ^ /usr/include/c++/13.2.1/variant:1337:11: note: type ‘struct variant’ itself violates the C++ One Definition Rule 1337 | class variant | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:84:15: error: type ‘struct Vfs’ violates the C++ One Definition Rule [-Werror=odr] 84 | class Vfs { | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:84:15: note: a different type is defined in another translation unit 84 | class Vfs { | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:171:25: note: the first difference of corresponding definitions is field ‘_m_root’ 171 | VfsNode _m_root; | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:171:25: note: a field of same name but different type is defined in another translation unit 171 | VfsNode _m_root; | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:45:15: note: type ‘struct VfsNode’ itself violates the C++ One Definition Rule 45 | class VfsNode { | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/vm.hh:74:16: error: type ‘struct daedalus_stack_frame’ violates the C++ One Definition Rule [-Werror=odr] 74 | struct daedalus_stack_frame { | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/vm.hh:74:16: note: a different type is defined in another translation unit 74 | struct daedalus_stack_frame { | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/vm.hh:77:82: note: the first difference of corresponding definitions is field ‘value’ 77 | std::variant<int32_t, float, symbol, std::shared_ptr> value; | ^ /home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/vm.hh:77:82: note: a field of same name but different type is defined in another translation unit 77 | std::variant<int32_t, float, symbol, std::shared_ptr> value; | ^ /usr/include/c++/13.2.1/variant:1337:11: note: type ‘struct variant’ itself violates the C++ One Definition Rule 1337 | class variant | ^ lto1: all warnings being treated as errors lto-wrapper: fatal error: /usr/bin/c++ returned 1 exit status compilation terminated. /usr/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/Gothic2Notr.dir/build.make:2548: opengothic/Gothic2Notr] Błąd 1 make[1]: [CMakeFiles/Makefile2:576: CMakeFiles/Gothic2Notr.dir/all] Błąd 2 make: *** [Makefile:136: all] Błąd 2 make: Opuszczenie katalogu '/home/adminkurwaabsolutny/.cache/paru/clone/opengothic/src/OpenGothic/build' ==> BŁĄD: Wystąpił błąd w build(). Przerywam... error: failed to build 'opengothic-1.0.2324-2': error: packages failed to build: opengothic-1.0.2324-2

lmichaelis commented 11 months ago

Hio, this looks like a problem with phoenix, a dependency of OG. Which compiler (+version) are you using? Currently supported compilers for phoenix are Clang, GCC, Apple Clang, MinGW and MSVC.

Cyrylow commented 11 months ago

I tried in two ways. By paru, and later by command PKGBUILD. Same effect

lmichaelis commented 11 months ago

Then you should report this to @CReimer at https://github.com/CReimer/PKGBUILDs.

@CReimer: Maybe it makes sense to specify a compiler and CMake generator when invoking CMake configure so it always chooses the right compiler?

CReimer commented 11 months ago

I'm not sure what @Cyrylow is doing. Just tried a fresh build with the AUR helper paru. No problems here.

To answer your question Arch currently provides GCC 13.2.1 20230801 by default. You could install clang 16.0.6. But that would need additional configuration for the Arch build system to use that.

To be as thorough as I can I tried that, too.

The build fails with clang, but not the way it does for @Cyrylow

I'm starting to suspect @Cyrylow is not using Arch Linux, but some subpar Arch-based distribution with a broken build system.

[ 93%] Building CXX object CMakeFiles/Gothic2Notr.dir/game/graphics/mesh/submesh/packedmesh.cpp.o
In file included from /home/christopher/.cache/paru/clone/opengothic/src/OpenGothic/game/graphics/mesh/protomesh.cpp:7:
In file included from /home/christopher/.cache/paru/clone/opengothic/src/OpenGothic/game/physics/physicmeshshape.h:3:
In file included from /home/christopher/.cache/paru/clone/opengothic/src/OpenGothic/game/physics/physics.h:27:
In file included from /home/christopher/.cache/paru/clone/opengothic/src/OpenGothic/lib/bullet3/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h:22:
In file included from /home/christopher/.cache/paru/clone/opengothic/src/OpenGothic/lib/bullet3/src/BulletCollision/CollisionShapes/btTriangleInfoMap.h:20:
/home/christopher/.cache/paru/clone/opengothic/src/OpenGothic/lib/bullet3/src/LinearMath/btSerializer.h:502:7: error: variable 'mysize' set but not used [-Werror,-Wunused-but-set-variable]
                int mysize = 0;
                    ^
[ 93%] Building CXX object CMakeFiles/Gothic2Notr.dir/game/graphics/mesh/submesh/pfxemittermesh.cpp.o
[ 93%] Building CXX object CMakeFiles/Gothic2Notr.dir/game/graphics/mesh/submesh/staticmesh.cpp.o
[ 93%] Building CXX object CMakeFiles/Gothic2Notr.dir/game/graphics/meshobjects.cpp.o
[ 93%] Building CXX object CMakeFiles/Gothic2Notr.dir/game/graphics/objectsbucket.cpp.o
1 error generated.
make[2]: *** [CMakeFiles/Gothic2Notr.dir/build.make:1000: CMakeFiles/Gothic2Notr.dir/game/graphics/mesh/protomesh.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:576: CMakeFiles/Gothic2Notr.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
make: Leaving directory '/home/christopher/.cache/paru/clone/opengothic/src/OpenGothic/build'
==> ERROR: A failure occurred in build().
    Aborting...
error: failed to build 'opengothic-1.0.2324-2': 
error: packages failed to build: opengothic-1.0.2324-2
Cyrylow commented 11 months ago

@CReimer Yes, im using arch-based distro, CachyOS

CReimer commented 11 months ago

Ohh okay. Never heard of that. Might have something to do with their more aggressive compile optimization for x86-64-v3 and x86-64-v4. Which is actually kind of intriguing right now :stuck_out_tongue:

If you had said your using Manjaro I would have just straight up refused to help. But in this case I'll try it in a VM and report back.

CReimer commented 11 months ago

Okay, much easier way to test it. I found their makepkg.conf. CachyOS enables link time optimization by default. This seems to break linking because of something call "C++ One Definition Rule"

@Cyrylow Please try and replace options=('!emptydirs') with options=('!emptydirs' '!lto') in the PKGBUILD file

@lmichaelis Now that we found what's causing it. Maybe you still want to fix it? I'm no C++ expert, but this line look like it's not your fault

/usr/include/c++/13.2.1/variant:1337:11: note: type 'struct variant' itself violates the C++ One Definition Rule

Here's the full error message

[100%] Linking CXX executable opengothic/Gothic2Notr
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/script.hh:408:15: error: type 'struct symbol' violates the C++ One Definition Rule [-Werror=odr]
  408 |         class symbol final {
      |               ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/script.hh:408:15: note: a different type is defined in another translation unit
  408 |         class symbol final {
      |               ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/script.hh:658:21: note: the first difference of corresponding definitions is field '_m_value'
  658 |                     _m_value;
      |                     ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/script.hh:658:21: note: a field of same name but different type is defined in another translation unit
  658 |                     _m_value;
      |                     ^
/usr/include/c++/13.2.1/variant:1337:11: note: type 'struct variant' itself violates the C++ One Definition Rule
 1337 |     class variant
      |           ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:45:15: error: type 'struct VfsNode' violates the C++ One Definition Rule [-Werror=odr]
   45 |         class VfsNode {
      |               ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:45:15: note: a different type is defined in another translation unit
   45 |         class VfsNode {
      |               ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:73:60: note: the first difference of corresponding definitions is field '_m_data'
   73 |                 std::variant<std::vector<VfsNode>, buffer> _m_data;
      |                                                            ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:73:60: note: a field of same name but different type is defined in another translation unit
   73 |                 std::variant<std::vector<VfsNode>, buffer> _m_data;
      |                                                            ^
/usr/include/c++/13.2.1/variant:1337:11: note: type 'struct variant' itself violates the C++ One Definition Rule
 1337 |     class variant
      |           ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:84:15: error: type 'struct Vfs' violates the C++ One Definition Rule [-Werror=odr]
   84 |         class Vfs {
      |               ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:84:15: note: a different type is defined in another translation unit
   84 |         class Vfs {
      |               ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:171:25: note: the first difference of corresponding definitions is field '_m_root'
  171 |                 VfsNode _m_root;
      |                         ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:171:25: note: a field of same name but different type is defined in another translation unit
  171 |                 VfsNode _m_root;
      |                         ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/Vfs.hh:45:15: note: type 'struct VfsNode' itself violates the C++ One Definition Rule
   45 |         class VfsNode {
      |               ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/vm.hh:74:16: error: type 'struct daedalus_stack_frame' violates the C++ One Definition Rule [-Werror=odr]
   74 |         struct daedalus_stack_frame {
      |                ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/vm.hh:74:16: note: a different type is defined in another translation unit
   74 |         struct daedalus_stack_frame {
      |                ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/vm.hh:77:82: note: the first difference of corresponding definitions is field 'value'
   77 |                 std::variant<int32_t, float, symbol*, std::shared_ptr<instance>> value;
      |                                                                                  ^
/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/lib/phoenix/include/phoenix/vm.hh:77:82: note: a field of same name but different type is defined in another translation unit
   77 |                 std::variant<int32_t, float, symbol*, std::shared_ptr<instance>> value;
      |                                                                                  ^
/usr/include/c++/13.2.1/variant:1337:11: note: type 'struct variant' itself violates the C++ One Definition Rule
 1337 |     class variant
      |           ^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/c++ returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/Gothic2Notr.dir/build.make:2548: opengothic/Gothic2Notr] Error 1
make[1]: *** [CMakeFiles/Makefile2:576: CMakeFiles/Gothic2Notr.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
make: Leaving directory '/home/christopher/Projects/PKGBUILDs/opengothic/src/OpenGothic/build'
==> ERROR: A failure occurred in build().
    Aborting...
lmichaelis commented 11 months ago

@lmichaelis Now that we found what's causing it. Maybe you still want to fix it? I'm no C++ expert, but this line look like it's not your fault

Hm I'd like to but I don't seem to be able to reproduce it. Everything compiles normally if I add -flto to the or specify -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON for CMake. I also doubt that fixing this in phoenix will be enough. I think if this crops up with phoenix it probably will with OpenGothic too. Let's just disable it in the PKGBUILD and I'll keep it on the backburner :)