0

Edit: Is this related to this bug report?

Unable to find uint8_t despite having build the freestanding libs for C++

The error I get is:

FAILED: CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o 
/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/bin/i686-elf-g++  -I/home/jared/projects/cpp_projects/NakOS/Kernel -I/home/jared/projects/cpp_projects/NakOS/Kernel/Graphics -I/home/jared/projects/cpp_projects/NakOS -g -pedantic -Wall -Wextra -Wundef -Werror -Wno-unused-parameter -ffreestanding -fno-exceptions -fno-rtti -std=gnu++20 -MD -MT CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o -MF CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o.d -o CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o -c /home/jared/projects/cpp_projects/NakOS/Kernel/src/kernel.cpp
/home/jared/projects/cpp_projects/NakOS/Kernel/src/kernel.cpp: In function 'void Kernel::kernel_main()':
/home/jared/projects/cpp_projects/NakOS/Kernel/src/kernel.cpp:6:5: error: 'uint8_t' was not declared in this scope
    6 |     uint8_t a;
      |     ^~~~~~~
/home/jared/projects/cpp_projects/NakOS/Kernel/src/kernel.cpp:3:1: note: 'uint8_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
    2 | #include <cstdint>
  +++ |+#include <cstdint>
    3 | 

Which seems like an easy fix, just add #include <cstdint>, but my file looks like:

#include "inc/kernel.hpp"
#include <cstdint>

void Kernel::kernel_main()
{
    uint8_t a;
    // nak::print
    // nak::input();
}

Which is aggrevating. I know I have the library itself because I see it in my toolchain:

$ find . -name cstdint
./Toolchain/src/gcc-12.2.0/libstdc++-v3/include/tr1/cstdint
./Toolchain/src/gcc-12.2.0/libstdc++-v3/include/c_global/cstdint
./Toolchain/src/gcc-12.2.0/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdint
./Toolchain/src/gcc-12.2.0/libstdc++-v3/testsuite/18_support/headers/cstdint
./Toolchain/src/build-gcc/i686-elf/libstdc++-v3/include/tr1/cstdint
./Toolchain/src/build-gcc/i686-elf/libstdc++-v3/include/cstdint
./Toolchain/opt/cross/i686-elf/include/c++/12.2.0/cstdint

And my Toolchain file Toolchain/os-dev-toolchain.cmake looks like:

set(CMAKE_C_COMPILER_WORKS 1)   # Skip Test because we are in a free-standing environment
set(CMAKE_CXX_COMPILER_WORKS 1) # Skip Test because we are in a free-standing environment
set(CMAKE_SYSTEM_PROCESSOR i686)
set(CMAKE_CXX_COMPILER ${CMAKE_SOURCE_DIR}/Toolchain/opt/cross/bin/i686-elf-gcc)
set(CMAKE_CXX_COMPILER ${CMAKE_SOURCE_DIR}/Toolchain/opt/cross/bin/i686-elf-g++)

And this is how I compile (These arguments are generated with CMake)

/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/bin/i686-elf-g++  -I/home/jared/projects/cpp_projects/NakOS/Kernel -I/home/jared/projects/cpp_projects/NakOS/Kernel/Graphics -I/home/jared/projects/cpp_projects/NakOS -g -pedanti
c -Wall -Wextra -Wundef -Werror -Wno-unused-parameter -ffreestanding -fno-exceptions -fno-rtti -std=gnu++20 -MD -MT CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o -MF CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o.d -o CMakeFiles/nak.dir/Kernel/s
rc/kernel.cpp.o -c /home/jared/projects/cpp_projects/NakOS/Kernel/src/kernel.cpp

So, you see that I'm building with my crosscompiler as per my first argument

/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/bin/i686-elf-g++

I have tried setting sysroot to my toolcahin with:

set(CMAKE_SYSROOT ${CMAKE_SOURCE_DIR}/Toolchain/) # Setting sysroot
set(CMAKE_C_COMPILER_WORKS 1)   # Skip Test because we are in a free-standing environment
set(CMAKE_CXX_COMPILER_WORKS 1) # Skip Test because we are in a free-standing environment
set(CMAKE_SYSTEM_PROCESSOR i686)
set(CMAKE_CXX_COMPILER ${CMAKE_SOURCE_DIR}/Toolchain/opt/cross/bin/i686-elf-gcc)
set(CMAKE_CXX_COMPILER ${CMAKE_SOURCE_DIR}/Toolchain/opt/cross/bin/i686-elf-g++)

