I'm trying to compile a package; specifically, the plugin gkrellm-leds
for gkrellm
. I downloaded the sources from packages.ubuntu.com/source/zesty/gkrellm-leds .
After compiling and installing it, it does not work. The program that should use it, gkrellm
, does not even show it as plugin available.
As it is not the first time these things happen to me, the first thing I did was
> ldd gkleds.so
linux-vdso.so.1 = > (0x00007ffe15def000)
libc.so.6 = > /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2fc6f37000)
/lib64/ld-linux-x86-64.so.2 (0x0000557eb4014000)
I know that this package uses the GTK-2.0 libraries, as well as others. In fact, the source code is full of calls to functions of these libraries.
The Makefile
of the package is:
SHELL = /bin/sh
VPATH = src:src/pixmaps
GTK_INCLUDE = 'pkg-config gtk+-2.0 --cflags'
GTK_LIB = 'pkg-config gtk+-2.0 --libs'
X11_LIB = -L/usr/X11R6/lib -lX11 -lXtst
LIBS = $(GTK_LIB) $(X11_LIB)
DEFINES =
LFLAGS = -shared
INCLUDES = $(GTK_INCLUDE)
CFLAGS = -ansi -pedantic -Wall -O2 -fPIC
CC = gcc
SRCS = gkleds.c
HDRS = gkleds.h
OBJS = gkleds.o
IMAGES = leds.xpm
DESTDIR =
INSTALL_PROG = install
.PHONY : clean
.PHONY : install
.PHONY : uninstall
.PHONY : test
#=======================================================================
#=======================================================================
gkleds.so : $(OBJS)
$(CC) $(LFLAGS) $(LIBS) -o $@ $<
gkleds.o : $(SRCS) $(HDRS) $(IMAGES)
$(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) -c -o $@ $<
test :
$(MAKE) clean
$(MAKE) DEFINES="-DGKLEDS_DEBUG"
gkrellm --sync --demo -p gkleds.so
$(MAKE) clean
clean:
rm -rf *.o *.so* *~ \#*
rm -rf src/*~ src/\#*
install : gkleds.so
@ if [ "$$UID" -ne 0 ]; \
then PLUGIN_DIR=$$HOME/.gkrellm2/plugins; \
elif [ -e /usr/bin/gkrellm ]; \
then PLUGIN_DIR=/usr/lib/gkrellm2/plugins; \
else \
PLUGIN_DIR=/usr/local/lib/gkrellm2/plugins; \
fi; \
$(INSTALL_PROG) -d $(DESTDIR)/$$PLUGIN_DIR; \
$(INSTALL_PROG) -s gkleds.so $(DESTDIR)/$$PLUGIN_DIR; \
printf "\ngkleds installed in $$PLUGIN_DIR\n"
All compilation dependencies are correctly installed, as well as the corresponding pkg-config
:
> pkg-config gtk+-2.0 --cflags
-pthread -I / usr / include / gtk-2.0 -I / usr / lib / x86_64-linux-gnu / gtk-2.0 / include -I / usr / include / gio-unix-2.0 / -I / usr / include / cairo -I / usr / include / pango-1.0 -I / usr / include / atk-1.0 -I / usr / include / cairo -I / usr / include / pixman-1 -I / usr / include / libpng16 -I / usr / include / gdk-pixbuf-2.0 -I / usr / include / libpng16 -I / usr / include / pango-1.0 -I / usr / include / harfbuzz -I / usr / include / pango-1.0 -I /usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu / glib-2.0 / include -I / usr / include / freetype2
> pkg-config gtk+-2.0 --libs
-lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 - lfontconfig -lfreetype
Anyway, to make sure, I dump the results of pkg-config
in a separate file, extra.mk
, and I modified the original Makefile
to include mine, adding include extra.mk
and eliminating the definitions of GTK_INCLUDE
and GTK_LIB
.
After that small modification, when doing make
, apart from several irrelevant warnings , the following is shown:
gcc -DGKLEDS_DEBUG -ansi -pedantic -Wall -O2 -fPIC -pthread -I / usr / include / gtk-2.0 -I / usr / lib / x86_64-linux-gnu / gtk-2.0 / include -I / usr /include/gio-unix-2.0/ -I / usr / include / cairo -I / usr / include / pango-1.0 -I / usr / include / atk-1.0 -I / usr / include / cairo -I / usr / include / pixman-1 -I / usr / include / libpng16 -I / usr / include / gdk-pixbuf-2.0 -I / usr / include / libpng16 -I / usr / include / pango-1.0 -I / usr / include / harfbuzz -I / usr / include / pango-1.0 -I / usr / include / glib-2.0 -I / usr / lib / x86_64-linux-gnu / glib-2.0 / include -I / usr / include / freetype2 -c - or gkleds.o src / gkleds.c ...
... VARIOUS WARNINGS ...
...
gcc -shared -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 - lfontconfig -lfreetype -lX11 -lXtst -o gkleds.so gkleds.o
You can see how, in the last part, it calls gcc
with the correct options and libraries.
However, if I do it again
> ldd gkleds.so
linux-vdso.so.1 = > (0x00007ffe15def000)
libc.so.6 = > /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2fc6f37000)
/lib64/ld-linux-x86-64.so.2 (0x0000557eb4014000)
It still does not show dependencies of the GTK or any other, apart from the default added by the gcc
.