yesterday I successfully build mtdev2tuio, but there were still some warnings left. So today I try to resolve these warnings.
There are 4 warning of 3 types.
the first one is "Attempt to use kernel headers from user space"
check the website
The problem comes from using wrong header files. To solve this problem, we should make our gcc to use correct include path.
In our bsp, go to root of kernel and type the command
sudo make headers_install ARCH=arm INSTALL_HDR_PATH=./usr/
It will generate header files of the kernel
check the usr directory and we find the include directory in it, good.
next, in our make file, we have to add this path for gcc while compiling
arm-none-linux-gnueabi-gcc -nostdlib -I/media/DM8134/src/board-support/linux-2.6.37-psp04.04.00.01/usr/include/ -I/mnt/hgfs/share/qtuio/liblo/include/ -I/mnt/hgfs/share/qtuio/mtdev-1.1.2/include -c mtdev2tuio.c
check the result, the warning disappeared, great!!
Next, let's take a look of these two warnings
e-linux-gnueabi-ld: warning: library search path "/usr/local/lib/liblo/lib/" is unsafe for cross-compilation
arm-none-linux-gnueabi-ld: warning: library search path "/usr/local/lib/mtdev/lib/" is unsafe for cross-compilation
These warnings come with (probably) wrong lib path setting. We cross compile object files for TI DM8134 (ARM arch) but out library refer to the path of Ubuntu(i386). It seems something wrong.
While I started to port TUIO to DM8134, I found a great reference. The author told us to cross compile necessary libs (liblo, mtdev), install them to /usr/local/lib/, and then load them in the linking stage. It is not wrong, but it is very dirty.
The better way to solve these two warnings is to set the install path of libs to our development directory. In this case, it is under targetfs/usr/lib/. So first, install them to targetfs/usr/lib/.
Second, add the path to our ld command
arm-none-linux-gnueabi-ld mtdev2tuio.o -o mtdev2tuio -L/media/DM8134/targetfs/usr/lib/liblo/lib/ -L/media/DM8134/targetfs/usr/lib/mtdev/lib/ -lmtdev -llo -lc -lgcc_s -lm
check the result again
the warning disappeared
Wwwonderful!!
Last, the warning
warning: cannot find entry symbol _start; defaulting to 000096e0
please refer to this website
add "--entry main" to tell ld what the entry function is
arm-none-linux-gnueabi-ld --entry main mtdev2tuio.o -o mtdev2tuio -L/media/DM8134/targetfs/usr/lib/liblo/lib/ -L/media/DM8134/targetfs/usr/lib/mtdev/lib/ -lmtdev -llo -lc -lgcc_s -lm
OK, we can see all warnings generated from gcc and ld are cleared.
P.S. there is still a warning, this is because I use VM to develop, and it seems cause the clock skew.





沒有留言:
張貼留言