but no cigar.

Edit:

I have tried std::uint8_t but that also doesn't work. I got the following error when using that

[1/2] Building CXX object CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o
FAILED: CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o 
/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/bin/i686-elf-g++ --sysroot=/home/jared/projects/cpp_projects/NakOS/Toolchain/  -I/home/jared/projects/cpp_projects/NakOS/Kernel -I/home/jared/projects/cpp_projects/NakOS/Kernel/Graphics -I/home/jared/projects/cpp_projects/NakOS -g -pedantic -Wall -Wextra -Wundef -Werror -Wno-unused-parameter -ffreestanding -fno-exceptions -fno-rtti -std=gnu++20 -MD -MT CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o -MF CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o.d -o CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o -c /home/jared/projects/cpp_projects/NakOS/Kernel/src/kernel.cpp
/home/jared/projects/cpp_projects/NakOS/Kernel/src/kernel.cpp: In function 'void Kernel::kernel_main()':
/home/jared/projects/cpp_projects/NakOS/Kernel/src/kernel.cpp:6:10: error: 'uint8_t' is not a member of 'std'; did you mean 'uintmax_t'?
    6 |     std::uint8_t a;
      |          ^~~~~~~
      |          uintmax_t
ninja: build stopped: subcommand failed.

Edit: Adding -v option

Here is the output when I add -v

[1/4] Building ASM object CMakeFiles/nak.dir/Kernel/Boot/boot.s.o
Using built-in specs.
COLLECT_GCC=/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/bin/i686-elf-g++
Target: i686-elf
Configured with: ../gcc-12.2.0/configure --target=i686-elf --prefix=/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross --disable-nls --enable-languages=c,c++ --without-headers --disable-hosted-libstdcxx
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (GCC) 
COLLECT_GCC_OPTIONS='--sysroot=/home/jared/projects/cpp_projects/NakOS/Toolchain/' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel/Graphics' '-I' '/home/jared/projects/cpp_projects/NakOS' '-g' '-Wpedantic' '-Wall' '-Wextra' '-Wundef' '-Werror' '-ffreestanding' '-fno-exceptions' '-fno-rtti' '-Wno-unused' '-Wno-unused-paramete' '-v' '-MD' '-MT' 'CMakeFiles/nak.dir/Kernel/Boot/boot.s.o' '-MF' 'CMakeFiles/nak.dir/Kernel/Boot/boot.s.o.d' '-o' 'CMakeFiles/nak.dir/Kernel/Boot/boot.s.o' '-c' '-mtune=generic' '-march=pentiumpro' '-dumpdir' 'CMakeFiles/nak.dir/Kernel/Boot/'
 /home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/as --gdwarf-5 -o CMakeFiles/nak.dir/Kernel/Boot/boot.s.o /home/jared/projects/cpp_projects/NakOS/Kernel/Boot/boot.s
