cppfastio / fast_io

Freestanding fast input/output for C++20
MIT License
630 stars 52 forks source link

A lot of cmake #779

Closed Arniiiii closed 1 month ago

Arniiiii commented 1 month ago

Sorry, but could you explain what is wrong in the first place?

trcrsired commented 1 month ago

Sorry, but could you explain what is wrong in the first place?

what's wrong?

  1. Why do you change cmake?
  2. You cannot add includes in those headers. That greatly hurts compilation speed. Also std::is_floating_point is wrong. It must be std::floating_point. That is a concept.

I just feel you have nothing to do but try to screw this project

Arniiiii commented 1 month ago

Sorry, but could you explain what is wrong in the first place?

what's wrong?

2. You cannot add includes in those headers. That greatly hurts compilation speed.
   Also std::is_floating_point is wrong. It must be std::floating_point. That is a concept.

I've removed all stuff from include folder via last commit

trcrsired commented 1 month ago

i still don't understand why you want these changes.

Arniiiii commented 1 month ago
1. Why do you change cmake?

Because I wanted to make the project usable by just downloading it and add_subdirectory(...) Also to be able compile tests and all other stuff to confirm the quality of code is ok.

I just feel you have nothing to do but try to screw this project

Sorry if I made you feel this. I do not have such intent

trcrsired commented 1 month ago
1. Why do you change cmake?

Because I wanted to make the project usable by just downloading it and add_subdirectory(...) Also to be able compile tests and all other stuff to confirm the quality of code is ok.

I just feel you have nothing to do but try to screw this project

Sorry if I made you feel this. I do not have such intent

You just include the headers. This is a header-only library.

trcrsired commented 1 month ago

Sorry, but could you explain what is wrong in the first place?

what's wrong?

2. You cannot add includes in those headers. That greatly hurts compilation speed.
   Also std::is_floating_point is wrong. It must be std::floating_point. That is a concept.

I've removed all stuff from include folder via last commit

then first rebase it since I have no idea what you are doing

Arniiiii commented 1 month ago

Sorry, but could you explain what is wrong in the first place?

what's wrong?

2. You cannot add includes in those headers. That greatly hurts compilation speed.
   Also std::is_floating_point is wrong. It must be std::floating_point. That is a concept.

I've removed all stuff from include folder via last commit

then first rebase it since I have no idea what you are doing

ok, I'll try rebase

Arniiiii commented 1 month ago
1. Why do you change cmake?

Because I wanted to make the project usable by just downloading it and add_subdirectory(...) Also to be able compile tests and all other stuff to confirm the quality of code is ok.

I just feel you have nothing to do but try to screw this project

Sorry if I made you feel this. I do not have such intent

You just include the headers. This is a header-only library.

You are kinda right, though idk how automagically compile tests and so on easily. Also, there's now target that you can use from cmake like target_link_library(my_target PRIVATE fast_io)

trcrsired commented 1 month ago
1. Why do you change cmake?

Because I wanted to make the project usable by just downloading it and add_subdirectory(...) Also to be able compile tests and all other stuff to confirm the quality of code is ok.

I just feel you have nothing to do but try to screw this project

Sorry if I made you feel this. I do not have such intent

You just include the headers. This is a header-only library.

You are kinda right, though idk how automagically compile tests and so on easily. Also, there's now target that you can use from cmake like target_link_library(my_target PRIVATE fast_io)

These tests are not supposed to be run automatically. This library is a freestanding library. Why would it have stupid dependencies like Qt, etc?

Arniiiii commented 1 month ago
1. Why do you change cmake?

Because I wanted to make the project usable by just downloading it and add_subdirectory(...) Also to be able compile tests and all other stuff to confirm the quality of code is ok.

I just feel you have nothing to do but try to screw this project

Sorry if I made you feel this. I do not have such intent

You just include the headers. This is a header-only library.

You are kinda right, though idk how automagically compile tests and so on easily. Also, there's now target that you can use from cmake like target_link_library(my_target PRIVATE fast_io)

