ribasco / u8g2-rpi-demo

This is a demo for using the U8G2 library on the Raspberry Pi
Apache License 2.0
28 stars 6 forks source link

Compile error on Raspberry Pi #7

Open michthom opened 3 years ago

michthom commented 3 years ago

I suspect this project isn't being actively maintained, but I was hoping to install it on an old Raspberry Pi I had lying around. The compile.sh script obtained the u8g2 library code and seems to compile most of it no problem, but the linking stage errored out and I've no clue how to work around or fix this:


Host system is ARM
===================================================
Compile Info
===================================================
Machine Type = armv6l
Operating System = GNU/Linux
Target Build Directory = build/arm/debug
Tools Path = 
Build Type = Debug
CMake Bin Path = /usr/bin/cmake
Cmake Command = /usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug  -H. -Bbuild/arm/debug
===================================================
Running CMake command
-- System Processor = armv6l
-- [U8G2] U8G2_HEADER_FILES = /home/pi/u8g2-rpi-demo/lib/u8g2/csrc/mui.h;/home/pi/u8g2-rpi-demo/lib/u8g2/csrc/mui_u8g2.h;/home/pi/u8g2-rpi-demo/lib/u8g2/csrc/u8g2.h;/home/pi/u8g2-rpi-demo/lib/u8g2/csrc/u8x8.h
-- [U8G2] U8G2_INCLUDE_DIR = /home/pi/u8g2-rpi-demo/build/arm/debug/install/u8g2/include
-- [U8G2] U8G2_LIBRARIES = 
-- [WIRING-PI] WIRINGPI_LIBRARIES = /usr/lib/libwiringPi.so
-- [WIRING-PI] WIRINGPI_INCLUDE_DIR = /usr/include
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/u8g2-rpi-demo/build/arm/debug
===================================================
Building Project Binaries
===================================================
[  1%] Linking CXX executable bin/u8g2demo
/usr/bin/ld: CMakeFiles/u8g2demo.dir/lib/u8g2/csrc/u8g2_d_setup.c.o: in function `u8g2_Setup_uc1609_slg19264_1':
/home/pi/u8g2-rpi-demo/lib/u8g2/csrc/u8g2_d_setup.c:3195: undefined reference to `u8x8_d_uc1609_slg19264'
/usr/bin/ld: CMakeFiles/u8g2demo.dir/lib/u8g2/csrc/u8g2_d_setup.c.o: in function `u8g2_Setup_uc1609_slg19264_2':
/home/pi/u8g2-rpi-demo/lib/u8g2/csrc/u8g2_d_setup.c:3204: undefined reference to `u8x8_d_uc1609_slg19264'
/usr/bin/ld: CMakeFiles/u8g2demo.dir/lib/u8g2/csrc/u8g2_d_setup.c.o: in function `u8g2_Setup_uc1609_slg19264_f':
/home/pi/u8g2-rpi-demo/lib/u8g2/csrc/u8g2_d_setup.c:3213: undefined reference to `u8x8_d_uc1609_slg19264'
/usr/bin/ld: CMakeFiles/u8g2demo.dir/lib/u8g2/csrc/u8g2_d_setup.c.o: in function `u8g2_Setup_uc1609_i2c_slg19264_1':
/home/pi/u8g2-rpi-demo/lib/u8g2/csrc/u8g2_d_setup.c:3223: undefined reference to `u8x8_d_uc1609_slg19264'
/usr/bin/ld: CMakeFiles/u8g2demo.dir/lib/u8g2/csrc/u8g2_d_setup.c.o: in function `u8g2_Setup_uc1609_i2c_slg19264_2':
/home/pi/u8g2-rpi-demo/lib/u8g2/csrc/u8g2_d_setup.c:3232: undefined reference to `u8x8_d_uc1609_slg19264'
/usr/bin/ld: CMakeFiles/u8g2demo.dir/lib/u8g2/csrc/u8g2_d_setup.c.o:/home/pi/u8g2-rpi-demo/lib/u8g2/csrc/u8g2_d_setup.c:3241: more undefined references to `u8x8_d_uc1609_slg19264' follow
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/u8g2demo.dir/build.make:1720: bin/u8g2demo] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/u8g2demo.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
ERROR: Build Failed```
dennisborger commented 3 years ago

exact same issue, not sure what is happening. @ribasco is this repository still being maintained?

dbrook commented 3 years ago

I just ran into this as well on a fresh Raspberry Pi OS installation ... pretty sure the issue lies upstream in the u8g2 code.

Fortunately, I had a working copy on an old Raspberry Pi (which sometime last year I used the ./compile.sh way of building and running the included demo). It was last summer that I did this, maybe June 2020?

My work-around to be able to work with my 128x64 screen for now is:

  1. Run the ./compile.sh script included here, let it build the lib/* directory structure
  2. Delete the files that were cloned under u8g2-rpi-demo/lib/u8g2/csrc/
  3. Copy my old files from u8g2/csrc/* (from my working setup) into their place

To get the old files, it might make sense to clone in another directory, this specific commit (my best guess as to what worked for me from last year) https://github.com/olikraus/u8g2/commit/73a5652d60209327cee609f2030cd893471bec79 and copy the files as outlined above?

After this, the ./compile.sh should hopefully get everything running!