Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Can't build with cmake and g++ 9.2.0 #16

Closed
abeimler opened this issue Nov 12, 2019 · 3 comments
Closed

Can't build with cmake and g++ 9.2.0 #16

abeimler opened this issue Nov 12, 2019 · 3 comments

Comments

@abeimler
Copy link
Contributor

I try to build ECS with my other Project (didn't work), so I fork ESC and add my typical cmake-file and compiler-options (try out C++14 and C++17): https://github.com/abeimler/ECS

OS: Arch Linux x86_64 (4.16.81-1-MANJARO)
Compiler: c++ (GCC) 9.2.0
CMake: 3.15.5

Build:

mkdir build
cmake . -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DECS_SAMPLE_BUILD:BOOL="1"
cmake --build build

Error:

[ 50%] Building CXX object CMakeFiles/sample.dir/sample.cpp.o
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/ext/new_allocator.h:146:8: error: allocation of incomplete type 'ECS::Entity' [clang-diagnostic-error]
                            _Up(std::forward<_Args>(__args)...)))
                            ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/bits/alloc_traits.h:483:24: note: in instantiation of exception specification for
 'construct<ECS::Entity, ECS::World *, unsigned long &>' requested here
        noexcept(noexcept(__a.construct(__p, std::forward<_Args>(__args)...)))
                              ^
ECS.h:454:4: note: in instantiation of exception specification for 'construct<ECS::Entity, ECS::World *, unsigned long &>
' requested here
                        std::allocator_traits<EntityAllocator>::construct(entAlloc, ent, this, lastEntityId);
                        ^
ECS.h:131:8: note: forward declaration of 'ECS::Entity'
        class Entity;
              ^
1 error generated.
Error while processing sample.cpp.
Found compiler errors, but -fix-errors was not specified.
Fixes have NOT been applied.

Found compiler error(s).
make[3]: *** [CMakeFiles/sample.dir/build.make:63: CMakeFiles/sample.dir/sample.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:105: CMakeFiles/sample.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:117: CMakeFiles/sample.dir/rule] Error 2
make: *** [Makefile:131: sample] Error 2
@redxdev
Copy link
Owner

redxdev commented Nov 12, 2019

Do you have this problem when building without cmake (manually calling GCC)?

@abeimler
Copy link
Contributor Author

abeimler commented Nov 12, 2019

Nope, does not work:

c++ sample.cpp -o ./build/sample
g++ sample.cpp -o ./build/sample
clang++ sample.cpp -o ./build/sample

Same Error...
g++ -v sample.cpp -o ./build/sample

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --enable-shared --enable-threads=posix --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp --enable-cet=auto gdc_include_dir=/usr/include/dlang/gdc
Thread model: posix
gcc version 9.2.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-o' './build/sample' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/cc1plus -quiet -v -D_GNU_SOURCE sample.cpp -quiet -dumpbase sample.cpp -mtune=generic -march=x86-64 -auxbase sample -version -o /tmp/ccukPxng.s
GNU C++14 (GCC) version 9.2.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 9.2.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.21-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0
 /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/x86_64-pc-linux-gnu
 /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/backward
 /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include
 /usr/local/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include-fixed
 /usr/include
End of search list.
GNU C++14 (GCC) version 9.2.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 9.2.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.21-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: e70628160ff7c7e477f7d9570e6637cb
In file included from /usr/include/c++/9.2.0/x86_64-pc-linux-gnu/bits/c++allocator.h:33,
                 from /usr/include/c++/9.2.0/bits/allocator.h:46,
                 from /usr/include/c++/9.2.0/string:41,
                 from /usr/include/c++/9.2.0/bits/locale_classes.h:40,
                 from /usr/include/c++/9.2.0/bits/ios_base.h:41,
                 from /usr/include/c++/9.2.0/ios:42,
                 from /usr/include/c++/9.2.0/ostream:38,
                 from /usr/include/c++/9.2.0/iostream:39,
                 from sample.cpp:23:
/usr/include/c++/9.2.0/ext/new_allocator.h: In instantiation of ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = ECS::Entity; _Args = {ECS::World*, long unsigned int&}; _Tp = ECS::Entity]’:
/usr/include/c++/9.2.0/bits/alloc_traits.h:482:2:   required from ‘static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = ECS::Entity; _Args = {ECS::World*, long unsigned int&}; _Tp = ECS::Entity; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<ECS::Entity>]’
ECS.h:454:87:   required from here
/usr/include/c++/9.2.0/ext/new_allocator.h:145:20: error: invalid use of incomplete type ‘class ECS::Entity’
  145 |  noexcept(noexcept(::new((void *)__p)
      |                    ^~~~~~~~~~~~~~~~~~
  146 |        _Up(std::forward<_Args>(__args)...)))
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from sample.cpp:25:
ECS.h:131:8: note: forward declaration of ‘class ECS::Entity’
  131 |  class Entity;
      |        ^~~~~~

Edit:
I might fix it by putting Entitys decl. a bit higher... (above World) ...
https://github.com/abeimler/ECS/blob/6127b88e06d6e12913a81eca54971cc394a8c7c6/ECS.h

@redxdev
Copy link
Owner

redxdev commented Nov 13, 2019

If that fixes it feel free to send a PR.

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

No branches or pull requests

2 participants