These tests are not supposed to be run automatically. This library is a freestanding library. Why would it have stupid dependencies like Qt etc?

It doesn't have such dependencies. There's an example which builds only and only if there's qt5 or qt6 on a system. The lib doesn't link such dependencies.

trcrsired commented 1 month ago
1. Why do you change cmake?

Because I wanted to make the project usable by just downloading it and add_subdirectory(...) Also to be able compile tests and all other stuff to confirm the quality of code is ok.

I just feel you have nothing to do but try to screw this project

Sorry if I made you feel this. I do not have such intent

You just include the headers. This is a header-only library.

You are kinda right, though idk how automagically compile tests and so on easily. Also, there's now target that you can use from cmake like target_link_library(my_target PRIVATE fast_io)

These tests are not supposed to be run automatically. This library is a freestanding library. Why would it have stupid dependencies like Qt etc?

It doesn't have such dependencies. There's an example which builds only and only if there's qt5 or qt6 on a system. The lib doesn't link such dependencies.

Still that does not mean it needs to add into test etc. ok? There is a lot of things in the library you cannot test. One example includes Linux kernel module. An mini operating system. Windows Kernel drivers. How could you run these tests?

trcrsired commented 1 month ago

Also the correct way to use C++ libraries is to install them in the sysroot, not this build system crap. If you do not know how to build Canadian compilers, you really should not use C++.

Arniiiii commented 1 month ago
1. Why do you change cmake?

Because I wanted to make the project usable by just downloading it and add_subdirectory(...) Also to be able compile tests and all other stuff to confirm the quality of code is ok.

I just feel you have nothing to do but try to screw this project

Sorry if I made you feel this. I do not have such intent

You just include the headers. This is a header-only library.

You are kinda right, though idk how automagically compile tests and so on easily. Also, there's now target that you can use from cmake like target_link_library(my_target PRIVATE fast_io)

These tests are not supposed to be run automatically. This library is a freestanding library. Why would it have stupid dependencies like Qt etc?

It doesn't have such dependencies. There's an example which builds only and only if there's qt5 or qt6 on a system. The lib doesn't link such dependencies.

Still that does not mean it needs to add into test etc. ok?

So, you say those examples shouldn't link qt, or that those example shouldn't be build automatically in the first place?

There is a lot of things in the library you cannot test.

If we can test most parts, that's already a win situation

One example includes Linux kernel module. An mini operating system. Windows Kernel drivers. How could you run these tests?

I guess at least we can build them. Therefore those are not tests but examples.

trcrsired commented 1 month ago
1. Why do you change cmake?

Because I wanted to make the project usable by just downloading it and add_subdirectory(...) Also to be able compile tests and all other stuff to confirm the quality of code is ok.

I just feel you have nothing to do but try to screw this project

Sorry if I made you feel this. I do not have such intent

You just include the headers. This is a header-only library.

You are kinda right, though idk how automagically compile tests and so on easily. Also, there's now target that you can use from cmake like target_link_library(my_target PRIVATE fast_io)

These tests are not supposed to be run automatically. This library is a freestanding library. Why would it have stupid dependencies like Qt etc?

It doesn't have such dependencies. There's an example which builds only and only if there's qt5 or qt6 on a system. The lib doesn't link such dependencies.

Still that does not mean it needs to add into test etc. ok?

So, you say those examples shouldn't link qt, or that those example shouldn't be build automatically in the first place?

There is a lot of things in the library you cannot test.

If we can test most parts, that's already a win situation

One example includes Linux kernel module. An mini operating system. Windows Kernel drivers. How could you run these tests?

I guess at least we can build them. Therefore those are not tests but examples.

They shouldn't be built.

Examples are not supposed to work either. Everything in fast_io_driver is not supposed to work.

There is no win. I have said FREESTANDING is the red line for this library. Add any bs into the test that prevents the headers being installed are UNACCEPTABLE.

Arniiiii commented 1 month ago

Also the correct way to use C++ libraries is to install them in the sysroot, not this build system crap. If you do not know how to build Canadian compilers, you really should not use C++.

