embear-engineering / drm-framebuffer

A simple application which can be used to test a Linux DRM device
GNU General Public License v3.0
55 stars 21 forks source link

Cross compiling #5

Closed jwestman89 closed 1 year ago

jwestman89 commented 1 year ago

Does this require a specific version of the kernel? I'm trying to XCC but no luck so far.

make aarch64-poky-linux-gcc -march=armv8-a+crc+crypto -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/armv8a-poky-linux -I "../opt/fsl-imx-wayland/5.15-kirkstone/sysroots/armv8a-poky-linux/usr/include/" -c main.c -O2 -pipe -g -feliminate-unused-debug-types
aarch64-poky-linux-gcc -march=armv8-a+crc+crypto -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/armv8a-poky-linux -O2 -pipe -g -feliminate-unused-debug-types -o drm-framebuffer -I "../opt/fsl-imx-wayland/5.15-kirkstone/sysroots/armv8a-poky-linux/usr/include/" main.o framebuffer.o -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: main.o: in function fill_framebuffer_from_stdin': /home/serstech/drm-framebuffer/main.c:194: undefined reference todrmSetMaster' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:200: undefined reference to drmModeSetCrtc' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:201: undefined reference todrmModeSetCrtc' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:202: undefined reference to drmDropMaster' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: main.o: in functionget_resolution': /home/serstech/drm-framebuffer/main.c:123: undefined reference to drmModeGetResources' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:134: undefined reference todrmModeGetConnectorCurrent' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:144: undefined reference to drmModeFreeConnector' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: main.o: in functionlist_resources': /home/serstech/drm-framebuffer/main.c:59: undefined reference to drmModeGetResources' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:71: undefined reference todrmModeGetConnectorCurrent' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:79: undefined reference to drmModeGetEncoder' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:85: undefined reference todrmModeFreeEncoder' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:86: undefined reference to drmModeFreeConnector' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:105: undefined reference todrmModeFreeResources' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: main.o: in function get_resolution': /home/serstech/drm-framebuffer/main.c:170: undefined reference todrmModeFreeConnector' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:171: undefined reference to drmModeFreeResources' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: framebuffer.o: in functionrelease_framebuffer': /home/serstech/drm-framebuffer/framebuffer.c:51: undefined reference to drmSetMaster' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:54: undefined reference todrmModeSetCrtc' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:55: undefined reference to drmModeFreeCrtc' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:61: undefined reference todrmModeFreeConnector' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:58: undefined reference to drmModeGetFB' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:58: undefined reference todrmModeFreeFB' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: framebuffer.o: in function get_framebuffer': /home/serstech/drm-framebuffer/framebuffer.c:86: undefined reference todrmModeGetResources' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:97: undefined reference to drmModeGetConnectorCurrent' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:107: undefined reference todrmModeFreeConnector' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:141: undefined reference to drmModeAddFB' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:148: undefined reference todrmModeGetEncoder' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:156: undefined reference to drmModeGetCrtc' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:163: undefined reference todrmIoctl' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:177: undefined reference to drmDropMaster' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:186: undefined reference todrmModeFreeEncoder' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:186: undefined reference to drmModeFreeEncoder' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:186: undefined reference todrmModeFreeEncoder' collect2: error: ld returned 1 exit status make: *** [Makefile:14: all] Error 1

eichenberger commented 1 year ago

Hi @jwestman89 This is most likely because it can't find libdrm. You can fix that by manually specifying the path:

export LDFLAGS="-L/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/armv8a-poky-linux/usr/lib/ -ldrm"

You should have a libdrm.so in that directory

jwestman89 commented 1 year ago

@eichenberger Thank you, Stefan. That was indeed the problem. Just a heads up to any future reader who is trying to cross compile in a yocto project with the same errors - check if $LDFLAGS is already set and is overwriting the LDFLAGS that is defined in the Makefile - in my case this was the issue. I just renamed the LDFLAGS variable in the Makefile and it worked without any issues.