Today I want to cross-compile libwebsocket into the cortex A-8, after installing the cross compiler, start ..
1. libwebsocket is configured with autoconf. you must first understand the cross-Compilation of autoconf. After checking the information on the Internet, you can configure it successfully:
Use autotools to generate the configure script and run the following command: CC = arm-none-linux-gnueabi-gcc. /configure -- build = i686-pc-linux -- host = arm-none-linux-gnueabi and then run the make command note: here, the CC and -- host formats are the same (I am stuck with this issue for a long time by referring to the website below)
Reference: http://his9932.blog.51cto.com/2915040/564943
2. When making, zlib appears. I can't find the problem. I found that zlib1g is missing on the Internet, but I found that I have installed it, And zlib exists during gcc compilation. Later, I browsed the web page and saw that zlib was also required to be cross-compiled. So I downloaded the zlib source code, cross-compiled, and configured it. I can use it ~~ (The website does not know where it is)
3. When cross-compiling zlib, You need to configure
1)./configure -- shared -- prefix =/installation path
Make LDSHARED = "arm-none-linux-gnueabi-gcc-shared-Wl,-soname, libz. so.1 "CC_FOR_BUILD =" arm-none-linux-gnueabi-gcc "CC =" arm-none-linux-gnueabi-gcc"
LD = "arm-none-linux-gnueabi-ld" CPP = "arm-none-linux-gnueabi-g ++-E" AR = "arm-none-linux-gnueabi -ar "prefix ="/usr/local/arm/2.95.3 "CFLAGS ="-fPIC"
Libz. so.1.2.7 libz.
2) Copy zconf. h zlib. h to/usr/local/arm/2.95.3/arm-linux/include/
Copy libz. so * To/usr/local/arm/2.95.3/arm-linux/lib/
Note:/usr/local/arm/2.95.3/is the path for cross-compilation and installation.
Unlike the Reference URL, AR = "arm-none-linux-gnueabi-ar" is missing.
Rc, because it has been going on for a long time, the lack of libz. a will occur when rc is added.
Reference: http://blog.csdn.net/wwwxxlby520/article/details/4384361
4. After the compilation is successful, copy the executable file to the Development Board and the prompt bash -- not found is displayed. use the file filename command to check whether the file is displayed
ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID [sha1] = running, not stripped
Can run files, but the files compiled by arm-none-linux-gcc are found to be
Bourne-Again shell script, ASCII text executable, with very long lines
It is a script file, not a runable file. open the file and find that the comment says libwebsockets-test-server-temporary wrapper script. libs/libwebsockets-test-server. view the files in libs and find that they are executable files.
ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped.