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

[mainly solved] can't install the lib on my Raspberry Pi (OS Raspbian Stretch) #24

Open
dsyleixa opened this issue Apr 16, 2021 · 31 comments

Comments

@dsyleixa
Copy link

I can't install the lib on my Raspberry Pi (OS Raspbian Stretch), downloading and then typing "make" or even "sudo make" does not work at all, e.g.,

pi@PiStr:~/ArduiPi_OLED $ sudo make
g++ -Wall -fPIC -fno-rtti -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c ArduiPi_OLED.cpp
ArduiPi_OLED.cpp: In member function ‘void ArduiPi_OLED::putSeedChar(char)’:
ArduiPi_OLED.cpp:635:41: warning: array subscript has type ‘char’ [-Wchar-subscripts]
             char bit1=( seedfont[C-32][i]   >> j) & 0x01;
                                         ^
In file included from ArduiPi_OLED.cpp:36:0:
./ArduiPi_OLED_lib.h: At global scope:
./ArduiPi_OLED_lib.h:58:21: warning: ‘oled_type_str’ defined but not used [-Wunused-variable]
 static const char * oled_type_str[] = {
                     ^~~~~~~~~~~~~
g++ -Wall -fPIC -fno-rtti -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c Adafruit_GFX.cpp
In file included from Adafruit_GFX.cpp:26:0:
./ArduiPi_OLED_lib.h:58:21: warning: ‘oled_type_str’ defined but not used [-Wunused-variable]
 static const char * oled_type_str[] = {
                     ^~~~~~~~~~~~~
gcc -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c bcm2835.c
gcc -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c Wrapper.cpp
Wrapper.cpp: In function ‘int16_t Wrapper_DisplayWidth()’:
Wrapper.cpp:233:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
Wrapper.cpp: In function ‘int16_t Wrapper_DisplayHeight()’:
Wrapper.cpp:238:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
In file included from Wrapper.cpp:39:0:
./ArduiPi_OLED_lib.h: At global scope:
./ArduiPi_OLED_lib.h:58:21: warning: ‘oled_type_str’ defined but not used [-Wunused-variable]
 static const char * oled_type_str[] = {
                     ^~~~~~~~~~~~~
g++ -shared -Wl,-soname,libArduiPi_OLED.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s   -o libArduiPi_OLED.so.1.0 ArduiPi_OLED.o Adafruit_GFX.o bcm2835.o Wrapper.o -li2c
/usr/bin/ld: cannot find -li2c
collect2: error: ld returned 1 exit status
Makefile:54: die Regel für Ziel „ArduiPi_OLED“ scheiterte
make: *** [ArduiPi_OLED] Fehler 1

how to fix that?

@devel0
Copy link
Collaborator

devel0 commented Apr 16, 2021

apt install libi2c-dev

this fixed that error for me on raspian buster, can you confirm that solve for you too ?

@dsyleixa
Copy link
Author

dsyleixa commented Apr 17, 2021

libi2c-dev is already installed:

sudo apt-get install libi2c-dev :
is already the latest version (3.1.2-3).

Nonetheless, no installation via make possible.
(Just to mention: OS Buster is off-topic here. I am using Stretch as stated.)

@devel0
Copy link
Collaborator

devel0 commented Apr 17, 2021

hmm, that's bit strange, if I remove the lib the make fail as expected

root@raspberrypi:/usr/src/ArduiPi_OLED# apt remove libi2c-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  libi2c-dev
0 upgraded, 0 newly installed, 1 to remove and 100 not upgraded.
After this operation, 31.7 kB disk space will be freed.
Do you want to continue? [Y/n] 
(Reading database ... 41905 files and directories currently installed.)
Removing libi2c-dev (4.1-1) ...
root@raspberrypi:/usr/src/ArduiPi_OLED# make
g++ -shared -Wl,-soname,libArduiPi_OLED.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s   -o libArduiPi_OLED.so.1.0 ArduiPi_OLED.o Adafruit_GFX.o bcm2835.o Wrapper.o -li2c
/usr/bin/ld: cannot find -li2c
collect2: error: ld returned 1 exit status
make: *** [Makefile:54: ArduiPi_OLED] Error 1

while reinstalling the lib it worked

root@raspberrypi:/usr/src/ArduiPi_OLED# apt install libi2c-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libi2c-dev
0 upgraded, 1 newly installed, 0 to remove and 100 not upgraded.
Need to get 11.9 kB of archives.
After this operation, 31.7 kB of additional disk space will be used.
Get:1 http://raspbian.mirror.garr.it/mirrors/raspbian/raspbian buster/main armhf libi2c-dev armhf 4.1-1 [11.9 kB]
Fetched 11.9 kB in 1s (10.8 kB/s)
Selecting previously unselected package libi2c-dev.
(Reading database ... 41896 files and directories currently installed.)
Preparing to unpack .../libi2c-dev_4.1-1_armhf.deb ...
Unpacking libi2c-dev (4.1-1) ...
Setting up libi2c-dev (4.1-1) ...
root@raspberrypi:/usr/src/ArduiPi_OLED# make
g++ -shared -Wl,-soname,libArduiPi_OLED.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s   -o libArduiPi_OLED.so.1.0 ArduiPi_OLED.o Adafruit_GFX.o bcm2835.o Wrapper.o -li2c
[Install Library]
[Install Headers]

This the contents of libi2c-dev package

root@raspberrypi:/usr/src/ArduiPi_OLED# dpkg -L libi2c-dev
/.
/usr
/usr/include
/usr/include/i2c
/usr/include/i2c/smbus.h
/usr/lib
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabihf/libi2c.a
/usr/share
/usr/share/doc
/usr/share/doc/libi2c-dev
/usr/share/doc/libi2c-dev/changelog.Debian.gz
/usr/share/doc/libi2c-dev/changelog.gz
/usr/share/doc/libi2c-dev/copyright
/usr/share/doc/libi2c-dev/dev-interface.gz
/usr/lib/arm-linux-gnueabihf/libi2c.so

if I move libi2c.a to temp folder to test build fails

root@raspberrypi:/usr/src/ArduiPi_OLED# mkdir -p ~/tmp
root@raspberrypi:/usr/src/ArduiPi_OLED# mv /usr/lib/arm-linux-gnueabihf/libi2c.a ~/tmp
root@raspberrypi:/usr/src/ArduiPi_OLED# make
g++ -shared -Wl,-soname,libArduiPi_OLED.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s   -o libArduiPi_OLED.so.1.0 ArduiPi_OLED.o Adafruit_GFX.o bcm2835.o Wrapper.o -li2c

/usr/bin/ld: cannot find -li2c
collect2: error: ld returned 1 exit status
make: *** [Makefile:54: ArduiPi_OLED] Error 1

I can build wrapping with flag to specify where the lib is, in the example case /root/tmp because ~/tmp expands to user home and I was from root

root@raspberrypi:/usr/src/ArduiPi_OLED# g++ -shared -Wl,-soname,libArduiPi_OLED.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s   -o libArduiPi_OLED.so.1.0 ArduiPi_OLED.o Adafruit_GFX.o bcm2835.o Wrapper.o -L/root/tmp -li2c
root@raspberrypi:/usr/src/ArduiPi_OLED# 

I suggest you to try execute sudo -i to enter from pi to root user and try a make clean then make again; if this fails inspect dpkg -L libi2c-dev to see where libi2c.a located then make a copy of that library in a known folder and try to override linker flags as specified, just copy paste the failing g++ -shared ... line and add -L/root/tmp or other folder where lib copied.

@dsyleixa
Copy link
Author

dsyleixa commented Apr 17, 2021

dpkg -L libi2c-dev only finds
usr/include/linux/i2c-dev.h
package redirects others to usr/include/linux/i2c-dev.h.kernel
usr/share/doc/libi2c-dev
(plus some paths more)

but it lists no libi2c.a or libi2c.so and also no smbus.h
how to reinstall them?

@devel0
Copy link
Collaborator

devel0 commented Apr 17, 2021

you could try to search for libi2c.a using apt-file utility as follows

apt-get install apt-file

after installed refresh the search archive with apt-file update then search where libi2c.a located with

apt-file search libi2c.a

this way you will find which package should contains the library, may your distro moved the library binary to other package.

in my case the cmd reports searched file belongs to libi2c-dev pkg while I expect different result for your distro, if so go to install for addictional reported package:

root@main:~# apt-file search libi2c.a
libi2c-dev: /usr/lib/x86_64-linux-gnu/libi2c.a

@dsyleixa
Copy link
Author

dsyleixa commented Apr 17, 2021

$ sudo apt-get install apt-file
$ sudo apt-file update
have already been executed.

then, as stated,
apt-get install libi2c-dev
says:
is already the latest version (3.1.2-3).

apt-file search libi2c.a
outputs nothing.

@devel0
Copy link
Collaborator

devel0 commented Apr 17, 2021

In fact I just seen from https://packages.debian.org/index that your distro missing libi2c.a at all

image

Could you try to run the latest line from your source dir ( I removed -li2c )

g++ -shared -Wl,-soname,libArduiPi_OLED.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s   -o libArduiPi_OLED.so.1.0 ArduiPi_OLED.o Adafruit_GFX.o bcm2835.o Wrapper.o

@dsyleixa
Copy link
Author

tbh, I don't understand what you mean ..?

@devel0
Copy link
Collaborator

devel0 commented Apr 17, 2021

from your source of ArduiPi_OLED if you run make the result should

g++ -shared -Wl,-soname,libArduiPi_OLED.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s   -o libArduiPi_OLED.so.1.0 ArduiPi_OLED.o Adafruit_GFX.o bcm2835.o Wrapper.o -li2c
/usr/bin/ld: cannot find -li2c
collect2: error: ld returned 1 exit status
Makefile:54: die Regel für Ziel „ArduiPi_OLED“ scheiterte
make: *** [ArduiPi_OLED] Fehler 1

so try to copy paste the g++ ... line omitting the -li2c

@dsyleixa
Copy link
Author

dsyleixa commented Apr 17, 2021

so first,
cd ArduiPi_OLED

and then
g++ -shared -Wl,-soname,libArduiPi_OLED.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -o libArduiPi_OLED.so.1.0 ArduiPi_OLED.o Adafruit_GFX.o bcm2835.o Wrapper.o -li2c

?

@devel0
Copy link
Collaborator

devel0 commented Apr 17, 2021

as expected, but insert the command by hand ( better with mouse select then middle btn to paste )

g++ -shared -Wl,-soname,libArduiPi_OLED.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -o libArduiPi_OLED.so.1.0 ArduiPi_OLED.o Adafruit_GFX.o bcm2835.o Wrapper.o

image

alternatively remove it from Makefile then issue a make

image

@dsyleixa
Copy link
Author

ok, so without the -li2c at the end.
I'll do ASAP, a SD backup is currently running (for safety reasons, if anything from now messes up my sytem ;) )

@devel0
Copy link
Collaborator

devel0 commented Apr 17, 2021

:) but it worked ?
Unfortunately I running another distro and I cannot test the behavior, but if you confirm that compile work I would schedule to modify Makefile so that if stretch distro detected then it will not include -li2c flag.

@dsyleixa
Copy link
Author

just of interest, meanwhile:
why do I have a libi2c.h but no libi2c.a/so ?

@devel0
Copy link
Collaborator

devel0 commented Apr 17, 2021

I'm unsure, but seems it was from kernel, while in recent os exported to user space and requires -li2c ;

if you go to examples folder are you able to make it successfully ?

@dsyleixa
Copy link
Author

dsyleixa commented Apr 17, 2021

weird...

anyway, after
cd ArduiPi_OLED
I now entered:

g++ -shared -Wl,-soname,libArduiPi_OLED.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -o libArduiPi_OLED.so.1.0 ArduiPi_OLED.o Adafruit_GFX.o bcm2835.o Wrapper.o
g++: error: ArduiPi_OLED.o: Datei oder Verzeichnis nicht gefunden
g++: error: Adafruit_GFX.o: Datei oder Verzeichnis nicht gefunden
g++: error: bcm2835.o: Datei oder Verzeichnis nicht gefunden
g++: error: Wrapper.o: Datei oder Verzeichnis nicht gefunden

@devel0
Copy link
Collaborator

devel0 commented Apr 17, 2021

better to modify Makefile and remove -li2c from there, then issue make clean and make again, let me know results.

@dsyleixa
Copy link
Author

if I retry in the examples folder:

pi@PiStr:~/ArduiPi_OLED $ cd examples
pi@PiStr:~/ArduiPi_OLED/examples $ g++ -shared -Wl,-soname,libArduiPi_OLED.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -o libArduiPi_OLED.so.1.0 ArduiPi_OLED.o Adafruit_GFX.o bcm2835.o Wrapper.o
g++: error: ArduiPi_OLED.o: Datei oder Verzeichnis nicht gefunden
g++: error: Adafruit_GFX.o: Datei oder Verzeichnis nicht gefunden
g++: error: bcm2835.o: Datei oder Verzeichnis nicht gefunden
g++: error: Wrapper.o: Datei oder Verzeichnis nicht gefunden

@dsyleixa
Copy link
Author

I have a clean git clone, no make since then.
My makefile in there looks like this - what to change exactly?

#*********************************************************************
# This is the makefile for the ArduiPi OLED library driver
#
#	02/18/2013 	Charles-Henri Hallard (http://hallard.me)
#							Modified for compiling and use on Raspberry ArduiPi Board
#							LCD size and connection are now passed as arguments on 
#							the command line (no more #define on compilation needed)
#							ArduiPi project documentation http://hallard.me/arduipi
# 
# 07/26/2013	Charles-Henri Hallard
#							modified name for generic library using different OLED type
#
# 08/26/2015	Lorenzo Delana ([email protected])
#							added bananapi specific CCFLAGS and conditional macro BANANPI
#
# *********************************************************************

# Makefile itself dir
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

# hw platform as from autogen.sh choose
HWPLAT:=$(shell cat $(ROOT_DIR)/hwplatform)

# sets CCFLAGS hw platform dependant
ifeq ($(HWPLAT),BananaPI)
	CCFLAGS=-Wall -Ofast -mfpu=vfpv4 -mfloat-abi=hard -march=armv7 -mtune=cortex-a7 -DBANANAPI
else # fallback to raspberry
	# The recommended compiler flags for the Raspberry Pi
	CCFLAGS=-Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s
endif

# Where you want it installed when you do 'make install'
PREFIX=/usr/local

# Library parameters
# where to put the lib
LIBDIR=$(PREFIX)/lib
# lib name 
LIB=libArduiPi_OLED
# shared library name
LIBNAME=$(LIB).so.1.0

CXX=g++
CC=gcc
CFLAGS=$(CCFLAGS)

# make all
# reinstall the library after each recompilation
all: ArduiPi_OLED install

# Make the library
ArduiPi_OLED: ArduiPi_OLED.o Adafruit_GFX.o bcm2835.o Wrapper.o
	$(CXX) -shared -Wl,-soname,$(LIB).so.1 $(CFLAGS) $(LDFLAGS)  -o ${LIBNAME} $^ -li2c

# Library parts (use -fno-rtti flag to avoid link problem)
ArduiPi_OLED.o: ArduiPi_OLED.cpp
	$(CXX) -Wall -fPIC -fno-rtti $(CFLAGS) -c $^

Adafruit_GFX.o: Adafruit_GFX.cpp
	$(CXX) -Wall -fPIC -fno-rtti $(CFLAGS) -c $^

bcm2835.o: bcm2835.c
	$(CC) -Wall -fPIC $(CFLAGS) -c $^

Wrapper.o: Wrapper.cpp
	$(CC) -Wall -fPIC $(CFLAGS) -c $^

# Install the library to LIBPATH
install: 
	@echo "[Install Library]"
	@if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi
	@install -m 0755 ${LIBNAME} ${LIBDIR}
	@ln -sf ${LIBDIR}/${LIBNAME} ${LIBDIR}/${LIB}.so.1
	@ln -sf ${LIBDIR}/${LIBNAME} ${LIBDIR}/${LIB}.so
	@ldconfig
	@rm -rf ${LIB}.*

	@echo "[Install Headers]"
	@if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi
	@cp -f  Adafruit_*.h $(PREFIX)/include
	@cp -f  ArduiPi_*.h $(PREFIX)/include
	@cp -f  bcm2835.h $(PREFIX)/include
	
	
# Uninstall the library 
uninstall: 
	@echo "[Uninstall Library]"
	@rm -f ${LIBDIR}/${LIB}.*

	@echo "[Uninstall Headers]"
	@rm -rf  $(PREFIX)/include/ArduiPi_OLED*
	@rm -rf  $(PREFIX)/include/bcm2835.h
	
# clear build files
clean:
	rm -rf *.o ${LIB}.* ${LIBDIR}/${LIB}.*

@dsyleixa
Copy link
Author

dsyleixa commented Apr 17, 2021

if I remove -li2c in the section"# Make the library"
and then issue a new make then I get:

pi@PiStr:~/ArduiPi_OLED $ make
g++ -Wall -fPIC -fno-rtti -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c ArduiPi_OLED.cpp
ArduiPi_OLED.cpp: In member function ‘void ArduiPi_OLED::putSeedChar(char)’:
ArduiPi_OLED.cpp:635:41: warning: array subscript has type ‘char’ [-Wchar-subscripts]
             char bit1=( seedfont[C-32][i]   >> j) & 0x01;
                                         ^
In file included from ArduiPi_OLED.cpp:36:0:
./ArduiPi_OLED_lib.h: At global scope:
./ArduiPi_OLED_lib.h:58:21: warning: ‘oled_type_str’ defined but not used [-Wunused-variable]
 static const char * oled_type_str[] = {
                     ^~~~~~~~~~~~~
g++ -Wall -fPIC -fno-rtti -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c Adafruit_GFX.cpp
In file included from Adafruit_GFX.cpp:26:0:
./ArduiPi_OLED_lib.h:58:21: warning: ‘oled_type_str’ defined but not used [-Wunused-variable]
 static const char * oled_type_str[] = {
                     ^~~~~~~~~~~~~
gcc -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c bcm2835.c
gcc -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c Wrapper.cpp
Wrapper.cpp: In function ‘int16_t Wrapper_DisplayWidth()’:
Wrapper.cpp:233:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
Wrapper.cpp: In function ‘int16_t Wrapper_DisplayHeight()’:
Wrapper.cpp:238:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
In file included from Wrapper.cpp:39:0:
./ArduiPi_OLED_lib.h: At global scope:
./ArduiPi_OLED_lib.h:58:21: warning: ‘oled_type_str’ defined but not used [-Wunused-variable]
 static const char * oled_type_str[] = {
                     ^~~~~~~~~~~~~
g++ -shared -Wl,-soname,libArduiPi_OLED.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s   -o libArduiPi_OLED.so.1.0 ArduiPi_OLED.o Adafruit_GFX.o bcm2835.o Wrapper.o 
[Install Library]
install: reguläre Datei '/usr/local/lib/libArduiPi_OLED.so.1.0' kann nicht angelegt werden: Keine Berechtigung
Makefile:72: die Regel für Ziel „install“ scheiterte
make: *** [install] Fehler 1

@dsyleixa
Copy link
Author

if I retry with "sudo" then I get

pi@PiStr:~/ArduiPi_OLED $ sudo make 
g++ -Wall -fPIC -fno-rtti -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c ArduiPi_OLED.cpp
ArduiPi_OLED.cpp: In member function ‘void ArduiPi_OLED::putSeedChar(char)’:
ArduiPi_OLED.cpp:635:41: warning: array subscript has type ‘char’ [-Wchar-subscripts]
             char bit1=( seedfont[C-32][i]   >> j) & 0x01;
                                         ^
In file included from ArduiPi_OLED.cpp:36:0:
./ArduiPi_OLED_lib.h: At global scope:
./ArduiPi_OLED_lib.h:58:21: warning: ‘oled_type_str’ defined but not used [-Wunused-variable]
 static const char * oled_type_str[] = {
                     ^~~~~~~~~~~~~
g++ -Wall -fPIC -fno-rtti -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c Adafruit_GFX.cpp
In file included from Adafruit_GFX.cpp:26:0:
./ArduiPi_OLED_lib.h:58:21: warning: ‘oled_type_str’ defined but not used [-Wunused-variable]
 static const char * oled_type_str[] = {
                     ^~~~~~~~~~~~~
gcc -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c bcm2835.c
gcc -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c Wrapper.cpp
Wrapper.cpp: In function ‘int16_t Wrapper_DisplayWidth()’:
Wrapper.cpp:233:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
Wrapper.cpp: In function ‘int16_t Wrapper_DisplayHeight()’:
Wrapper.cpp:238:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
In file included from Wrapper.cpp:39:0:
./ArduiPi_OLED_lib.h: At global scope:
./ArduiPi_OLED_lib.h:58:21: warning: ‘oled_type_str’ defined but not used [-Wunused-variable]
 static const char * oled_type_str[] = {
                     ^~~~~~~~~~~~~
g++ -shared -Wl,-soname,libArduiPi_OLED.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s   -o libArduiPi_OLED.so.1.0 ArduiPi_OLED.o Adafruit_GFX.o bcm2835.o Wrapper.o 
[Install Library]
[Install Headers]

@devel0
Copy link
Collaborator

devel0 commented Apr 17, 2021

My makefile in there looks like this - what to change exactly?

$(CXX) -shared -Wl,-soname,$(LIB).so.1 $(CFLAGS) $(LDFLAGS) -o ${LIBNAME} $^ -li2c

in this line remove ending -li2c

if I retry with "sudo" then I get

seems compilation successfully finished, it works under examples and if so the hardware you need to make it work ( oled display ) works ?

@dsyleixa
Copy link
Author

dsyleixa commented Apr 17, 2021

can't make an example work, make in folder examples failes, too.

pi@PiStr:~/ArduiPi_OLED $ cd examples
pi@PiStr:~/ArduiPi_OLED/examples $ make
g++ -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Wall  -lArduiPi_OLED oled_demo.cpp -o oled_demo
/tmp/ccJt4kv9.o: In function `testdrawbitmap(unsigned char const*, unsigned char, unsigned char)':
oled_demo.cpp:(.text+0x44): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0xf8): undefined reference to `Adafruit_GFX::drawBitmap(short, short, unsigned char const*, short, short, unsigned short)'
oled_demo.cpp:(.text+0x108): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0x14c): undefined reference to `Adafruit_GFX::drawBitmap(short, short, unsigned char const*, short, short, unsigned short)'
oled_demo.cpp:(.text+0x16c): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x198): undefined reference to `Adafruit_GFX::width()'
/tmp/ccJt4kv9.o: In function `testdrawchar()':
oled_demo.cpp:(.text+0x20c): undefined reference to `Adafruit_GFX::setTextSize(unsigned char)'
oled_demo.cpp:(.text+0x218): undefined reference to `Adafruit_GFX::setTextColor(unsigned short)'
oled_demo.cpp:(.text+0x22c): undefined reference to `Adafruit_GFX::setCursor(short, short)'
oled_demo.cpp:(.text+0x250): undefined reference to `Adafruit_GFX::write(unsigned char)'
oled_demo.cpp:(.text+0x2b4): undefined reference to `Adafruit_GFX::print(char const*)'
oled_demo.cpp:(.text+0x2cc): undefined reference to `ArduiPi_OLED::display()'
/tmp/ccJt4kv9.o: In function `testdrawcircle()':
oled_demo.cpp:(.text+0x2f8): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x304): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x32c): undefined reference to `Adafruit_GFX::drawCircle(short, short, short, unsigned short)'
oled_demo.cpp:(.text+0x334): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0x344): undefined reference to `Adafruit_GFX::height()'
/tmp/ccJt4kv9.o: In function `testfillrect()':
oled_demo.cpp:(.text+0x378): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x384): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x3b8): undefined reference to `Adafruit_GFX::fillRect(short, short, short, short, unsigned short)'
oled_demo.cpp:(.text+0x3c0): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0x3d8): undefined reference to `Adafruit_GFX::height()'
/tmp/ccJt4kv9.o: In function `testdrawtriangle()':
oled_demo.cpp:(.text+0x418): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x434): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x440): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x44c): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x458): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x464): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x470): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x4cc): undefined reference to `Adafruit_GFX::drawTriangle(short, short, short, short, short, short, unsigned short)'
oled_demo.cpp:(.text+0x4d4): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0x4e4): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x4f0): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x504): undefined reference to `Adafruit_GFX::height()'
/tmp/ccJt4kv9.o: In function `testfilltriangle()':
oled_demo.cpp:(.text+0x524): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x530): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x540): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x564): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x570): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x57c): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x588): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x594): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x5a0): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x604): undefined reference to `Adafruit_GFX::fillTriangle(short, short, short, short, short, short, unsigned short)'
oled_demo.cpp:(.text+0x610): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0x624): undefined reference to `Adafruit_GFX::height()'
/tmp/ccJt4kv9.o: In function `testdrawroundrect()':
oled_demo.cpp:(.text+0x658): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x664): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x670): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x6b4): undefined reference to `Adafruit_GFX::drawRoundRect(short, short, short, short, short, unsigned short)'
oled_demo.cpp:(.text+0x6bc): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0x6cc): undefined reference to `Adafruit_GFX::height()'
/tmp/ccJt4kv9.o: In function `testfillroundrect()':
oled_demo.cpp:(.text+0x714): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x720): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x72c): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x770): undefined reference to `Adafruit_GFX::fillRoundRect(short, short, short, short, short, unsigned short)'
oled_demo.cpp:(.text+0x778): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0x78c): undefined reference to `Adafruit_GFX::height()'
/tmp/ccJt4kv9.o: In function `testdrawrect()':
oled_demo.cpp:(.text+0x7d4): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x7e0): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x810): undefined reference to `Adafruit_GFX::drawRect(short, short, short, short, unsigned short)'
oled_demo.cpp:(.text+0x818): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0x828): undefined reference to `Adafruit_GFX::height()'
/tmp/ccJt4kv9.o: In function `testdrawline()':
oled_demo.cpp:(.text+0x870): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x890): undefined reference to `Adafruit_GFX::drawLine(short, short, short, short, unsigned short)'
oled_demo.cpp:(.text+0x898): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0x8a8): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x8cc): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x8e8): undefined reference to `Adafruit_GFX::drawLine(short, short, short, short, unsigned short)'
oled_demo.cpp:(.text+0x8f0): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0x900): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x92c): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text+0x940): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x960): undefined reference to `Adafruit_GFX::drawLine(short, short, short, short, unsigned short)'
oled_demo.cpp:(.text+0x968): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0x978): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x988): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x9ac): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0x9b8): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0x9dc): undefined reference to `Adafruit_GFX::drawLine(short, short, short, short, unsigned short)'
oled_demo.cpp:(.text+0x9e8): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0xa08): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text+0xa10): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0xa34): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0xa40): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0xa64): undefined reference to `Adafruit_GFX::drawLine(short, short, short, short, unsigned short)'
oled_demo.cpp:(.text+0xa70): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0xa80): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0xaa4): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0xab0): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0xad4): undefined reference to `Adafruit_GFX::drawLine(short, short, short, short, unsigned short)'
oled_demo.cpp:(.text+0xae0): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0xb08): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text+0xb1c): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0xb38): undefined reference to `Adafruit_GFX::drawLine(short, short, short, short, unsigned short)'
oled_demo.cpp:(.text+0xb40): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0xb50): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0xb74): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text+0xb80): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text+0xba8): undefined reference to `Adafruit_GFX::drawLine(short, short, short, short, unsigned short)'
oled_demo.cpp:(.text+0xbb0): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0xbc0): undefined reference to `Adafruit_GFX::width()'
/tmp/ccJt4kv9.o: In function `testscrolltext()':
oled_demo.cpp:(.text+0xc00): undefined reference to `Adafruit_GFX::setTextSize(unsigned char)'
oled_demo.cpp:(.text+0xc0c): undefined reference to `Adafruit_GFX::setTextColor(unsigned short)'
oled_demo.cpp:(.text+0xc1c): undefined reference to `Adafruit_GFX::setCursor(short, short)'
oled_demo.cpp:(.text+0xc24): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text+0xc3c): undefined reference to `Adafruit_GFX::print(char const*)'
oled_demo.cpp:(.text+0xc44): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text+0xc54): undefined reference to `ArduiPi_OLED::startscrollright(unsigned char, unsigned char)'
oled_demo.cpp:(.text+0xc64): undefined reference to `ArduiPi_OLED::stopscroll()'
oled_demo.cpp:(.text+0xc7c): undefined reference to `ArduiPi_OLED::startscrollleft(unsigned char, unsigned char)'
oled_demo.cpp:(.text+0xc8c): undefined reference to `ArduiPi_OLED::stopscroll()'
oled_demo.cpp:(.text+0xca4): undefined reference to `ArduiPi_OLED::startscrolldiagright(unsigned char, unsigned char)'
oled_demo.cpp:(.text+0xcbc): undefined reference to `ArduiPi_OLED::startscrolldiagleft(unsigned char, unsigned char)'
oled_demo.cpp:(.text+0xcd0): undefined reference to `ArduiPi_OLED::stopscroll()'
/tmp/ccJt4kv9.o: In function `main':
oled_demo.cpp:(.text.startup+0x18): undefined reference to `ArduiPi_OLED::oled_is_spi_proto(unsigned char)'
oled_demo.cpp:(.text.startup+0x3c): undefined reference to `ArduiPi_OLED::init(signed char, signed char, signed char, unsigned char)'
oled_demo.cpp:(.text.startup+0x4c): undefined reference to `ArduiPi_OLED::begin()'
oled_demo.cpp:(.text.startup+0x54): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0x5c): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text.startup+0x74): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0x80): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text.startup+0x90): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0x9c): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text.startup+0xac): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0xb8): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text.startup+0xc8): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0xd4): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text.startup+0xe4): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0xec): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text.startup+0xf8): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text.startup+0x124): undefined reference to `Adafruit_GFX::fillCircle(short, short, short, unsigned short)'
oled_demo.cpp:(.text.startup+0x12c): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text.startup+0x13c): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0x150): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0x164): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0x178): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0x18c): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0x198): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text.startup+0x1a8): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0x1b4): undefined reference to `Adafruit_GFX::setTextSize(unsigned char)'
oled_demo.cpp:(.text.startup+0x1c0): undefined reference to `Adafruit_GFX::setTextColor(unsigned short)'
oled_demo.cpp:(.text.startup+0x1d4): undefined reference to `Adafruit_GFX::setCursor(short, short)'
oled_demo.cpp:(.text.startup+0x1e0): undefined reference to `Adafruit_GFX::print(char const*)'
oled_demo.cpp:(.text.startup+0x1f0): undefined reference to `Adafruit_GFX::setTextColor(unsigned short, unsigned short)'
oled_demo.cpp:(.text.startup+0x204): undefined reference to `Adafruit_GFX::printf(char const*, ...)'
oled_demo.cpp:(.text.startup+0x210): undefined reference to `Adafruit_GFX::setTextSize(unsigned char)'
oled_demo.cpp:(.text.startup+0x21c): undefined reference to `Adafruit_GFX::setTextColor(unsigned short)'
oled_demo.cpp:(.text.startup+0x22c): undefined reference to `Adafruit_GFX::printf(char const*, ...)'
oled_demo.cpp:(.text.startup+0x234): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text.startup+0x244): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0x250): undefined reference to `Adafruit_GFX::setTextSize(unsigned char)'
oled_demo.cpp:(.text.startup+0x25c): undefined reference to `Adafruit_GFX::setTextColor(unsigned short)'
oled_demo.cpp:(.text.startup+0x27c): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0x28c): undefined reference to `Adafruit_GFX::setCursor(short, short)'
oled_demo.cpp:(.text.startup+0x298): undefined reference to `Adafruit_GFX::print(char const*)'
oled_demo.cpp:(.text.startup+0x2a8): undefined reference to `Adafruit_GFX::printf(char const*, ...)'
oled_demo.cpp:(.text.startup+0x2b0): undefined reference to `Adafruit_GFX::width()'
oled_demo.cpp:(.text.startup+0x2d0): undefined reference to `Adafruit_GFX::drawHorizontalBargraph(short, short, short, short, unsigned short, unsigned short)'
oled_demo.cpp:(.text.startup+0x2d8): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text.startup+0x300): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0x30c): undefined reference to `Adafruit_GFX::setTextSize(unsigned char)'
oled_demo.cpp:(.text.startup+0x31c): undefined reference to `Adafruit_GFX::setTextColor(unsigned short)'
oled_demo.cpp:(.text.startup+0x338): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0x348): undefined reference to `Adafruit_GFX::setCursor(short, short)'
oled_demo.cpp:(.text.startup+0x354): undefined reference to `Adafruit_GFX::print(char const*)'
oled_demo.cpp:(.text.startup+0x364): undefined reference to `Adafruit_GFX::printf(char const*, ...)'
oled_demo.cpp:(.text.startup+0x36c): undefined reference to `Adafruit_GFX::height()'
oled_demo.cpp:(.text.startup+0x38c): undefined reference to `Adafruit_GFX::drawVerticalBargraph(short, short, short, short, unsigned short, unsigned short)'
oled_demo.cpp:(.text.startup+0x394): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text.startup+0x3c8): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0x3d0): undefined reference to `ArduiPi_OLED::clearDisplay()'
oled_demo.cpp:(.text.startup+0x3ec): undefined reference to `Adafruit_GFX::drawBitmap(short, short, unsigned char const*, short, short, unsigned short)'
oled_demo.cpp:(.text.startup+0x3f4): undefined reference to `ArduiPi_OLED::display()'
oled_demo.cpp:(.text.startup+0x400): undefined reference to `ArduiPi_OLED::invertDisplay(unsigned char)'
oled_demo.cpp:(.text.startup+0x414): undefined reference to `ArduiPi_OLED::invertDisplay(unsigned char)'
oled_demo.cpp:(.text.startup+0x438): undefined reference to `ArduiPi_OLED::init(signed char, unsigned char)'
oled_demo.cpp:(.text.startup+0x474): undefined reference to `ArduiPi_OLED::setSeedTextXY(unsigned char, unsigned char)'
oled_demo.cpp:(.text.startup+0x484): undefined reference to `ArduiPi_OLED::setGrayLevel(unsigned char)'
oled_demo.cpp:(.text.startup+0x494): undefined reference to `ArduiPi_OLED::putSeedString(char const*)'
/tmp/ccJt4kv9.o: In function `_GLOBAL__sub_I_display':
oled_demo.cpp:(.text.startup+0x4f0): undefined reference to `ArduiPi_OLED::ArduiPi_OLED()'
collect2: error: ld returned 1 exit status
Makefile:41: die Regel für Ziel „oled_demo“ scheiterte
make: *** [oled_demo] Fehler 1

@dsyleixa
Copy link
Author

dsyleixa commented Apr 17, 2021

what a mess, I think I give up.

@devel0
Copy link
Collaborator

devel0 commented Apr 17, 2021

strange behavior, if I run make in examples, note that compile line is the same as your g++ -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Wall -lArduiPi_OLED oled_demo.cpp -o oled_demo the linker doesn't report problem.

root@raspberrypi:/usr/src/ArduiPi_OLED/examples# make
g++ -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Wall  -lArduiPi_OLED oled_demo.cpp -o oled_demo
g++ -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Wall  -lArduiPi_OLED teleinfo-oled.cpp -o teleinfo-oled
teleinfo-oled.cpp: In function ‘int tlf_check_frame(char*)’:
teleinfo-oled.cpp:476:9: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
  strncpy( buff, pframe, len+1);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
teleinfo-oled.cpp:474:14: note: length computed here
  len = strlen(pframe);
        ~~~~~~^~~~~~~~
root@raspberrypi:/usr/src/ArduiPi_OLED/examples# 

other things that could help:

@dsyleixa
Copy link
Author

dsyleixa commented Apr 17, 2021

Too complicated, I am quite a noob, no idea how to check if LD_PRELOAD and LD_LIBRARY_PATH isn't set.
It's also unreasonable to always have to use sudo.
I also don't ever use make, I just use Geany like other users do, so no idea how to proceed.

@dsyleixa
Copy link
Author

how to check if these parameters have been set?
LD_PRELOAD and LD_LIBRARY_PATH ?

and in case, how to delete?

@devel0
Copy link
Collaborator

devel0 commented Apr 17, 2021

these are environment variables so you can check if they are set supposing you are using bash through export command that show the entire list.

to search quickly

export | grep LD_

if no result they are already unset; if present to remove them ( that works for current shell session ) export -n VARNAME.

  • LD_LIBRARY_PATH influence the path where to search for libraries ( this is in addiction to default /etc/ld.so.config system paths )
  • LD_PRELOAD allow to replace a library

Its a check but I think that this isn't the problem, may some development environment broken in some way, btw you could try just for check to see if these variables are setup.

The last approach excluding a fresh os install, is to try a compile from fresh repo:

(note sudo -i will open a root prompt and you should see a sharp # prompt; for all the session you'll root differently to what happens with sudo that prefixed to command execute only that command with privileged)

sudo -i
apt install build-essential
cd /usr/src/
git clone https://github.com/hallard/ArduiPi_OLED.git
cd ArduiPi_OLED
sed -i 's/-li2c//' Makefile
make
cd examples
make

@dsyleixa
Copy link
Author

thanks, no such env vars existed.
But the rest is too complicated for me, thanks for your efforts very much though.

Best would be if the author provieded a fully functioning lib for Raspi Stretch,
just to download and copy into the /usr/include/(libraries) folders,
no sudo needed at all,
and a way to compile own proprietary programs without any makefiles
(just by #include <ArduiPi_OLED> and g++ -o -lArduiPi_OLED command line parameters or related Geany preferences),
and no option parameters for the OLED type at example start at all (just selecting the OLED type explicitely in the .cpp file).
Unfortunately I have to abandon that and have to search for another (functioning) OLED lib for the Pi.

@dsyleixa
Copy link
Author

dsyleixa commented May 29, 2021

solved by now:

clean boot from SD without having followed the instruction at http://hallard.me/adafruit-oled-display-driver-for-pi/:

## sudo apt-get install build-essential git-core libi2c-dev i2c-tools lm-sensors ## <<<< dropped!
instead: already having installed prior:
sudo apt-get install libi2c-dev i2c-tools

then
git clone https://github.com/hallard/ArduiPi_OLED

then patched the makefile by out-commenting -li2c :
cd ArduiPi_OLED
leafpad makefile

 # Make the library
ArduiPi_OLED: ArduiPi_OLED.o Adafruit_GFX.o bcm2835.o Wrapper.o
	$(CXX) -shared -Wl,-soname,$(LIB).so.1 $(CFLAGS) $(LDFLAGS)  -o ${LIBNAME} $^ #-li2c
----------------------------------------------------------------------------------------^ 

then sudo make
cd examples
sudo make
./oled_demo --help // OK!
./oled_demo --verbose --oled 3 // OK!

example program works.

compile from either working dir: linker flag -l/ArduiPi_OLED (lowercase 'L' )

(edit, no further problems so far)

@dsyleixa dsyleixa changed the title can't install the lib on my Raspberry Pi (OS Raspbian Stretch) [mainly solved] can't install the lib on my Raspberry Pi (OS Raspbian Stretch) May 29, 2021
@devel0
Copy link
Collaborator

devel0 commented May 29, 2021

@dsyleixa thx for your feedback

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

2 participants