boost 1.51.0移植到ARM S3C6410成功运行
2013-06-23 11:00
489 查看
http://blog.chinaunix.net/uid-8048969-id-3374823.html
OS :Fedora 13
Boost Ver: 1.51.0
Compiler : GNU gcc 4.3.2 for ARM
[root@localhost Release]# arm-linux-gcc -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /scratch/julian/lite-respin/linux/src/gcc-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld
--enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2008q3-72' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc
--with-build-sysroot=/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/julian/lite-respin/linux/obj/host-libs-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/julian/lite-respin/linux/obj/host-libs-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
--disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72)
[root@localhost Release]
1. 确保ARM编译成功安装,并配置好环境变量。
2. 解压boost压缩包
3. 进入目录执行./bootstrap.sh, 此时形成bjam文件和project-config.jam
4. 编辑project-config.jam, 仅修改using gcc这行。因为我使用的是arm-linux-gcc,所以将其改以下即可:
using gcc : : arm-linux-gcc ;
5. 执行./bjam stage, ok大功告成.
6. 形成的静态和动态库文件就在stage目录下.
在得到boost 库后,把所需要的库放在ARM linux文件系统
我把其中的chrono system thread库放进去,并将其中boost的一个例程交叉编译运行blocking_tcp_echo_server.cpp
点击(此处)折叠或打开
//
// blocking_tcp_echo_server.cpp
//
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright
(c) 2003-2011 Christopher M. Kohlhoff
(chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0.
(See accompanying
// file LICENSE_1_0.txt
or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include <cstdlib>
#include <iostream>
#include <boost/bind.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/asio.hpp>
#include <boost/thread.hpp>
using boost::asio::ip::tcp;
const int max_length
= 1024;
typedef boost::shared_ptr<tcp::socket> socket_ptr;
void session(socket_ptr sock)
{
try
{
for (;;)
{
char data[max_length];
boost::system::error_code
error;
size_t length = sock->read_some(boost::asio::buffer(data),
error);
if (error
== boost::asio::error::eof)
break;
// Connection closed cleanly by peer.
else if
(error)
throw boost::system::system_error(error);
// Some other
error.
boost::asio::write(*sock,
boost::asio::buffer(data, length));
}
}
catch (std::exception& e)
{
std::cerr
<<
"Exception in thread: " << e.what()
<<
"\n";
}
}
void server(boost::asio::io_service& io_service,
short port)
{
tcp::acceptor a(io_service, tcp::endpoint(tcp::v4(),
port));
for (;;)
{
socket_ptr sock(new tcp::socket(io_service));
a.accept(*sock);
boost::thread t(boost::bind(session,
sock));
}
}
int main(int argc, char* argv[])
{
boost::asio::io_service io_service;
using namespace std;
// For atoi.
server(io_service, atoi(argv[1]));
return 0;
}
使用eclipse建立工程,并配置为arm-linux-g++编译
注意一点是需要将arm交叉编译的库的路径给正确加上
执行后结果发现库没找到
./boost_server
./boost_server: error while loading shared libraries: libboost_chrono.so.1.51.0: cannot open shared object file: No such file or directory
于是下载到arm平台再次执行测试
在arm linux中添加的库有下图
执行命令,端口号为2222
./boost_server 2222
开启四个客户端程序
OS :Fedora 13
Boost Ver: 1.51.0
Compiler : GNU gcc 4.3.2 for ARM
[root@localhost Release]# arm-linux-gcc -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /scratch/julian/lite-respin/linux/src/gcc-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld
--enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2008q3-72' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc
--with-build-sysroot=/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/julian/lite-respin/linux/obj/host-libs-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/julian/lite-respin/linux/obj/host-libs-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
--disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72)
[root@localhost Release]
1. 确保ARM编译成功安装,并配置好环境变量。
2. 解压boost压缩包
3. 进入目录执行./bootstrap.sh, 此时形成bjam文件和project-config.jam
4. 编辑project-config.jam, 仅修改using gcc这行。因为我使用的是arm-linux-gcc,所以将其改以下即可:
using gcc : : arm-linux-gcc ;
5. 执行./bjam stage, ok大功告成.
6. 形成的静态和动态库文件就在stage目录下.
在得到boost 库后,把所需要的库放在ARM linux文件系统
我把其中的chrono system thread库放进去,并将其中boost的一个例程交叉编译运行blocking_tcp_echo_server.cpp
点击(此处)折叠或打开
//
// blocking_tcp_echo_server.cpp
//
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright
(c) 2003-2011 Christopher M. Kohlhoff
(chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0.
(See accompanying
// file LICENSE_1_0.txt
or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include <cstdlib>
#include <iostream>
#include <boost/bind.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/asio.hpp>
#include <boost/thread.hpp>
using boost::asio::ip::tcp;
const int max_length
= 1024;
typedef boost::shared_ptr<tcp::socket> socket_ptr;
void session(socket_ptr sock)
{
try
{
for (;;)
{
char data[max_length];
boost::system::error_code
error;
size_t length = sock->read_some(boost::asio::buffer(data),
error);
if (error
== boost::asio::error::eof)
break;
// Connection closed cleanly by peer.
else if
(error)
throw boost::system::system_error(error);
// Some other
error.
boost::asio::write(*sock,
boost::asio::buffer(data, length));
}
}
catch (std::exception& e)
{
std::cerr
<<
"Exception in thread: " << e.what()
<<
"\n";
}
}
void server(boost::asio::io_service& io_service,
short port)
{
tcp::acceptor a(io_service, tcp::endpoint(tcp::v4(),
port));
for (;;)
{
socket_ptr sock(new tcp::socket(io_service));
a.accept(*sock);
boost::thread t(boost::bind(session,
sock));
}
}
int main(int argc, char* argv[])
{
boost::asio::io_service io_service;
using namespace std;
// For atoi.
server(io_service, atoi(argv[1]));
return 0;
}
使用eclipse建立工程,并配置为arm-linux-g++编译
注意一点是需要将arm交叉编译的库的路径给正确加上
执行后结果发现库没找到
./boost_server
./boost_server: error while loading shared libraries: libboost_chrono.so.1.51.0: cannot open shared object file: No such file or directory
于是下载到arm平台再次执行测试
在arm linux中添加的库有下图
执行命令,端口号为2222
./boost_server 2222
开启四个客户端程序
相关文章推荐
- boost 1.51.0移植到ARM S3C6410成功运行
- pjsip autoconf交叉编译成功,可以正常在板子上跑了-----移植到arm成功
- 基于Cocos2d-x-1.0.1的飞机大战游戏迁移到Cocos2d-x-3.0版本,并移植到Android平台成功运行
- 历史性时刻!ARM首次成功模拟运行x86
- S3C6410移植u-boot-2010.3(1)成功编译的开始
- Android2.0 Eclair在S3C6410上运行成功
- boost 移植到ARM EP9315
- (100% OK)(OK) 在VirtualBox中运行 cm-13-kiwi (华为 荣耀 5X) - 移植cm-13-kiwi - 成功
- 在ubuntu10.04成功移植gdbserver及gdbserver使用介绍(用于CCSV5.2远程调试ARM CORTEX-A8程序)
- qt程序在arm-tiny6410上的运行以及移植
- 移植waland/weston 到AM335X 在运行的时候运行不成功分析
- (OK) 移植,编译,安装 LineageOS-14.1-kiwi (Android-7.1.1,运行在Huawei honor 5x) for VirtualBox - 100% 成功
- 在android模拟器运行arm 移植的 c程序
- 移植boost_1_55_0至arm的方法小结
- Android2.0 Eclair在S3C6410上运行成功
- 成功将qt程序移植到arm板上
- pjsip autoconf交叉编译成功,可以正常在板子上跑了-----移植到arm成功
- ALSA在ARM(S3C6410)中的移植
- stm32移植ecos #7,移植ecos并成功运行helloworld程序
- (OK) 移植,编译,安装 LineageOS-14.1-kiwi (Android-7.1.1,运行在Huawei honor 5x) for VirtualBox - 95% 成功