Linker error: undefined reference to ‘xdg_popup_interface’ - c

When trying to compile my code, I get a linker error:
undefined reference to ‘xdg_popup_interface’
It seems to occur when trying to build wlr-layer-shell-v1-client-protocol.o, I think, or something like that, I’ll have to look at the output tomorrow.
AFAIK xdg_popup should be defined by wayland-protocols? My configure.ac.in has this line:
PKG_CHECK_MODULES(WAYLAND_PROTOCOLS, [wayland-protocols >= 1.13], [ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`])
and my src/Makefile.am has this:
xfway_CFLAGS = \
$(WAYLAND_SERVER_CFLAGS) \
$(WAYLAND_PROTOCOLS_CFLAGS) \
$(LIBWESTON_CFLAGS) \
$(LIBWESTON_DESKTOP_CFLAGS) \
$(LIBINPUT_CFLAGS) \
$(XKBCOMMON_CFLAGS) \
$(EGL_CFLAGS) \
$(EVDEV_CFLAGS) \
$(GTK_CFLAGS) \
$(LIBXFCONF_CFLAGS)
xfway_LDADD = \
$(WAYLAND_SERVER_LIBS) \
$(WAYLAND_PROTOCOLS_LIBS) \
$(LIBWESTON_LIBS) \
$(LIBWESTON_DESKTOP_LIBS) \
$(LIBINPUT_LIBS) \
$(XKBCOMMON_LIBS) \
$(EGL_LIBS) \
$(EVDEV_LIBS) \
$(PIXMAN_LIBS) \
$(GTK_LIBS) \
$(LIBXFCONF_LIBS)
The autotools output listed no cflags or libs for wayland-protocols, is this normal? Though autotools detected an installed version, so it’s definitely installed.
Here is the rest of my code:
https://github.com/adlocode/xfway
This seems to be a part that mentions xdg-popup:
https://github.com/adlocode/xfway/blob/master/protocol/wlr-layer-shell-unstable-v1.xml#L194
As far as I can see everything that is needed is there, what am I missing?
Update:
Is it that I have to generate xdg-shell header files myself using wayland-scanner?

I solved this by generating header files from the xdg-shell XML file using wayland-scanner, and compiling them into my project.

Related

Convert a C project to Library to use in QT [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have a C project which spits out an executable. I want to convert that project into a library which I want to use in my QT C++ application.
I am hitting a wall. Can someone provide me any information on it?
So I have been looking at https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_application#Creating_a_static_library
I created a no-qt project to compile and it generates a .a file.
Here is my .pro file
TEMPLATE = lib
CONFIG += staticlib
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
libmnl/dhcp/dhcpclient.c \
libmnl/dhcp/dhcpmsg.c \
libmnl/dhcp/packet.c \
libmnl/attr.c \
libmnl/callback.c \
libmnl/ifutils.c \
libmnl/nlmsg.c \
libmnl/socket.c \
atc.c \
atchannel.c \
at_tok.c \
device.c \
GobiNetCM.c \
mbim-cm.c \
MPQMUX.c \
qmap_bridge_mode.c \
QMIThread.c \
QmiWwanCM.c \
udhcpc_netlink.c \
util.c
HEADERS += \
libmnl/dhcp/dhcp.h \
libmnl/dhcp/dhcpmsg.h \
libmnl/dhcp/packet.h \
libmnl/ifutils.h \
libmnl/libmnl.h \
atchannel.h \
at_tok.h \
MPQMUX.h \
QMIThread.h \
util.h
DISTFILES +=
QMAKE_CFLAGS += -Wall #-s
QMAKE_LFLAGS += -lpthread -ldl -lrt
LIBS += -pthread
My understanding tells me that my C project spits out an executable instead I want it to spit out a library and a header
Which I could then add it to my QT project
Does this help:
https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_application
Note that I have C++ libraries that I include in my Qt projects and don't have to do anything special at all. I just produce libFOO.a and then edit my Qt projects .pro file to add -L and -lFOO. Here is a cut & paste from one such project.
LIBS += -L../MyLib/lib -lMyLib
You might also have to add something like this:
INCLUDEPATH += ../MyLib/src
Notice there's no -I on this.

Missing files for SDL_Mixer

I planned on adding sound effects to a smal project.
i downloaded the SDL_Mixer dev-library for mingw32,
moved all the files from its lib folder to the mingw32 lib folder, did the same for include and bin.
But iam still not able to compile anything using #include SDL2/SDL_mixer.h.
´C:/Development/SDL Mixer/include/SDL2/SDL_mixer.h:25:10: fatal error: SDL_stdinc.h: No such file or directory´
Maybe it is my makefile.
´build:
gcc -Wfatal-errors \
-std=c99 \
./*.c \
-I"C:\Development\SDL2 MinGW 64\include" \
-L"C:\Development\SDL2 MinGW 64\lib" \
-I"C:\Development\SDL Mixer\include" \
-L"C:\Development\SDL Mixer\lib" \
-lmingw32 \
-lSDL2main \
-lSDL2 \
-o example.exe´
i dont know why files are missing.

Cross-ld can’t find libstdc++.a, but shouldn’t have been looking

I am building for arm-eabi (alias for arm-none-eabi) using GCC hosted on OS X and on Debian. The code concerned doesn’t use C++. However, the link fails on Debian with
/opt/gnat-gpl-2015/bin/../lib/gcc/arm-eabi/4.9.3/../../../../arm-eabi/bin/ld: cannot find libstdc++.a
collect2: error: ld returned 1 exit status
This surprises me because the reported link line (with -Wl,-v) doesn’t mention libstdc++ either (see at end).
The Debian build doesn’t have a cross-libstdc++.a, while the OS X build does (I don’t know how that happened; it only contains empty_arm_object.o). If I copy this libstdc++.a to the Debian side, the build works OK; but I would like to understand why it’s needed in the first place.
The link command line (edited for clarity, I hope) is
/opt/gnat-gpl-2015/bin/../lib/gcc/arm-eabi/4.9.3/../../../../arm-eabi/bin/ld \
-plugin \
/opt/gnat-gpl-2015/bin/../libexec/gcc/arm-eabi/4.9.3/liblto_plugin.so \
-plugin-opt=/opt/gnat-gpl-2015/bin/../libexec/gcc/arm-eabi/4.9.3/lto-wrapper \
-plugin-opt=-fresolution=/tmp/cctcp4CP.res \
-EL \
-X \
-o \
/home/simon/cortex-gnat-rts/test-stm32f4//testbed \
-L/home/simon/cortex-gnat-rts/test-stm32f4/.build/ \
-L/home/simon/cortex-gnat-rts/test-stm32f4/.build/ \
-L/home/simon/cortex-gnat-rts/test-stm32f4/../stm32f429i-disco-rtos/adalib/ \
-L/opt/gnat-gpl-2015/bin/../lib/gcc/arm-eabi/4.9.3/fpu \
-L/opt/gnat-gpl-2015/bin/../lib/gcc/arm-eabi/4.9.3/../../../../arm-eabi/lib/fpu \
-L/opt/gnat-gpl-2015/bin/../lib/gcc/arm-eabi/4.9.3 \
-L/opt/gnat-gpl-2015/bin/../lib/gcc \
-L/opt/gnat-gpl-2015/bin/../lib/gcc/arm-eabi/4.9.3/../../../../arm-eabi/lib \
testbed.o \
b__testbed.o \
/home/simon/cortex-gnat-rts/test-stm32f4/.build/last_chance_handler.o \
/home/simon/cortex-gnat-rts/test-stm32f4/.build/memory_streams.o \
/home/simon/cortex-gnat-rts/test-stm32f4/.build/containing.o \
/home/simon/cortex-gnat-rts/test-stm32f4/.build/dispatching.o \
/home/simon/cortex-gnat-rts/test-stm32f4/.build/iteration.o \
/home/simon/cortex-gnat-rts/test-stm32f4/.build/so.o \
/home/simon/cortex-gnat-rts/test-stm32f4/.build/streams.o \
/home/simon/cortex-gnat-rts/test-stm32f4/.build/strings.o \
/home/simon/cortex-gnat-rts/test-stm32f4/../stm32f429i-disco-rtos//adalib/libgnat.a \
/home/simon/cortex-gnat-rts/test-stm32f4/../stm32f429i-disco-rtos//adalib/libbsp-rtos.a \
-lgcc \
-Map /home/simon/cortex-gnat-rts/test-stm32f4/testbed.map \
-T /home/simon/cortex-gnat-rts/test-stm32f4/../stm32f429i-disco-rtos//adalib/stm32f429i-flash.ld
/opt/gnat-gpl-2015/bin/../lib/gcc/arm-eabi/4.9.3/../../../../arm-eabi/bin/ld: cannot find libstdc++.a
collect2: error: ld returned 1 exit status
The end of the linker script contains
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
libstdc++.a ( * )
}
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
and the first is clearly where arm-eabi-ld is finding a reference to libstdc++.a. I’m afraid that these sections were copied blindly from somewhere on the web, and I don’t know what the first is in fact for. Is it “anything from libstdc++.a that you haven’t already allocated”?
The reason that the linker was looking for libstdc++.a was that the library was mentioned in the linker script in a /DISCARD/ section.
It seems odd to include a whole file in a /DISCARD/ section, the purpose of which is to omit some sections of the input. If you don’t want to include the file, leave it out of the link command line!
Investigation revealed that ld has an unexpected behaviour in this case, in that including libc.a in a /DISCARD/ section has a very similar (if not identical) effect to including -lc in the link command line; and the link command line in use in this case ended -nostdlib -lgcc. It should have been -nostdlib -lgcc -lc. This, together with removing the peculiar /DISCARD/ section, resolved the problem.

Configuring Qt Creator for GTK+

I can't setup Qt Creator for GTK+ on Ubuntu. I'm trying to compile this example but I got errors complaining about header files :
but I fixed them by adding this to the .pro file
INCLUDEPATH += /usr/include/gtk-2.0 \
/usr/include/glib-2.0 \
/usr/lib/i386-linux-gnu/glib-2.0/include/ \
/usr/include/cairo/ \
/usr/include/pango-1.0/ \
/usr/lib/i386-linux-gnu/gtk-2.0/include/ \
/usr/include/gdk-pixbuf-2.0/ \
/usr/include/atk-1.0/
but I don't know what to add for the LIBS +=
It worked by adding
unix: CONFIG += link_pkgconfig
unix: PKGCONFIG += gtk+-2.0

How to get a list of libraries ffmpeg has linked to (static ffmpeg libraries)?

I have compiled Ffmpeg (1.0) with newt configuration:
./configure --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --disable-avdevice --disable-avfilter --disable-pthreads --disable-everything --enable-muxer=flv --enable-encoder=flv --enable-encoder=h263 --disable-mmx --disable-shared --prefix=bin/ --disable-protocols --disable-network --disable-debug --disable-asm --disable-stripping
It compiled - no errors - headers and libs (static .a) are in place. (special experimental cigwin, experimental gcc, with no asm options, and no known by ffmpeg platform defines) (yet I have compiled and tested boost on it)
Now I try to compile my app. I get next exceptions:
../ffmpeg-1.0/bin/lib/libavcodec.a: error: undefined reference to 'exp'
../ffmpeg-1.0/bin/lib/libavcodec.a: error: undefined reference to 'log'
My compiler build line looks like this:
g++ -static -emit-swf -o CloudClient.swf -I../boost/boost_libraries/install-dir/include -I../ffmpeg-1.0/bin/include -L../boost/boost_libraries/install-dir/lib -L../ffmpeg-1.0/bin/lib \
timer.o \
audio_encoder.o \
audio_generator.o \
video_encoder.o \
video_generator_rainbow.o \
simple_synchronizer.o \
multiplexer.o \
transmitter.o \
graph_runner.o \
cloud_client.o \
-pthread \
-lswscale \
-lavutil \
-lavformat \
-lavcodec \
-lboost_system \
-lboost_date_time \
-lboost_thread
So as you see quite complex and I already have all object files compiled and ready... Only one thing left - link it all to ffmpeg (striped from ffmpeg version compiled with boost)
Tried adding -lm - no help...
Well here my question is - how to get list of libraries ffmpeg linked to (like -lm etc)?
If in Linux, try
ldd /path/to/ffmpeg-binary
or
ldd `which ffmpeg`

Resources