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

Compilation of SimEng fails on Manjaro Linux with GCC 14.2.1 #426

Open
jandrovins opened this issue Sep 2, 2024 · 4 comments
Open

Compilation of SimEng fails on Manjaro Linux with GCC 14.2.1 #426

jandrovins opened this issue Sep 2, 2024 · 4 comments

Comments

@jandrovins
Copy link

System Description
Please provide the following as a list:

  • OS: Manjaro Linux
  • Compiler: GCC 14.2.1
  • Processor: 13th Gen Intel(R) Core(TM) i7-1365U
  • Memory: 16GiB

SimEng Version
The tip of main branch, commit 7af3bc3

SimEng CMAKE Options Used

  • -GNinja
  • -DCMAKE_INSTALL_PREFIX=$PWD/install
  • -DCMAKE_BUILD_TYPE=RelWithDebInfo

Problem Description
Compilation fails while generating: src/lib/CMakeFiles/libsimeng.dir/arch/aarch64/ExceptionHandler.cc.o

(base) vincent@vanjaro at build >:/ ninja -j 1
[1/17] Building CXX object src/lib/CMakeFiles/libsimeng.dir/arch/aarch64/ExceptionHandler.cc.o
FAILED: src/lib/CMakeFiles/libsimeng.dir/arch/aarch64/ExceptionHandler.cc.o
/usr/bin/c++ -Dlibsimeng_EXPORTS -I/home/vincent/SimEng/src/include -I/home/vincent/SimEng/build/_deps/capstone-lib-build/include -I/home/vincent/SimEng/build/_deps/capstone-lib-src/include -I/home/vincent/SimEng/src/lib -I/home/vincent/SimEng/build/src/lib -O2 -g -DNDEBUG -std=c++17 -fPIC -fno-rtti -Wall -pedantic -Werror -MD -MT src/lib/CMakeFiles/libsimeng.dir/arch/aarch64/ExceptionHandler.cc.o -MF src/lib/CMakeFiles/libsimeng.dir/arch/aarch64/ExceptionHandler.cc.o.d -o src/lib/CMakeFiles/libsimeng.dir/arch/aarch64/ExceptionHandler.cc.o -c /home/vincent/SimEng/src/lib/arch/aarch64/ExceptionHandler.cc
In file included from /home/vincent/SimEng/src/include/simeng/RegisterFileSet.hh:6,
                 from /home/vincent/SimEng/src/include/simeng/ArchitecturalRegisterFileSet.hh:3,
                 from /home/vincent/SimEng/src/include/simeng/Core.hh:7,
                 from /home/vincent/SimEng/src/include/simeng/arch/Architecture.hh:7,
                 from /home/vincent/SimEng/src/include/simeng/arch/aarch64/ExceptionHandler.hh:5,
                 from /home/vincent/SimEng/src/lib/arch/aarch64/ExceptionHandler.cc:1:
In constructor ‘simeng::RegisterValue::RegisterValue(simeng::RegisterValue&&)’,
    inlined from ‘void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = simeng::RegisterValue; _Args = {simeng::RegisterValue}; _Tp = simeng::RegisterValue]’ at /usr/include/c++/14.2.1/bits/new_allocator.h:191:4,
    inlined from ‘static void std::allocator_traits<std::allocator<_Tp1> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = simeng::RegisterValue; _Args = {simeng::RegisterValue}; _Tp = simeng::RegisterValue]’ at /usr/include/c++/14.2.1/bits/alloc_traits.h:534:17,
    inlined from ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {simeng::RegisterValue}; _Tp = simeng::RegisterValue; _Alloc = std::allocator<simeng::RegisterValue>]’ at /usr/include/c++/14.2.1/bits/vector.tcc:117:30,
    inlined from ‘void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = simeng::RegisterValue; _Alloc = std::allocator<simeng::RegisterValue>]’ at /usr/include/c++/14.2.1/bits/stl_vector.h:1301:21,
    inlined from ‘simeng::arch::aarch64::ExceptionHandler::init()::<lambda(auto:35)> [with auto:35 = long unsigned int]’ at /home/vincent/SimEng/src/lib/arch/aarch64/ExceptionHandler.cc:340:74:
