Unexpected compile error on Raspberry Pi

ve been developing a C++ application designated to work on Linux SO, I've tested my application on Ubuntu 20.04.2 LTS, Kali GNU/Linux Rolling 2021.3 and it work correctly but I'm getting some compile problem on my Raspberry Pi, with Raspbian GNU/Linux 10 (buster).
Compilation is done through a Makefile:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
pi2@raspberrypi:~/Desktop/program $ make

...
...
/usr/include/c++/8/bits/stl_uninitialized.h:115:5: note: parameter passing for argument of type ‘std::move_iterator<Frame*>’ changed in GCC 7.1
/usr/include/c++/8/bits/stl_uninitialized.h:134:15: note: parameter passing for argument of type ‘std::move_iterator<Frame*>’ changed in GCC 7.1
       return std::__uninitialized_copy<__is_trivial(_ValueType1)
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            && __is_trivial(_ValueType2)
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            && __assignable>::
            ~~~~~~~~~~~~~~~~~~
  __uninit_copy(__first, __last, __result);
  ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/8/bits/stl_uninitialized.h: In static member function ‘static _ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = std::move_iterator<Frame*>; _ForwardIterator = Frame*; bool _TrivialValueTypes = false]’:
/usr/include/c++/8/bits/stl_uninitialized.h:76:9: note: parameter passing for argument of type ‘std::move_iterator<Frame*>’ changed in GCC 7.1
         __uninit_copy(_InputIterator __first, _InputIterator __last,
         ^~~~~~~~~~~~~
/usr/include/c++/8/bits/stl_uninitialized.h:76:9: note: parameter passing for argument of type ‘std::move_iterator<Frame*>’ changed in GCC 7.1
/usr/bin/ld: /tmp/ccRXo7Xc.o: in function `get_last_log[abi:cxx11](int)':
/home/pi/Desktop/luca_rpi_development/Parsing_log.cpp:8: undefined reference to `std::filesystem::__cxx11::directory_iterator::operator*() const'
/usr/bin/ld: /home/pi/Desktop/luca_rpi_development/Parsing_log.cpp:8: undefined reference to `std::filesystem::__cxx11::directory_iterator::operator++()'
/usr/bin/ld: /tmp/ccRXo7Xc.o: in function `std::filesystem::__cxx11::directory_iterator::directory_iterator(std::filesystem::__cxx11::path const&)':
/usr/include/c++/8/bits/fs_dir.h:361: undefined reference to `std::filesystem::__cxx11::directory_iterator::directory_iterator(std::filesystem::__cxx11::path const&, std::filesystem::directory_options, std::error_code*)'
/usr/bin/ld: /tmp/ccRXo7Xc.o: in function `std::filesystem::__cxx11::path::path<char [3], std::filesystem::__cxx11::path>(char const (&) [3], std::filesystem::__cxx11::path::format)':
/usr/include/c++/8/bits/fs_path.h:184: undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: /tmp/cc5ZCMUE.o: in function `get_ini_file_name[abi:cxx11](int)':
/home/pi/Desktop/luca_rpi_development/utilities.cpp:23: undefined reference to `std::filesystem::__cxx11::directory_iterator::operator*() const'
/usr/bin/ld: /home/pi/Desktop/luca_rpi_development/utilities.cpp:23: undefined reference to `std::filesystem::__cxx11::directory_iterator::operator++()'
/usr/bin/ld: /tmp/cc5ZCMUE.o: in function `get_last_logging_file[abi:cxx11]()':
/home/pi/Desktop/luca_rpi_development/utilities.cpp:39: undefined reference to `std::filesystem::__cxx11::directory_iterator::operator*() const'
/usr/bin/ld: /home/pi/Desktop/luca_rpi_development/utilities.cpp:39: undefined reference to `std::filesystem::__cxx11::directory_iterator::operator++()'
/usr/bin/ld: /tmp/cc5ZCMUE.o: in function `get_ini_files[abi:cxx11]()':
/home/pi/Desktop/luca_rpi_development/utilities.cpp:71: undefined reference to `std::filesystem::__cxx11::directory_iterator::operator*() const'
/usr/bin/ld: /home/pi/Desktop/luca_rpi_development/utilities.cpp:71: undefined reference to `std::filesystem::__cxx11::directory_iterator::operator++()'
/usr/bin/ld: /tmp/cc5ZCMUE.o: in function `std::filesystem::__cxx11::path::path<char [6], std::filesystem::__cxx11::path>(char const (&) [6], std::filesystem::__cxx11::path::format)':
/usr/include/c++/8/bits/fs_path.h:184: undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
collect2: error: ld returned 1 exit status
make: *** [Makefile:11: validNet] Error 1

This is the MakeFile:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pi2@raspberrypi:~/Desktop/program $ cat Makefile 
PROG = app
COMPILER = g++
STD = c++17
FILES.CPP = GUI.cpp Test.cpp Suite.cpp can_utilities.cpp  Parsing_log.cpp Parsing_ini.cpp utilities.cpp
CFLAGS = `pkg-config --cflags gtk+-3.0`
LIBS = `pkg-config --libs gtk+-3.0 libnotify`
WARNING_FLAGS = -w

${PROG}: ${PROG}.cpp

	${COMPILER} -std=${STD} ${WARNING_FLAGS} ${CFLAGS} ${PROG}.cpp ${FILES.CPP} -g -o ${PROG} ${LIBS}

clean: 
	rm ${PROG}


I verified that GTK and libnotify libraries are installed correctly:

1
2
3
4
5
pi2@raspberrypi:~/Desktop/program $ pkg-config --cflags --libs gtk+-3.0 
-pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/arm-linux-gnueabihf/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0

pi2@raspberrypi:~/Desktop/program $ pkg-config --cflags --libs libnotify
-pthread -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -lnotify -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0


g++ version is 8.3.0.
Last edited on
On some versions of G++ your local cpp files must be referenced before system library flags (This is determined by the build commands of whoever built and maintains the actual G++ binary, so it can change between versions of linux, but rarely changes between updates of G++ or the OS itself, though it could happen in theory if they modify their build scripts or similar).
In your makefile try moving {prog}.cpp and ${FILES.CPP} to the front of the command like this:
${COMPILER} ${PROG}.cpp ${FILES.CPP} -std=${STD} ${WARNING_FLAGS} ${CFLAGS} -g -o ${PROG} ${LIBS}


(or move ${CFLAGS} to the end of the command)
Last edited on
1
2
CFLAGS = `pkg-config --cflags gtk+-3.0`
LIBS = `pkg-config --libs gtk+-3.0 libnotify`

You're missing the cflags for libnotify

> /usr/bin/ld: /tmp/ccRXo7Xc.o: in function `get_last_log[abi:cxx11](int)':
If you're passing in -std=c++17, how come all the linker errors are related to c++11 ?
If you're passing in -std=c++17, how come all the linker errors are related to c++11 ?

GCC's C++17 uses their C++11 ABI. That ABI supports atomics.
Last edited on
Topic archived. No new replies allowed.