jeanlemotan / esp32-cam-fpv

esp32 cam digital low latency fpv
MIT License
278 stars 68 forks source link

Undefined reference issues when compiling gs code. #24

Open whstudio123 opened 1 year ago

whstudio123 commented 1 year ago
g++ -o gs "-L/usr/lib/aarch64-linux-gnu" "-L/usr/lib" "-L/opt/vc/lib" -lstdc++ -lm -pthread -lz -lrt -lfreetype -lSDL2 -lturbojpeg -lpcap -lGLESv2 -lpigpio  .o/src/main.o .o/src/droid_sans_font.o .o/src/HUD.o .o/src/imgui_impl_opengl3.o .o/src/PI_HAL.o .o/src/Comms.o .o/src/Video_Decoder.o .o/src/utils/radiotap/radiotap.o .o/src/imgui/imgui_impl_sdl.o .o/src/imgui/imgui_demo.o .o/src/imgui/imgui_draw.o .o/src/imgui/imgui.o .o/src/imgui/misc/freetype/imgui_freetype.o .o/../components/common/crc.o .o/../components/common/fec.o .o/src/fmt/format.o .o/src/fmt/os.o
/usr/bin/ld: .o/src/main.o: in function `comms_thread_proc()':
main.cpp:(.text+0xb14): undefined reference to `gpioWrite'
/usr/bin/ld: main.cpp:(.text+0xd10): undefined reference to `gpioWrite'
/usr/bin/ld: .o/src/main.o: in function `main':
main.cpp:(.text.startup+0x94): undefined reference to `gpioSetMode'
/usr/bin/ld: .o/src/Comms.o: in function `Comms::prepare_filter(Comms::PCap&)':
Comms.cpp:(.text+0x34e0): undefined reference to `pcap_datalink'
/usr/bin/ld: Comms.cpp:(.text+0x3620): undefined reference to `pcap_compile'
/usr/bin/ld: Comms.cpp:(.text+0x3634): undefined reference to `pcap_setfilter'
/usr/bin/ld: Comms.cpp:(.text+0x3644): undefined reference to `pcap_freecode'
/usr/bin/ld: Comms.cpp:(.text+0x364c): undefined reference to `pcap_get_selectable_fd'
/usr/bin/ld: Comms.cpp:(.text+0x36f4): undefined reference to `pcap_geterr'
/usr/bin/ld: Comms.cpp:(.text+0x375c): undefined reference to `pcap_freecode'
/usr/bin/ld: Comms.cpp:(.text+0x3768): undefined reference to `pcap_geterr'
/usr/bin/ld: .o/src/Comms.o: in function `Comms::prepare_pcap(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Comms::PCap&)':
Comms.cpp:(.text+0x3b38): undefined reference to `pcap_create'
/usr/bin/ld: Comms.cpp:(.text+0x3b48): undefined reference to `pcap_set_snaplen'
/usr/bin/ld: Comms.cpp:(.text+0x3b58): undefined reference to `pcap_set_promisc'
/usr/bin/ld: Comms.cpp:(.text+0x3b68): undefined reference to `pcap_set_rfmon'
/usr/bin/ld: Comms.cpp:(.text+0x3b78): undefined reference to `pcap_set_timeout'
/usr/bin/ld: Comms.cpp:(.text+0x3b88): undefined reference to `pcap_set_immediate_mode'
/usr/bin/ld: Comms.cpp:(.text+0x3b9c): undefined reference to `pcap_set_buffer_size'
/usr/bin/ld: Comms.cpp:(.text+0x3bdc): undefined reference to `pcap_activate'
/usr/bin/ld: Comms.cpp:(.text+0x3c00): undefined reference to `pcap_setdirection'
/usr/bin/ld: Comms.cpp:(.text+0x3c2c): undefined reference to `pcap_geterr'
/usr/bin/ld: Comms.cpp:(.text+0x3c70): undefined reference to `pcap_geterr'
/usr/bin/ld: Comms.cpp:(.text+0x3cac): undefined reference to `pcap_geterr'
/usr/bin/ld: Comms.cpp:(.text+0x3d24): undefined reference to `pcap_geterr'
/usr/bin/ld: Comms.cpp:(.text+0x3d78): undefined reference to `pcap_geterr'
/usr/bin/ld: .o/src/Comms.o:Comms.cpp:(.text+0x3dc8): more undefined references to `pcap_geterr' follow