COMPILER_PATH=/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/libexec/gcc/i686-elf/12.2.0/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/libexec/gcc/i686-elf/12.2.0/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/libexec/gcc/i686-elf/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/
LIBRARY_PATH=/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/lib/
COLLECT_GCC_OPTIONS='--sysroot=/home/jared/projects/cpp_projects/NakOS/Toolchain/' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel/Graphics' '-I' '/home/jared/projects/cpp_projects/NakOS' '-g' '-Wpedantic' '-Wall' '-Wextra' '-Wundef' '-Werror' '-ffreestanding' '-fno-exceptions' '-fno-rtti' '-Wno-unused' '-Wno-unused-paramete' '-v' '-MD' '-MT' 'CMakeFiles/nak.dir/Kernel/Boot/boot.s.o' '-MF' 'CMakeFiles/nak.dir/Kernel/Boot/boot.s.o.d' '-o' 'CMakeFiles/nak.dir/Kernel/Boot/boot.s.o' '-c' '-mtune=generic' '-march=pentiumpro' '-dumpdir' 'CMakeFiles/nak.dir/Kernel/Boot/boot.s.'
[2/4] Building CXX object CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o
FAILED: CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o 
/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/bin/i686-elf-g++ --sysroot=/home/jared/projects/cpp_projects/NakOS/Toolchain/  -I/home/jared/projects/cpp_projects/NakOS/Kernel -I/home/jared/projects/cpp_projects/NakOS/Kernel/Graphics -I/home/jared/projects/cpp_projects/NakOS -g -pedantic -Wall -Wextra -Wundef -Werror -ffreestanding -fno-exceptions -fno-rtti -Wno-unused -Wno-unused-paramete -v -std=gnu++20 -MD -MT CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o -MF CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o.d -o CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o -c /home/jared/projects/cpp_projects/NakOS/Kernel/src/kernel.cpp
Using built-in specs.
COLLECT_GCC=/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/bin/i686-elf-g++
Target: i686-elf
Configured with: ../gcc-12.2.0/configure --target=i686-elf --prefix=/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross --disable-nls --enable-languages=c,c++ --without-headers --disable-hosted-libstdcxx
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (GCC) 
COLLECT_GCC_OPTIONS='--sysroot=/home/jared/projects/cpp_projects/NakOS/Toolchain/' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel/Graphics' '-I' '/home/jared/projects/cpp_projects/NakOS' '-g' '-Wpedantic' '-Wall' '-Wextra' '-Wundef' '-Werror' '-ffreestanding' '-fno-exceptions' '-fno-rtti' '-Wno-unused' '-Wno-unused-paramete' '-v' '-std=gnu++20' '-MD' '-MT' 'CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o' '-MF' 'CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o.d' '-o' 'CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o' '-c' '-mtune=generic' '-march=pentiumpro' '-dumpdir' 'CMakeFiles/nak.dir/Kernel/src/'
 /home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/libexec/gcc/i686-elf/12.2.0/cc1plus -quiet -v -I /home/jared/projects/cpp_projects/NakOS/Kernel -I /home/jared/projects/cpp_projects/NakOS/Kernel/Graphics -I /home/jared/projects/cpp_projects/NakOS -isysroot /home/jared/projects/cpp_projects/NakOS/Toolchain/ -MD CMakeFiles/nak.dir/Kernel/src/kernel.cpp.d -MF CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o.d -MT CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o /home/jared/projects/cpp_projects/NakOS/Kernel/src/kernel.cpp -quiet -dumpdir CMakeFiles/nak.dir/Kernel/src/ -dumpbase kernel.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=pentiumpro -g -Wpedantic -Wall -Wextra -Wundef -Werror -Wno-unused -Wno-unused-paramete -std=gnu++20 -version -ffreestanding -fno-exceptions -fno-rtti -o /tmp/ccto5YvD.s
GNU C++20 (GCC) version 12.2.0 (i686-elf)
    compiled by GNU C version 12.1.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/include/c++/12.2.0/backward"
ignoring nonexistent directory "/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/sys-include"
#include "..." search starts here:
#include <...> search starts here:
 /home/jared/projects/cpp_projects/NakOS/Kernel
 /home/jared/projects/cpp_projects/NakOS/Kernel/Graphics
 /home/jared/projects/cpp_projects/NakOS
 /home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/include/c++/12.2.0
 /home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/include/c++/12.2.0/i686-elf
 /home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/include
 /home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/include-fixed
 /home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/include
End of search list.
GNU C++20 (GCC) version 12.2.0 (i686-elf)
    compiled by GNU C version 12.1.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: e95d08dad55d43cf316cec657b32d864
/home/jared/projects/cpp_projects/NakOS/Kernel/src/kernel.cpp: In function 'void Kernel::kernel_main()':
/home/jared/projects/cpp_projects/NakOS/Kernel/src/kernel.cpp:6:5: error: 'uint8_t' was not declared in this scope
    6 |     uint8_t a;
      |     ^~~~~~~
/home/jared/projects/cpp_projects/NakOS/Kernel/src/kernel.cpp:3:1: note: 'uint8_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
    2 | #include "inc/kernel.hpp"
  +++ |+#include <cstdint>
    3 | 
