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

Fails to compile on Debian #10

Open
SummerSeaSun opened this issue Mar 15, 2021 · 10 comments
Open

Fails to compile on Debian #10

SummerSeaSun opened this issue Mar 15, 2021 · 10 comments

Comments

@SummerSeaSun
Copy link

Linux test 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux


ld$ cmake .. -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE__kernel_rwf_t
-- Performing Test HAVE__kernel_rwf_t - Success
-- Performing Test HAVE__kernel_timespec
-- Performing Test HAVE__kernel_timespec - Failed
-- Performing Test HAVE_open_how
-- Performing Test HAVE_open_how - Failed
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: Scaricati/wcp/build

wcp/build$ make
Scanning dependencies of target Uring
[  5%] Building C object liburing/CMakeFiles/Uring.dir/src/setup.c.o
[ 10%] Building C object liburing/CMakeFiles/Uring.dir/src/queue.c.o
[ 15%] Building C object liburing/CMakeFiles/Uring.dir/src/syscall.c.o
[ 21%] Building C object liburing/CMakeFiles/Uring.dir/src/register.c.o
[ 26%] Linking C static library libUring.a
[ 26%] Built target Uring
Scanning dependencies of target wcp_lib
[ 31%] Building CXX object CMakeFiles/wcp_lib.dir/src/CopyRunner.cpp.o
[ 36%] Building CXX object CMakeFiles/wcp_lib.dir/src/CopyQueue.cpp.o
[ 42%] Building CXX object CMakeFiles/wcp_lib.dir/src/Heap.cpp.o
[ 47%] Building CXX object CMakeFiles/wcp_lib.dir/src/Config.cpp.o
[ 52%] Building CXX object CMakeFiles/wcp_lib.dir/src/Util.cpp.o
/Scaricati/wcp/src/Util.cpp: In lambda function:
/Scaricati/wcp/src/Util.cpp:101:18: error: ‘getdents64’ was not declared in this scope
         retval = getdents64(dfd, buffer, bufferSize);
                  ^~~~~~~~~~
/home/tec1/Scaricati/wcp/src/Util.cpp:101:18: note: suggested alternative: ‘getdirentries64’
         retval = getdents64(dfd, buffer, bufferSize);
                  ^~~~~~~~~~
                  getdirentries64
