Pasthis

Raw | New paste
Never expires.
$ pwd
/yocto/build-kirkstone/tmp/work/armv8a-poky-linux/qtbase/6.5.2-r0/recipe-sysroot

$ cat test.c
#include <EGL/egl.h>

int main(int, char **) {
	EGLint x = 0; EGLDisplay dpy = 0; EGLContext ctx = 0;
	eglDestroyContext(dpy, ctx);
};

$ aarch64-linux-gnu-gcc -L$(pwd)/usr/lib --sysroot=$(pwd) test.c -Wl,--as-needed -lEGL
/usr/bin/aarch64-linux-gnu-ld: /tmp/ccMbAKvu.o: in function `main':
test.c:(.text+0x24): undefined reference to `eglDestroyContext'
collect2: error: ld returned 1 exit status

$ aarch64-linux-gnu-gcc -L$(pwd)/usr/lib --sysroot=$(pwd) test.c -Wl,--as-needed -Wl,--copy-dt-needed-entries -lEGL
/usr/bin/aarch64-linux-gnu-ld: /tmp/ccXRQ0GU.o: in function `main':
test.c:(.text+0x24): undefined reference to `eglDestroyContext'
collect2: error: ld returned 1 exit status

$ aarch64-linux-gnu-gcc -L$(pwd)/usr/lib --sysroot=$(pwd) test.c -lEGL
/usr/bin/aarch64-linux-gnu-ld: /tmp/ccwV88CE.o: undefined reference to symbol 'eglDestroyContext'
/usr/bin/aarch64-linux-gnu-ld: /yocto/build-kirkstone/tmp/work/armv8a-poky-linux/qtbase/6.5.2-r0/recipe-sysroot/usr/lib//libmali.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

#Successful linking:
$ aarch64-linux-gnu-gcc -L$(pwd)/usr/lib --sysroot=$(pwd) test.c -Wl,--copy-dt-needed-entries -lEGL

$ aarch64-linux-gnu-gcc -L$(pwd)/usr/lib --sysroot=$(pwd) test.c -Wl,--as-needed -lEGL -lmali