At global scope:
cc1plus: note: unrecognized command-line option '-Wno-unused-paramete' may have been intended to silence earlier diagnostics
[3/4] Building CXX object CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.o
Using built-in specs.
COLLECT_GCC=/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/bin/i686-elf-g++
Target: i686-elf
Configured with: ../gcc-12.2.0/configure --target=i686-elf --prefix=/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross --disable-nls --enable-languages=c,c++ --without-headers --disable-hosted-libstdcxx
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (GCC) 
COLLECT_GCC_OPTIONS='--sysroot=/home/jared/projects/cpp_projects/NakOS/Toolchain/' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel/Graphics' '-I' '/home/jared/projects/cpp_projects/NakOS' '-g' '-Wpedantic' '-Wall' '-Wextra' '-Wundef' '-Werror' '-ffreestanding' '-fno-exceptions' '-fno-rtti' '-Wno-unused' '-Wno-unused-paramete' '-v' '-std=gnu++20' '-MD' '-MT' 'CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.o' '-MF' 'CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.o.d' '-o' 'CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.o' '-c' '-mtune=generic' '-march=pentiumpro' '-dumpdir' 'CMakeFiles/nak.dir/Kernel/Graphics/src/'
 /home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/libexec/gcc/i686-elf/12.2.0/cc1plus -quiet -v -I /home/jared/projects/cpp_projects/NakOS/Kernel -I /home/jared/projects/cpp_projects/NakOS/Kernel/Graphics -I /home/jared/projects/cpp_projects/NakOS -isysroot /home/jared/projects/cpp_projects/NakOS/Toolchain/ -MD CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.d -MF CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.o.d -MT CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.o /home/jared/projects/cpp_projects/NakOS/Kernel/Graphics/src/Graphics.cpp -quiet -dumpdir CMakeFiles/nak.dir/Kernel/Graphics/src/ -dumpbase Graphics.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=pentiumpro -g -Wpedantic -Wall -Wextra -Wundef -Werror -Wno-unused -Wno-unused-paramete -std=gnu++20 -version -ffreestanding -fno-exceptions -fno-rtti -o /tmp/cc1NWvPQ.s
GNU C++20 (GCC) version 12.2.0 (i686-elf)
    compiled by GNU C version 12.1.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/include/c++/12.2.0/backward"
ignoring nonexistent directory "/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/sys-include"
#include "..." search starts here:
#include <...> search starts here:
 /home/jared/projects/cpp_projects/NakOS/Kernel
 /home/jared/projects/cpp_projects/NakOS/Kernel/Graphics
 /home/jared/projects/cpp_projects/NakOS
 /home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/include/c++/12.2.0
 /home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/include/c++/12.2.0/i686-elf
 /home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/include
 /home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/include-fixed
 /home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/include
End of search list.
GNU C++20 (GCC) version 12.2.0 (i686-elf)
    compiled by GNU C version 12.1.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: e95d08dad55d43cf316cec657b32d864
COLLECT_GCC_OPTIONS='--sysroot=/home/jared/projects/cpp_projects/NakOS/Toolchain/' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel/Graphics' '-I' '/home/jared/projects/cpp_projects/NakOS' '-g' '-Wpedantic' '-Wall' '-Wextra' '-Wundef' '-Werror' '-ffreestanding' '-fno-exceptions' '-fno-rtti' '-Wno-unused' '-Wno-unused-paramete' '-v' '-std=gnu++20' '-MD' '-MT' 'CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.o' '-MF' 'CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.o.d' '-o' 'CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.o' '-c' '-mtune=generic' '-march=pentiumpro' '-dumpdir' 'CMakeFiles/nak.dir/Kernel/Graphics/src/'
 /home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/as --gdwarf-5 -o CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.o /tmp/cc1NWvPQ.s
COMPILER_PATH=/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/libexec/gcc/i686-elf/12.2.0/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/libexec/gcc/i686-elf/12.2.0/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/libexec/gcc/i686-elf/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/
LIBRARY_PATH=/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/lib/
COLLECT_GCC_OPTIONS='--sysroot=/home/jared/projects/cpp_projects/NakOS/Toolchain/' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel/Graphics' '-I' '/home/jared/projects/cpp_projects/NakOS' '-g' '-Wpedantic' '-Wall' '-Wextra' '-Wundef' '-Werror' '-ffreestanding' '-fno-exceptions' '-fno-rtti' '-Wno-unused' '-Wno-unused-paramete' '-v' '-std=gnu++20' '-MD' '-MT' 'CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.o' '-MF' 'CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.o.d' '-o' 'CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.o' '-c' '-mtune=generic' '-march=pentiumpro' '-dumpdir' 'CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.'
ninja: build stopped: subcommand failed.