make[2]: *** [CMakeFiles/wcp_lib.dir/build.make:115: CMakeFiles/wcp_lib.dir/src/Util.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:111: CMakeFiles/wcp_lib.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
@SummerSeaSun
Copy link
Author

:~$ cd ~/experiment/wcp/build/
:~/experiment/wcp/build$ cmake .. -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE__kernel_rwf_t
-- Performing Test HAVE__kernel_rwf_t - Failed
-- Performing Test HAVE__kernel_timespec
-- Performing Test HAVE__kernel_timespec - Failed
-- Performing Test HAVE_open_how
-- Performing Test HAVE_open_how - Failed
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/experiment/wcp/build
server@BACKUP:~/experiment/wcp/build$ make
Scanning dependencies of target Uring
[  5%] Building C object liburing/CMakeFiles/Uring.dir/src/setup.c.o
[ 10%] Building C object liburing/CMakeFiles/Uring.dir/src/queue.c.o
[ 15%] Building C object liburing/CMakeFiles/Uring.dir/src/syscall.c.o
[ 21%] Building C object liburing/CMakeFiles/Uring.dir/src/register.c.o
[ 26%] Linking C static library libUring.a
[ 26%] Built target Uring
Scanning dependencies of target wcp_lib
[ 31%] Building CXX object CMakeFiles/wcp_lib.dir/src/CopyRunner.cpp.o
In file included from /home/experiment/wcp/src/CopyRunner.hpp:6:0,
                 from /home/experiment/wcp/src/CopyRunner.cpp:1:
/home/server/experiment/wcp/src/CopyQueue.hpp:8:22: fatal error: filesystem: File o directory non esistente
 #include <filesystem>
                      ^
compilation terminated.
CMakeFiles/wcp_lib.dir/build.make:62: set di istruzioni per l'obiettivo "CMakeFiles/wcp_lib.dir/src/CopyRunner.cpp.o" non riuscito
make[2]: *** [CMakeFiles/wcp_lib.dir/src/CopyRunner.cpp.o] Errore 1
CMakeFiles/Makefile2:72: set di istruzioni per l'obiettivo "CMakeFiles/wcp_lib.dir/all" non riuscito
make[1]: *** [CMakeFiles/wcp_lib.dir/all] Errore 2
Makefile:83: set di istruzioni per l'obiettivo "all" non riuscito
make: *** [all] Errore 2

Linux test2 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u3 (2017-08-06) x86_64 GNU/Linux

Would it be possible to have a dependencies check?

@wheybags
Copy link
Owner

wheybags commented Mar 27, 2021

Thanks for the report!

Re: the first issue, it should be fixed now via 31a0694

As for the second, sorry, but your GCC version is just very old. From what I can tell, the <filesystem> header was added in GCC 8, which was released around 3 years ago. I don't really want to spend time on supporting old compilers.

@SummerSeaSun
Copy link
Author

Thanks for the update, now it compile but something still missing:


~/Scaricati/wcp/build$ cmake .. -DCMAKE_BUILD_TYPE=Release
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tec1/Scaricati/wcp/build
:~/Scaricati/wcp/build$ make
Scanning dependencies of target Uring
[  5%] Building C object liburing/CMakeFiles/Uring.dir/src/setup.c.o
[ 10%] Building C object liburing/CMakeFiles/Uring.dir/src/queue.c.o
[ 15%] Building C object liburing/CMakeFiles/Uring.dir/src/syscall.c.o
[ 21%] Building C object liburing/CMakeFiles/Uring.dir/src/register.c.o
[ 26%] Linking C static library libUring.a
[ 26%] Built target Uring
Scanning dependencies of target wcp_lib
[ 31%] Building CXX object CMakeFiles/wcp_lib.dir/src/CopyRunner.cpp.o
[ 36%] Building CXX object CMakeFiles/wcp_lib.dir/src/CopyQueue.cpp.o
[ 42%] Building CXX object CMakeFiles/wcp_lib.dir/src/Heap.cpp.o
[ 47%] Building CXX object CMakeFiles/wcp_lib.dir/src/Config.cpp.o
[ 52%] Building CXX object CMakeFiles/wcp_lib.dir/src/Util.cpp.o
[ 57%] Building CXX object CMakeFiles/wcp_lib.dir/src/wcpMain.cpp.o
[ 63%] Building CXX object CMakeFiles/wcp_lib.dir/src/QueueFileDescriptor.cpp.o
[ 68%] Building CXX object CMakeFiles/wcp_lib.dir/src/ScopedFileDescriptor.cpp.o
[ 73%] Building CXX object CMakeFiles/wcp_lib.dir/src/ETACalculator.cpp.o
[ 78%] Linking CXX static library libwcp_lib.a
[ 78%] Built target wcp_lib
Scanning dependencies of target tests
[ 84%] Building CXX object CMakeFiles/tests.dir/src/tests.cpp.o
[ 89%] Linking CXX executable tests
[ 89%] Built target tests
[ 94%] Building CXX object CMakeFiles/wcp.dir/src/main.cpp.o
[100%] Linking CXX executable wcp
[100%] Built target wcp

:~/Scaricati/wcp/build$ ./wcp /source /dest/

Segmentation fault

$ uname -ra
Linux 5.10.0-0.bpo.4-amd64 #1 SMP Debian 5.10.19-1~bpo10+1 (2021-03-13) x86_64 GNU/Linux

@wheybags
Copy link
Owner

Could you maybe build in Debug mode, and get a stacktrace from gdb? For clarity:

cmake .. -DCMAKE_BUILD_TYPE=Debug
gdb ./wcp

(In gdb)
run
(... crash)
bt
info locals

@wheybags wheybags reopened this Apr 10, 2021
@SummerSeaSun
Copy link
Author

gdb ./wcp source.vdi /destfolder


Excess command line arguments ignored. (/media/TEC1_DATI2/VBOX/)
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./wcp...(no debugging symbols found)...done.

"source.vdi" is not a core dump: file format not recognized
(gdb) 

@wheybags
Copy link
Owner

Ah, yes, when using gdb, you need to do a "run" command inside gdb. So it would be gdb ./wcp followed by run source.vdi /destfolder inside gdb, and then the bt and info locals commands after it crashes.

@SummerSeaSun
Copy link
Author

Just compiled last version:


(gdb) run /source /dest
Starting program: /source /dest
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fff2fa7b700 (LWP 15530)]
[New Thread 0x7fff27fff700 (LWP 15531)]

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
 Elapsed: 00s                                                                     0.00 B / ???                                                           0.00 B/s   ETA: ??? 
                                                                         Calculating, found: 0.00 B                                                                          