You are right about installation. Though, CMake now allows to use something that is not installed by downloading it and when you install a project that uses your project, it will install headers of your project.

Add any bs into the test that prevents the headers being installed are UNACCEPTABLE.

It does not not install the headers.

trcrsired commented 1 month ago

Also the correct way to use C++ libraries is to install them in the sysroot, not this build system crap. If you do not know how to build Canadian compilers, you really should not use C++.

You are right about installation. Though, CMake now allows to use something that is not installed by downloading it and when you install a project that uses your project, it will install headers of your project.

Add any bs into the test that prevents the headers being installed are UNACCEPTABLE.

It does not not install the headers.

IT DOES. just ninja install without ninja. You don't need to build. You just install.

https://github.com/cppfastio/fast_io/pull/779/commits/add7a16f991fe4f8b380f538f64fceaa0186be17#diff-79ae4cda20779ed6541aff70de096d42bd2f7ebccc9ef13b418743285b6eabf1R6

Randomly including headers like utility or iterator are also UNACCEPTABLE since neither of them are freestanding before C++23.

https://github.com/trcrsired/Portable-Cpp-Guideline

https://www.youtube.com/watch?v=DorYSHu4Sjk&t=178s

https://en.cppreference.com/w/cpp/freestanding

Arniiiii commented 1 month ago

Add any bs into the test that prevents the headers being installed are UNACCEPTABLE.

It does not not install the headers.

IT DOES.

Let me check, but it should.

https://github.com/cppfastio/fast_io/commit/add7a16f991fe4f8b380f538f64fceaa0186be17#diff-79ae4cda20779ed6541aff70de096d42bd2f7ebccc9ef13b418743285b6eabf1R6 Randomly including headers like utility or iterators also UNACCEPTABLE since neither of them are freestanding before C++23.

I removed all stuff about header inclusion in my 3rd PR, but you closed it and locked conversation, therefore we message here

trcrsired commented 1 month ago

Add any bs into the test that prevents the headers being installed are UNACCEPTABLE.

It does not not install the headers.

IT DOES.

Let me check, but it should.

add7a16#diff-79ae4cda20779ed6541aff70de096d42bd2f7ebccc9ef13b418743285b6eabf1R6 Randomly including headers like utility or iterators also UNACCEPTABLE since neither of them are freestanding before C++23.

I removed all stuff about header inclusion in my 3rd PR, but you closed it and locked conversation, therefore we message here

No I just don't think you even understand how this library is supposed to do and just randomly submit PR.

Arniiiii commented 1 month ago

It installs.

Arniiiii commented 1 month ago

add7a16#diff-79ae4cda20779ed6541aff70de096d42bd2f7ebccc9ef13b418743285b6eabf1R6 Randomly including headers like utility or iterators also UNACCEPTABLE since neither of them are freestanding before C++23.

I removed all stuff about header inclusion in my 3rd PR, but you closed it and locked conversation, therefore we message here

No I just don't think you even understand how this library is supposed to do and just randomly submit PR.

You are right in part of my understanding of -ffreestanding . I'll investigate it more rn. Though, I removed all of including of the standard headers in 3rd PR .

trcrsired commented 1 month ago

It installs.

The i18n dlls are going to be removed and replaced with some new mechanisms. Loading DLLs for locale data is a bad idea but I don't have to time to clean it up, yet. So besides headers, nothing is useful

trcrsired commented 1 month ago

add7a16#diff-79ae4cda20779ed6541aff70de096d42bd2f7ebccc9ef13b418743285b6eabf1R6 Randomly including headers like utility or iterators also UNACCEPTABLE since neither of them are freestanding before C++23.

I removed all stuff about header inclusion in my 3rd PR, but you closed it and locked conversation, therefore we message here

No I just don't think you even understand how this library is supposed to do and just randomly submit PR.

You are right in part my understanding of -ffreestanding . I'll investigate it more rn. Though, I removed all of including of the standard headers in 3rd PR .

That is just -ffreestanding. GCC allows build toolchains with --disable-hosted-libstdcxx and it only installs very small set of headers. (Not full set) You cannot include headers randomly since those files do not exist

