最近在看韦东山老师的教学视频第三期的第一个项目,感觉老师讲得非常不错,可惜个人的接受能力还有待提高,视频要反复的看,O(∩_∩)O~在写交叉编译的时候出现了问题,我的理解是freetype的库版本比我的.c文件的版本要低级,导致不能用,还没找到解决办法,不知道各位大神们有木有什么解决办法,或者给我解释一下,感激不尽。
出现问题:
book@book-desktop:/mnt/hgfs/linux/1.freetype/2arm$ arm-linux-gcc -o example1 example1.c -lfreetype -lm
/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: warning: libz.so.1, needed by /usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so, not found (try using -rpath or -rpath-link)
/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: ERROR: Source object /usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so has EABI version 0, but target example1 has EABI version 5
/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: failed to merge target specific data of file /usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `realloc@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `inflateReset'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `memset@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `inflateEnd'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `__strtol_internal@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `strrchr@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `strncpy@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `memchr@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `strcmp@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `longjmp@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `inflateInit2_'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `ftell@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `inflate'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `_setjmp@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `fseek@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `malloc@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `strstr@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `strncmp@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `fread@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `memcpy@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `strlen@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `memcmp@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `strcat@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `fopen@GLIBC_2.1'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `memmove@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `sprintf@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `qsort@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `free@GLIBC_2.0'
/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/libfreetype.so: undefined reference to `fclose@GLIBC_2.1'
collect2: ld returned 1 exit status
原因是我拷贝库文件和头文件的时候没有加-d选项,导致库文件链接的时候出问题。