Thread 1 "wcp" received signal SIGABRT, Aborted.
0x00007ffff7abd081 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0  0x00007ffff7abd081 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff7aa8535 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff7e3c643 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff7e47fd6 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff7e48041 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff7e48295 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff7e3ec09 in std::__throw_bad_alloc() () from /lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x000055555555e9b8 in __gnu_cxx::new_allocator<std::filesystem::__cxx11::path::_Cmpt>::allocate (this=0x7fffffffd510, __n=10248189848935966038)
    at /usr/include/c++/8/ext/new_allocator.h:102
#8  0x000055555555e1da in std::allocator_traits<std::allocator<std::filesystem::__cxx11::path::_Cmpt> >::allocate (__a=..., __n=10248189848935966038)
    at /usr/include/c++/8/bits/alloc_traits.h:436
#9  0x000055555555d664 in std::_Vector_base<std::filesystem::__cxx11::path::_Cmpt, std::allocator<std::filesystem::__cxx11::path::_Cmpt> >::_M_allocate (
    this=0x7fffffffd510, __n=10248189848935966038) at /usr/include/c++/8/bits/stl_vector.h:296
#10 0x000055555555ca44 in std::vector<std::filesystem::__cxx11::path::_Cmpt, std::allocator<std::filesystem::__cxx11::path::_Cmpt> >::_M_allocate_and_copy<__gnu_cxx::__normal_iterator<std::filesystem::__cxx11::path::_Cmpt const*, std::vector<std::filesystem::__cxx11::path::_Cmpt, std::allocator<std::filesystem::__cxx11::path::_Cmpt> > > > (
    this=0x7fffffffd510, __n=10248189848935966038, __first=..., __last=...) at /usr/include/c++/8/bits/stl_vector.h:1398
#11 0x000055555555b935 in std::vector<std::filesystem::__cxx11::path::_Cmpt, std::allocator<std::filesystem::__cxx11::path::_Cmpt> >::operator= (this=0x7fffffffd510, 
    __x=...) at /usr/include/c++/8/bits/vector.tcc:214
#12 0x000055555555a95e in std::filesystem::__cxx11::path::operator= (this=0x7fffffffd4f0, __p=...) at /usr/include/c++/8/bits/fs_path.h:66
#13 0x000055555555a9a7 in std::filesystem::__cxx11::path::operator/= (this=0x7fffffffd4f0, __p=...) at /usr/include/c++/8/bits/fs_path.h:254
#14 0x00007ffff7efaa98 in std::filesystem::absolute(std::filesystem::__cxx11::path const&) () from /lib/x86_64-linux-gnu/libstdc++.so.6
#15 0x0000555555559e88 in wcpMain (argc=3, argv=0x7fffffffde78) at /home/tec1/Scaricati/wcp/src/wcpMain.cpp:127
#16 0x00005555555596a5 in main (argc=3, argv=0x7fffffffde78) at /home/tec1/Scaricati/wcp/src/main.cpp:5
(gdb) info locals
No symbol table info available.

@wheybags
Copy link
Owner

wheybags commented Jun 8, 2021 via email

@koenkooi
Copy link

This worked for me:

koen@gitlab:~/projects/wcp$ git diff CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 05e5aaf..2dcc826 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,7 +39,9 @@ target_compile_options(wcp_lib PRIVATE ${WCP_COMPILER_FLAGS})
 
 add_executable(wcp src/main.cpp)
 target_link_libraries(wcp wcp_lib)
+target_link_libraries(wcp stdc++fs)
 
 add_executable(tests src/tests.cpp src/acutest.h)
 target_link_libraries(tests wcp_lib)
-target_compile_options(tests PRIVATE ${WCP_COMPILER_FLAGS})
\ No newline at end of file
+target_link_libraries(tests stdc++fs)
+target_compile_options(tests PRIVATE ${WCP_COMPILER_FLAGS})

@SummerSeaSun
Copy link
Author

target_compile_options(tests PRIVATE ${WCP_COMPILER_FLAGS})

the edit of CMakeLists.txt has solved the issue for me too.
Thank you!

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

No branches or pull requests

3 participants