Arniiiii commented 1 month ago

It installs.

The i18n dlls are going to be removed and replaced with some new mechanisms. Loading DLLs for locale data is a bad idea but I don't have to time to clean it up, yet. So besides headers, nothing is useful

I've literally copied your cmake for those to src with almost minimal changes.

trcrsired commented 1 month ago

It installs.

The i18n dlls are going to be removed and replaced with some new mechanisms. Loading DLLs for locale data is a bad idea but I don't have to time to clean it up, yet. So besides headers, nothing is useful

I've literally copied your cmake for those to src with almost minimal changes.

No. the src part is useless at this point. They don't work and are going to be removed.

Arniiiii commented 1 month ago

It installs.

The i18n dlls are going to be removed and replaced with some new mechanisms. Loading DLLs for locale data is a bad idea but I don't have to time to clean it up, yet. So besides headers, nothing is useful

I've literally copied your cmake for those to src with almost minimal changes.

No. the src part is useless at this point. They don't work and are going to be removed.

Ok, I'll check this soon.

trcrsired commented 1 month ago

image

-ffreestanding is NOT freestanding.

See this is a freestanding toolchain looks like. It has very limited set of header files. Even the file like utility or memory etc does not exist. You cannot include them

trcrsired commented 1 month ago

https://www.youtube.com/watch?v=DorYSHu4Sjk

trcrsired commented 1 month ago

https://gcc.gnu.org/onlinedocs/libstdc++/manual/configure.html

--disable-hosted-libstdcxx

By default, a complete hosted C++ library is built. The C++ Standard also describes a freestanding environment, in which only a minimal set of headers are provided. This option builds such an environment. Note that a hosted library installs headers that still can be used in non hosted environments, as the library checks for __STDC_HOSTED__, however, a library configured with --disable-hosted-libstdcxx will not install unusable headers.

trcrsired commented 1 month ago

https://github.com/trcrsired/gcc-releases/releases

Here are gcc toolchains you can try. x86_64-elf.tar.xz is a freestanding GCC toolchain

trcrsired commented 1 month ago

https://wiki.osdev.org/Why_do_I_need_a_Cross_Compiler%3F

Arniiiii commented 1 month ago

Ok, I could built my own freestanding gcc-14 and g++-14 via gentoo's crossdev after a patch.

Now, I got some errors related to missing standard libs, which is expected.

Though, I got an amazing static_assert, that I really like that it exists.

I tried to compile benchmark benchmark/0001.refterm/stdio_hack.cc and I got this:

[  0%] Building CXX object benchmark/CMakeFiles/benchmark_fast_io_0001_refterm_stdio_hack.dir/0001.refterm/stdio_hack.cc.o
cd "/home/paxu/code/experiments/fast_io_cmake_cpm5/build/GCC 14.1.1_p20240720 i686-efi/Debug/benchmark" && /usr/bin/i686-elf-g++  -I/home/paxu/code/experiments/fast_io_cmake_cpm5/include -I"/home/paxu/code/experiments/fast_io_cmake_cpm5/build/GCC 14.1.1_p20240720 i686-efi/Debug/PackageProjectInclude" -pipe -march=native -ggdb3 -ffreestanding -mno-red-zone -nostdlib -g -std=gnu++23 -MD -MT benchmark/CMakeFiles/benchmark_fast_io_0001_refterm_stdio_hack.dir/0001.refterm/stdio_hack.cc.o -MF CMakeFiles/benchmark_fast_io_0001_refterm_stdio_hack.dir/0001.refterm/stdio_hack.cc.o.d -o CMakeFiles/benchmark_fast_io_0001_refterm_stdio_hack.dir/0001.refterm/stdio_hack.cc.o -c /home/paxu/code/experiments/fast_io_cmake_cpm5/benchmark/0001.refterm/stdio_hack.cc
In file included from /home/paxu/code/experiments/fast_io_cmake_cpm5/benchmark/0001.refterm/stdio_hack.cc:3:
/home/paxu/code/experiments/fast_io_cmake_cpm5/include/fast_io_driver/timer.h: In constructor ‘fast_io::timer::timer(fast_io::u8string_view)’:
/home/paxu/code/experiments/fast_io_cmake_cpm5/include/fast_io_driver/timer.h:16:32: error: ‘posix_clock_gettime’ was not declared in this scope; did you mean ‘posix_clock_id’?
   16 |                 : s(strvw), t0(posix_clock_gettime(posix_clock_id::monotonic_raw))
      |                                ^~~~~~~~~~~~~~~~~~~
      |                                posix_clock_id