Edit: Here is -E and -dM

Using built-in specs.
COLLECT_GCC=/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/bin/i686-elf-g++
Target: i686-elf
Configured with: ../gcc-12.2.0/configure --target=i686-elf --prefix=/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross --disable-nls --enable-languages=c,c++ --without-headers --disable-hosted-libstdcxx
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (GCC) 
COLLECT_GCC_OPTIONS='--sysroot=/home/jared/projects/cpp_projects/NakOS/Toolchain/' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel/Graphics' '-I' '/home/jared/projects/cpp_projects/NakOS' '-g' '-Wpedantic' '-Wall' '-Wextra' '-Wundef' '-Werror' '-ffreestanding' '-fno-exceptions' '-fno-rtti' '-Wno-unused' '-Wno-unused-paramete' '-v' '-E' '-dM' '-MD' '-MT' 'CMakeFiles/nak.dir/Kernel/Boot/boot.s.o' '-MF' 'CMakeFiles/nak.dir/Kernel/Boot/boot.s.o.d' '-o' 'CMakeFiles/nak.dir/Kernel/Boot/boot.s.o' '-c' '-mtune=generic' '-march=pentiumpro' '-dumpdir' 'CMakeFiles/nak.dir/Kernel/Boot/'
COMPILER_PATH=/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/libexec/gcc/i686-elf/12.2.0/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/libexec/gcc/i686-elf/12.2.0/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/libexec/gcc/i686-elf/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/
LIBRARY_PATH=/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/:/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/lib/
COLLECT_GCC_OPTIONS='--sysroot=/home/jared/projects/cpp_projects/NakOS/Toolchain/' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel' '-I' '/home/jared/projects/cpp_projects/NakOS/Kernel/Graphics' '-I' '/home/jared/projects/cpp_projects/NakOS' '-g' '-Wpedantic' '-Wall' '-Wextra' '-Wundef' '-Werror' '-ffreestanding' '-fno-exceptions' '-fno-rtti' '-Wno-unused' '-Wno-unused-paramete' '-v' '-E' '-dM' '-MD' '-MT' 'CMakeFiles/nak.dir/Kernel/Boot/boot.s.o' '-MF' 'CMakeFiles/nak.dir/Kernel/Boot/boot.s.o.d' '-o' 'CMakeFiles/nak.dir/Kernel/Boot/boot.s.o' '-c' '-mtune=generic' '-march=pentiumpro' '-dumpdir' 'CMakeFiles/nak.dir/Kernel/Boot/boot.s.'
[2/2] Linking CXX executable nak
FAILED: nak 
: && /home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/bin/i686-elf-g++ --sysroot=/home/jared/projects/cpp_projects/NakOS/Toolchain/ -g -ffreestanding -nostdlib -Wl,-T/home/jared/projects/cpp_projects/NakOS/Kernel/Boot/loader.ld CMakeFiles/nak.dir/Kernel/Boot/boot.s.o CMakeFiles/nak.dir/Kernel/src/kernel.cpp.o CMakeFiles/nak.dir/Kernel/Graphics/src/Graphics.cpp.o -o nak   && :
/home/jared/projects/cpp_projects/NakOS/Toolchain/opt/cross/lib/gcc/i686-elf/12.2.0/../../../../i686-elf/bin/ld: cannot find CMakeFiles/nak.dir/Kernel/Boot/boot.s.o: No such file or directory
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Edit: Contents of ./Toolchain/src/gcc-12.2.0/libstdc++-v3/include/c_global/cstdint

// <cstdint> -*- C++ -*-

// Copyright (C) 2007-2022 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file include/cstdint
 *  This is a Standard C++ Library header.
 */

#ifndef _GLIBCXX_CSTDINT
#define _GLIBCXX_CSTDINT 1

#pragma GCC system_header

#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else

#include <bits/c++config.h>

#if _GLIBCXX_HAVE_STDINT_H
# include <stdint.h>
#endif

namespace std
{
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
  using ::int8_t;
  using ::int16_t;
  using ::int32_t;
  using ::int64_t;