(all the libraries are undefined reference. I do install the libraries sudo apt install libdrm-dev libgbm-dev libgles2-mesa-dev libpcap-dev libturbojpeg0-dev libts-dev libsdl2-dev)

If the above things really matter,i am very very glad to participate in fixing bugs and helping to make the features happen as long as anyone could help me to figure out which step i missed or wrong? Now i am stucking at compiling gs code :)

jeanlemotan commented 1 year ago

What platform are you compiling on? It looks like it's missing libpcap and pigpio.

whstudio123 commented 1 year ago

I only paste a few lines of the log.Actually all the libraries are undefined reference (even the pthread).The platform is rpi4 with the lastest 64 bit OS raspbian.I do know i need 32 bit OS ,however i tried rpi3 with 32 and 64 OS,rpi4 with 32 and 64 OS ,but all of them stucked in undefied reference.

I will install a new 32 bit OS raspbian today,repeat the steps and post the full logs and screenshots.

whstudio123 commented 1 year ago

23e95105a42922f65436d7781ac04dd

And here is my uname info: image

I can find my libraries here: image

I also add this path to Makefile but nothing changes: image

I can makesure all the downloads&installs&updates&upgrades are successful. So.....Any idea:)?

lida2003 commented 1 year ago

Latest code of gs, RPI 3B+ with following image and apt-get upgrade, should be fine :)

$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster
$ uname -r
5.10.103-v7+
$ uname -a
Linux PiNas 5.10.103-v7+ #1529 SMP Tue Mar 8 12:21:37 GMT 2022 armv7l GNU/Linux
whstudio123 commented 1 year ago

That means i need RPI 3B+ and 32bit Raspbian buster ? I will have a try immediately. But in other raspberry pi and system versions, does it mean that the current code really cannot be compiled? I think it may be the reason for bullseye, maybe pi3 pi3+ or pi4 have little impact.

lida2003 commented 1 year ago

That means i need RPI 3B+ and 32bit Raspbian buster ?

I mean it works for me :)

The error is caused by Makefile, you have to modify the Makefile if there is some compatible issue.

lida2003 commented 1 year ago
  • We do need to move to a newer version of IDF (5.0) . Because the support of 80211 raw radio doesn't include dumping the CRC error frame in IDF 4.3. We still need the error frames because we have the ability to correct them by fec. wi-fi-80211-packet-send
      The following packets will NOT be dumped to the application:
          802.11 error frame, such as the frame with a CRC error, etc.

    I notice that IDF 5.0 allows us to do this.

This new feature is worth to implement. Can you open a new issue, maybe a PR is well appreciated.

whstudio123 commented 1 year ago

Thank you for your warm support and trust.After i successfully compile the gs code,i will make a new issue foucus on move to IDF 5.0. I also think we need new system (Bullseye) and 64 bit support to make more speed , compatibility and flexibility. The work foucus on makefile and a few lines of code need to be changed because of some ptr issues (I have done some experiment and modification.).Do you think we also need this PR?

lida2003 commented 1 year ago

Frankly speaking, currently, gs compiles ok, but it doesn't work properly #20 with air unit (IDF 4.3 or 4.4 latest or 4.3 beta)

I have got gs compiled on RPI 3B+(minimum modification, which was merged into main stream), and I also have ubuntu x86 compiled. BUT both applicaiton on PI or x86 shows black screen(I'm afraid).

Try to understand the rootcause of black screen first.

whstudio123 commented 1 year ago

Here comes the result .I successfully compiled the gs code in 32bit buster with rpi4. That means the code needs buster version in rpi platform. Now I will first foucus on getting the rootcause of black screen and then have a check with the Makefile compatibility.

whstudio123 commented 1 year ago

@lida2003 I heard that you have compiled code in ubuntu linux. What is your system version? I have been working on ubuntu 18.04 64bit and undefied reference happened. I would appreciate it If you could help me to find something in makefiles.

lida2003 commented 1 year ago

Please use this patch, currently not accepted by @jeanlemotan , BUT it should work. Fix compatibility issue in Makefie on x86_64 ubuntu 20.04

Or you can just go to my repo and pull lida-dev branch .

# git clone git@github.com:lida2003/esp32-cam-fpv.git

whstudio123 commented 1 year ago

When you are so smart and diligent in modifying your code, I am also looking for problems in the makefile and source code. In fact, the points we noticed are all the same (nice!). I will add several links below to help later people understand the reasons for these Makefiles changes: Linker errors from makefile gcc编译时对'xxxx'未定义的引用问题

whstudio123 commented 1 year ago

I have reviewed the code and make some comments.