/home/paxu/code/experiments/fast_io_cmake_cpm5/include/fast_io_driver/timer.h: In destructor ‘fast_io::timer::~timer()’:
/home/paxu/code/experiments/fast_io_cmake_cpm5/include/fast_io_driver/timer.h:26:46: error: ‘u8err’ is not a member of ‘fast_io’
   26 |                 ::fast_io::io::perr(fast_io::u8err(), s, u8":", posix_clock_gettime(posix_clock_id::monotonic_raw) - t0,
      |                                              ^~~~~
/home/paxu/code/experiments/fast_io_cmake_cpm5/include/fast_io_driver/timer.h:26:65: error: ‘posix_clock_gettime’ was not declared in this scope; did you mean ‘posix_clock_id’?
   26 |                 ::fast_io::io::perr(fast_io::u8err(), s, u8":", posix_clock_gettime(posix_clock_id::monotonic_raw) - t0,
      |                                                                 ^~~~~~~~~~~~~~~~~~~
      |                                                                 posix_clock_id
/home/paxu/code/experiments/fast_io_cmake_cpm5/benchmark/0001.refterm/stdio_hack.cc: In function ‘int main()’:
/home/paxu/code/experiments/fast_io_cmake_cpm5/benchmark/0001.refterm/stdio_hack.cc:16:18: error: ‘u8obuf_file’ is not a member of ‘fast_io’
   16 |         fast_io::u8obuf_file timer_obf(u"stdio_hack.txt");
      |                  ^~~~~~~~~~~
/home/paxu/code/experiments/fast_io_cmake_cpm5/benchmark/0001.refterm/stdio_hack.cc:17:17: error: ‘posix_clock_gettime’ was not declared in this scope
   17 |         auto t0{posix_clock_gettime(fast_io::posix_clock_id::monotonic)};
      |                 ^~~~~~~~~~~~~~~~~~~
/home/paxu/code/experiments/fast_io_cmake_cpm5/benchmark/0001.refterm/stdio_hack.cc:19:15: error: ‘timer_obf’ was not declared in this scope
   19 |         print(timer_obf, posix_clock_gettime(fast_io::posix_clock_id::monotonic) - t0, u8"s\n");
      |               ^~~~~~~~~
In file included from /home/paxu/code/experiments/fast_io_cmake_cpm5/include/fast_io.h:15,
                 from /home/paxu/code/experiments/fast_io_cmake_cpm5/benchmark/0001.refterm/stdio_hack.cc:1:
/home/paxu/code/experiments/fast_io_cmake_cpm5/include/fast_io_legacy_impl/io.h: In instantiation of ‘constexpr void fast_io::io::println(T&&, Args&& ...) [with T = long unsigned int&; Args = {}]’:
/home/paxu/code/experiments/fast_io_cmake_cpm5/benchmark/0001.refterm/stdio_hack.cc:10:10:   required from here
   10 |                 println(i);
      |                 ~~~~~~~^~~
/home/paxu/code/experiments/fast_io_cmake_cpm5/include/fast_io_legacy_impl/io.h:110:31: error: static assertion failed: freestanding environment must provide IO device for print
  110 |                 static_assert(device_error, "freestanding environment must provide IO device for print");
      |                               ^~~~~~~~~~~~
/home/paxu/code/experiments/fast_io_cmake_cpm5/include/fast_io_legacy_impl/io.h:110:31: note: ‘device_error’ evaluates to false

Could you bring a reference about how to provide IO device? IDK much about IO devices in freestanding environment.

So, how to setup it correctly?