/home/vincent/SimEng/src/include/simeng/RegisterValue.hh:20:7: error: ‘<unnamed>.simeng::RegisterValue::value’ may be used uninitialized [-Werror=maybe-uninitialized]
   20 | class RegisterValue {
      |       ^~~~~~~~~~~~~
/home/vincent/SimEng/src/lib/arch/aarch64/ExceptionHandler.cc: In function ‘simeng::arch::aarch64::ExceptionHandler::init()::<lambda(auto:35)> [with auto:35 = long unsigned int]’:
/home/vincent/SimEng/src/lib/arch/aarch64/ExceptionHandler.cc:340:74: note: ‘<anonymous>’ declared here
  340 |                                 stateChange.memoryAddressValues.push_back(
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  341 |                                     {statOut, sizeof(statOut)});
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~           
In constructor ‘simeng::RegisterValue::RegisterValue(simeng::RegisterValue&&)’,
    inlined from ‘void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = simeng::RegisterValue; _Args = {simeng::RegisterValue}; _Tp = simeng::RegisterValue]’ at /usr/include/c++/14.2.1/bits/new_allocator.h:191:4,
    inlined from ‘static void std::allocator_traits<std::allocator<_Tp1> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = simeng::RegisterValue; _Args = {simeng::RegisterValue}; _Tp = simeng::RegisterValue]’ at /usr/include/c++/14.2.1/bits/alloc_traits.h:534:17,
    inlined from ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {simeng::RegisterValue}; _Tp = simeng::RegisterValue; _Alloc = std::allocator<simeng::RegisterValue>]’ at /usr/include/c++/14.2.1/bits/vector.tcc:117:30,
    inlined from ‘void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = simeng::RegisterValue; _Alloc = std::allocator<simeng::RegisterValue>]’ at /usr/include/c++/14.2.1/bits/stl_vector.h:1301:21,
    inlined from ‘bool simeng::arch::aarch64::ExceptionHandler::init()’ at /home/vincent/SimEng/src/lib/arch/aarch64/ExceptionHandler.cc:689:30:
/home/vincent/SimEng/src/include/simeng/RegisterValue.hh:20:7: error: ‘<unnamed>.simeng::RegisterValue::value’ may be used uninitialized [-Werror=maybe-uninitialized]
   20 | class RegisterValue {
      |       ^~~~~~~~~~~~~
/home/vincent/SimEng/src/lib/arch/aarch64/ExceptionHandler.cc: In member function ‘bool simeng::arch::aarch64::ExceptionHandler::init()’:
/home/vincent/SimEng/src/lib/arch/aarch64/ExceptionHandler.cc:689:51: note: ‘<anonymous>’ declared here
  689 |           regValues.push_back(RegisterValue(0, 256));
      |                                                   ^
In constructor ‘simeng::RegisterValue::RegisterValue(simeng::RegisterValue&&)’,
    inlined from ‘void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = simeng::RegisterValue; _Args = {simeng::RegisterValue}; _Tp = simeng::RegisterValue]’ at /usr/include/c++/14.2.1/bits/new_allocator.h:191:4,
    inlined from ‘static void std::allocator_traits<std::allocator<_Tp1> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = simeng::RegisterValue; _Args = {simeng::RegisterValue}; _Tp = simeng::RegisterValue]’ at /usr/include/c++/14.2.1/bits/alloc_traits.h:534:17,
    inlined from ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {simeng::RegisterValue}; _Tp = simeng::RegisterValue; _Alloc = std::allocator<simeng::RegisterValue>]’ at /usr/include/c++/14.2.1/bits/vector.tcc:117:30,
    inlined from ‘void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = simeng::RegisterValue; _Alloc = std::allocator<simeng::RegisterValue>]’ at /usr/include/c++/14.2.1/bits/stl_vector.h:1301:21,
    inlined from ‘bool simeng::arch::aarch64::ExceptionHandler::init()’ at /home/vincent/SimEng/src/lib/arch/aarch64/ExceptionHandler.cc:700:30:
/home/vincent/SimEng/src/include/simeng/RegisterValue.hh:20:7: error: ‘<unnamed>.simeng::RegisterValue::value’ may be used uninitialized [-Werror=maybe-uninitialized]
   20 | class RegisterValue {
      |       ^~~~~~~~~~~~~
/home/vincent/SimEng/src/lib/arch/aarch64/ExceptionHandler.cc: In member function ‘bool simeng::arch::aarch64::ExceptionHandler::init()’:
/home/vincent/SimEng/src/lib/arch/aarch64/ExceptionHandler.cc:700:51: note: ‘<anonymous>’ declared here
  700 |           regValues.push_back(RegisterValue(0, 256));
      |                                                   ^
In constructor ‘simeng::RegisterValue::RegisterValue(simeng::RegisterValue&&)’,
    inlined from ‘void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = simeng::RegisterValue; _Args = {simeng::RegisterValue}; _Tp = simeng::RegisterValue]’ at /usr/include/c++/14.2.1/bits/new_allocator.h:191:4,
    inlined from ‘static void std::allocator_traits<std::allocator<_Tp1> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = simeng::RegisterValue; _Args = {simeng::RegisterValue}; _Tp = simeng::RegisterValue]’ at /usr/include/c++/14.2.1/bits/alloc_traits.h:534:17,
    inlined from ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {simeng::RegisterValue}; _Tp = simeng::RegisterValue; _Alloc = std::allocator<simeng::RegisterValue>]’ at /usr/include/c++/14.2.1/bits/vector.tcc:117:30,
    inlined from ‘void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = simeng::RegisterValue; _Alloc = std::allocator<simeng::RegisterValue>]’ at /usr/include/c++/14.2.1/bits/stl_vector.h:1301:21,
    inlined from ‘bool simeng::arch::aarch64::ExceptionHandler::init()’ at /home/vincent/SimEng/src/lib/arch/aarch64/ExceptionHandler.cc:703:32:
/home/vincent/SimEng/src/include/simeng/RegisterValue.hh:20:7: error: ‘<unnamed>.simeng::RegisterValue::value’ may be used uninitialized [-Werror=maybe-uninitialized]
   20 | class RegisterValue {
      |       ^~~~~~~~~~~~~
/home/vincent/SimEng/src/lib/arch/aarch64/ExceptionHandler.cc: In member function ‘bool simeng::arch::aarch64::ExceptionHandler::init()’:
/home/vincent/SimEng/src/lib/arch/aarch64/ExceptionHandler.cc:703:52: note: ‘<anonymous>’ declared here
  703 |             regValues.push_back(RegisterValue(0, 32));
      |                                                    ^
cc1plus: all warnings being treated as errors
ninja: build stopped: subcommand failed.
@jandrovins
Copy link
Author

jandrovins commented Sep 2, 2024

When I compile with clang 18.1.8, it fails on src/lib/CMakeFiles/libsimeng.dir/models/emulation/Core.cc.o with:

(base) vincent@vanjaro at build-clang >:/ ninja -j 1
[1/14] Building CXX object src/lib/CMakeFiles/libsimeng.dir/models/emulation/Core.cc.o
FAILED: src/lib/CMakeFiles/libsimeng.dir/models/emulation/Core.cc.o 
/usr/bin/clang++ -Dlibsimeng_EXPORTS -I/home/vincent/SimEng/src/include -I/home/vincent/SimEng/build-clang/_deps/capstone-lib-build/include -I/home/vincent/SimEng/build-clang/_deps/capstone-lib-src/include -I/home/vincent/SimEng/src/lib -I/home/vincent/SimEng/build-clang/src/lib -O2 -g -DNDEBUG -std=c++17 -fPIC -fno-rtti -Wall -pedantic -Werror -MD -MT src/lib/CMakeFiles/libsimeng.dir/models/emulation/Core.cc.o -MF src/lib/CMakeFiles/libsimeng.dir/models/emulation/Core.cc.o.d -o src/lib/CMakeFiles/libsimeng.dir/models/emulation/Core.cc.o -c /home/vincent/SimEng/src/lib/models/emulation/Core.cc
In file included from /home/vincent/SimEng/src/lib/models/emulation/Core.cc:1:
In file included from /home/vincent/SimEng/src/include/simeng/models/emulation/Core.hh:7:
In file included from /home/vincent/SimEng/src/include/simeng/ArchitecturalRegisterFileSet.hh:3:
In file included from /home/vincent/SimEng/src/include/simeng/RegisterFileSet.hh:5:
/home/vincent/SimEng/src/include/simeng/Register.hh:10:3: error: unknown type name 'uint8_t'
   10 |   uint8_t type;
      |   ^
/home/vincent/SimEng/src/include/simeng/Register.hh:14:3: error: unknown type name 'uint16_t'
   14 |   uint16_t tag;
      |   ^
In file included from /home/vincent/SimEng/src/lib/models/emulation/Core.cc:1:
In file included from /home/vincent/SimEng/src/include/simeng/models/emulation/Core.hh:8:
In file included from /home/vincent/SimEng/src/include/simeng/Core.hh:9:
In file included from /home/vincent/SimEng/src/include/simeng/config/SimInfo.hh:8:
In file included from /home/vincent/SimEng/src/include/simeng/arch/aarch64/ArchInfo.hh:3:
In file included from /home/vincent/SimEng/src/include/simeng/arch/ArchInfo.hh:7:
/home/vincent/SimEng/src/include/simeng/config/yaml/ryml.hh:9872:5: error: 'memcpy' will always overflow; destination buffer has size 4, but size argument is 8 [-Werror,-Wfortify-source]
 9872 |     ::memcpy(&bits, &value, sizeof(T));
      |     ^
/home/vincent/SimEng/src/include/simeng/config/yaml/ryml.hh:9909:26: note: in instantiation of function template specialization 'fast_float::to_extended<double>' requested here
 9909 |   adjusted_mantissa am = to_extended(value);
      |                          ^
/home/vincent/SimEng/src/include/simeng/config/yaml/ryml.hh:10171:29: note: in instantiation of function template specialization 'fast_float::to_extended_halfway<double>' requested here
 10171 |   adjusted_mantissa theor = to_extended_halfway(b);
       |                             ^
/home/vincent/SimEng/src/include/simeng/config/yaml/ryml.hh:10235:12: note: in instantiation of function template specialization 'fast_float::negative_digit_comp<double>' requested here
 10235 |     return negative_digit_comp<T>(bigmant, am, exponent);
       |            ^
/home/vincent/SimEng/src/include/simeng/config/yaml/ryml.hh:10350:28: note: in instantiation of function template specialization 'fast_float::digit_comp<double>' requested here
 10350 |   if(am.power2 < 0) { am = digit_comp<T>(pns, am); }
       |                            ^
/home/vincent/SimEng/src/include/simeng/config/yaml/ryml.hh:10312:10: note: in instantiation of function template specialization 'fast_float::from_chars_advanced<double>' requested here
 10312 |   return from_chars_advanced(first, last, value, parse_options{fmt});
       |          ^
/home/vincent/SimEng/src/include/simeng/config/yaml/ryml.hh:12628:30: note: in instantiation of function template specialization 'fast_float::from_chars<double>' requested here
 12628 |         result = fast_float::from_chars(str.str, str.str + str.len, *v);
       |                              ^
3 errors generated.
ninja: build stopped: subcommand failed.

@FinnWilkinson
Copy link
Contributor

Please try and use the additional-sme-support branch with GCC. Clang is likely failing due to missing header files that aren't being pointed to properly at compile time

@jandrovins
Copy link
Author

The first error was solved with the new commit in additional-sme-support, but I still found errors from the unknown type name 'uint8_t. Are you sure it is failing for missing headers? I solved it with the following patch. It seems src/include/simeng/Register.hh is missing the cstdint header. With this change the clang compilation works as well:

diff --git a/src/include/simeng/Register.hh b/src/include/simeng/Register.hh
index 4b60772e..579ffae7 100644
--- a/src/include/simeng/Register.hh
+++ b/src/include/simeng/Register.hh
@@ -1,5 +1,6 @@
 #pragma once
 #include <iostream>
+#include <cstdint>
 
 namespace simeng {
 
@@ -26,4 +27,4 @@ struct Register {
   bool operator!=(const Register& other) const { return !(other == *this); }
 };
 
-}  // namespace simeng
\ No newline at end of file
+}  // namespace simeng

@FinnWilkinson
Copy link
Contributor

Thanks for letting me know. I'll add this header to Register.hh now and update the branch

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

No branches or pull requests

2 participants