Json-c在s3c6410上的移植
2014-10-07 15:34
239 查看
Json-c在ubuntu13.04上的安装使用
步骤:
1、 Json包:json-c-0.7.tar.gz
环境:ubuntu 13.04
Gcc : 4.2
解压缩等省略……
2、 常规3步:
./configure
Make
Make install
3、 测试
进入解压后的json-c目录,找到test1.c测试文件。
编译:gcc test1.c –ojson_test1 -std=c99 -I/usr/include/json -L/usr/lib/i386-linux-gnu/ -ljson
执行:./json_test1
结果:
my_string=
my_string.to_string()="\t"
my_string=\
my_string.to_string()="\\"
my_string=foo
my_string.to_string()="foo"
my_int=9
my_int.to_string()=9
my_array=
[0]=1
[1]=2
[2]=3
[3]=null
[4]=5
my_array.to_string()=[ 1, 2, 3, null, 5 ]
my_object=
abc:12
foo:"bar"
bool0:false
bool1:true
arr:[ 1, 2, 3, null, 5 ]
my_object.to_string()={ "abc": 12,"foo": "bar", "bool0": false, "bool1":true, "arr": [ 1, 2, 3, null, 5 ] }
new_obj.to_string()="\u0003"
new_obj.to_string()="foo"
new_obj.to_string()="foo"
new_obj.to_string()="ABC"
new_obj.to_string()=null
new_obj.to_string()=true
new_obj.to_string()=12
new_obj.to_string()=12.300000
new_obj.to_string()=[ "\n" ]
new_obj.to_string()=[ "\nabc\n" ]
new_obj.to_string()=[ null ]
new_obj.to_string()=[ ]
new_obj.to_string()=[ false ]
new_obj.to_string()=[ "abc", null,"def", 12 ]
new_obj.to_string()={ }
new_obj.to_string()={ "foo":"bar" }
new_obj.to_string()={ "foo":"bar", "baz": null, "bool0": true }
new_obj.to_string()={ "foo": [null, "foo" ] }
new_obj.to_string()={ "abc": 12,"foo": "bar", "bool0": false, "bool1":true, "arr": [ 1, 2, 3, null, 5 ] }
new_obj.to_string()={"foo": { "bar": 13 } }
错误:-ljson参数一定放到最后。
Json-c在s3c6410上的移植
步骤:
1、 Json包:json-c-0.7.tar.gz
环境:ubuntu 13.04
Gcc : 4.2
解压缩等省略……
2、
sudo ./configure --prefix=/opt/json-c--host=arm-none-linux-gnueabi
sudo make
sudo make install
./configure CC=arm-none-linux-gnueabi-gcc --prefix=/opt/json-c --host=arm-none-linux-gnueabi
Make
Make install
3、 测试
arm-none-linux-gnueabi-gcc test1.c -o json_test1 -std=c99-I/opt/json-c/include/json -L/opt/json-c/lib -ljson
注:有时候交叉编译会出现 undefined reference to rpl_malloc错误
解决方案:
json-c目录下config.h.in里定义了
#undef malloc
#undef realloc
把这两个注释, 编译顺利通过。
成功。
步骤:
1、 Json包:json-c-0.7.tar.gz
环境:ubuntu 13.04
Gcc : 4.2
解压缩等省略……
2、 常规3步:
./configure
Make
Make install
3、 测试
进入解压后的json-c目录,找到test1.c测试文件。
编译:gcc test1.c –ojson_test1 -std=c99 -I/usr/include/json -L/usr/lib/i386-linux-gnu/ -ljson
执行:./json_test1
结果:
my_string=
my_string.to_string()="\t"
my_string=\
my_string.to_string()="\\"
my_string=foo
my_string.to_string()="foo"
my_int=9
my_int.to_string()=9
my_array=
[0]=1
[1]=2
[2]=3
[3]=null
[4]=5
my_array.to_string()=[ 1, 2, 3, null, 5 ]
my_object=
abc:12
foo:"bar"
bool0:false
bool1:true
arr:[ 1, 2, 3, null, 5 ]
my_object.to_string()={ "abc": 12,"foo": "bar", "bool0": false, "bool1":true, "arr": [ 1, 2, 3, null, 5 ] }
new_obj.to_string()="\u0003"
new_obj.to_string()="foo"
new_obj.to_string()="foo"
new_obj.to_string()="ABC"
new_obj.to_string()=null
new_obj.to_string()=true
new_obj.to_string()=12
new_obj.to_string()=12.300000
new_obj.to_string()=[ "\n" ]
new_obj.to_string()=[ "\nabc\n" ]
new_obj.to_string()=[ null ]
new_obj.to_string()=[ ]
new_obj.to_string()=[ false ]
new_obj.to_string()=[ "abc", null,"def", 12 ]
new_obj.to_string()={ }
new_obj.to_string()={ "foo":"bar" }
new_obj.to_string()={ "foo":"bar", "baz": null, "bool0": true }
new_obj.to_string()={ "foo": [null, "foo" ] }
new_obj.to_string()={ "abc": 12,"foo": "bar", "bool0": false, "bool1":true, "arr": [ 1, 2, 3, null, 5 ] }
new_obj.to_string()={"foo": { "bar": 13 } }
错误:-ljson参数一定放到最后。
Json-c在s3c6410上的移植
步骤:
1、 Json包:json-c-0.7.tar.gz
环境:ubuntu 13.04
Gcc : 4.2
解压缩等省略……
2、
sudo ./configure --prefix=/opt/json-c--host=arm-none-linux-gnueabi
sudo make
sudo make install
./configure CC=arm-none-linux-gnueabi-gcc --prefix=/opt/json-c --host=arm-none-linux-gnueabi
Make
Make install
3、 测试
arm-none-linux-gnueabi-gcc test1.c -o json_test1 -std=c99-I/opt/json-c/include/json -L/opt/json-c/lib -ljson
注:有时候交叉编译会出现 undefined reference to rpl_malloc错误
解决方案:
json-c目录下config.h.in里定义了
#undef malloc
#undef realloc
把这两个注释, 编译顺利通过。
成功。
相关文章推荐
- S3C6410移植日记.
- linux 3.4.103 内核移植到 S3C6410 开发板 移植失败 (问题总结,来日再战!)
- 移植jsoncpp到安卓
- APPWeb+PHP5+SQLite3在S3C6410上移植之三
- boost 1.51.0移植到ARM S3C6410成功运行
- 嵌入式linux usb wifi移植[s3c6410平台 转载]
- Qt/E4.7 在s3c6410上的移植
- boa服务器移植到 s3c6410开发板
- Cocos2d-x移植到WindowsPhone8移植问题-框架rapidjson移植问题
- APPWeb+PHP5+SQLite3在S3C6410上移植之四
- json移植到ARM板
- 基于S3C6410的ARM11 移植printf和scanf
- S3C6410 移植Android 内核移植经验
- S3C6410移植u-boot-2013.01
- s3c6410 触摸屏驱动移植
- s3c6410下移植sqlite3.7.8
- s3c6410 内核移植 3.0.1
- S3C6410移植u-boot
- 在s3c6410上移植lm8333键盘驱动
- 嵌入式web server boa 在s3c6410上的移植