  using ::int_fast8_t;
  using ::int_fast16_t;
  using ::int_fast32_t;
  using ::int_fast64_t;

  using ::int_least8_t;
  using ::int_least16_t;
  using ::int_least32_t;
  using ::int_least64_t;

  using ::intmax_t;
  using ::intptr_t;
  
  using ::uint8_t;
  using ::uint16_t;
  using ::uint32_t;
  using ::uint64_t;

  using ::uint_fast8_t;
  using ::uint_fast16_t;
  using ::uint_fast32_t;
  using ::uint_fast64_t;

  using ::uint_least8_t;
  using ::uint_least16_t;
  using ::uint_least32_t;
  using ::uint_least64_t;

  using ::uintmax_t;
  using ::uintptr_t;
#else // !_GLIBCXX_USE_C99_STDINT_TR1
  // Define the minimum needed for <ratio>, <chrono> etc.
  using intmax_t = __INTMAX_TYPE__;
  using uintmax_t = __UINTMAX_TYPE__;
#endif // _GLIBCXX_USE_C99_STDINT_TR1
} // namespace std

#endif // C++11

#endif // _GLIBCXX_CSTDINT
Happy Jerry
  • 164
  • 1
  • 8
  • That's not the error message; it's the compiler's guess about useful information related to the error message. What's the actual error message, and the actual code you were compiling? – Sneftel Jan 25 '23 at 16:48
  • Maybe change `uint8_t` to `std::uint8_t`? – Eljay Jan 25 '23 at 17:10
  • @Sneftel I had accidentally omitted the error. The post is updated to include the error? – Happy Jerry Jan 25 '23 at 18:09
  • @Eljay I have tried that earlier, but no luck. – Happy Jerry Jan 25 '23 at 18:10
  • Try `#include ` The present SDK's cstdint may be empty. – 273K Jan 25 '23 at 18:17
  • Why wouldn't `` work when it's part of the free standing libraries seen here [here](https://en.cppreference.com/w/cpp/header/cstdint") – Happy Jerry Jan 25 '23 at 18:20
  • How about `find . -name stdin.h` ? – KamilCuk Jan 25 '23 at 18:23
  • @KamilCuk I have `stdint.h` and it works fine with that. It's just that I'm curious as to why ` does not work. – Happy Jerry Jan 25 '23 at 18:30
  • Please post the output of `gcc -E` or `gcc -v` when compiling the file. Which `cstdin` is for compilation? See it's sources. What is in `cat ./Toolchain/src/gcc-12.2.0/libstdc++-v3/include/c_global/cstdint` and the other oe? https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/c_global/cstdint#L50 -> is _GLIBCXX_HOSTED defined? _GLIBCXX_USE_C99_STDINT_TR1 ? `#if __has_include()` returns true? What is the output of `...g++ -E -dM - – KamilCuk Jan 25 '23 at 18:34
  • @KamilCuk I added those options and added the contents of that file in the original post. – Happy Jerry Jan 25 '23 at 18:47
  • c_global/cstdint is odd, found this https://github.com/gcc-mirror/gcc/commit/7cdab65f3d770345903023f357b6ca96bc85a002 . `-E and -dM` Ugh, that didn't work, it should list all compiler macros. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107134 looks related . If `_GLIBCXX_HAVE_STDINT_H` defined? Please add `#if _GLIBCXX_HAVE_STDINT_H #error #endif` and see if you get the error? What happens if you do `#include ` from C++ ? – KamilCuk Jan 25 '23 at 18:50
  • @KamilCuk That probably won't work as I'm in a freestanding environment. But I'll add it. – Happy Jerry Jan 25 '23 at 18:56
  • Then you can follow what happens. Because `#if _GLIBCXX_HAVE_STDINT_H # include ` the file is not included and you get no basic files. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107134 Has the fixes – KamilCuk Jan 25 '23 at 18:57

1 Answers1

1

This is a bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107134 , but in this case, you do not have _GLIBCXX_HAVE_STDINT_H so stdint.h is not included at all, so there are no symbols at all. You can follow this fix https://github.com/gcc-mirror/gcc/commit/7cdab65f3d770345903023f357b6ca96bc85a002 which adds the symbols to cstdint.

KamilCuk
  • 120,984
  • 8
  • 59
  • 111