在aarch64平台编译写入传统xls格式文件开源库xlslib的步骤

1.从xlslib主页下载源代码包xlslib-package-2.5.0.zip。
2.与平常的软件包不同,解压后首先要执行bootstrap脚本。
3.执行bootstrap脚本完成后,执行configure脚本。报错了

checking build system type... config/config.guess: unable to guess system type

This script, last modified 2009-06-10, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from

  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
and
  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD

If the version you run (config/config.guess) is already up to date, please
send the following data and any information you think might be
pertinent to <config-patches@gnu.org> in order to provide the needed
information to handle your system.

config.guess timestamp = 2009-06-10

注意这是一个2009年的软件包,那时aarch64还没有流行起来,所以脚本不能猜出我的平台,要上gnu网站下载更新的以上两个文件来替换config目录中config.guess和config.sub。
替换完毕后,再次执行configure脚本,这次成功生成了Makefile。
4.执行make
在输出很多编译文件信息后,又报错了,

...
../../src/.libs/libxls.a(continue.o):(.rodata._ZTIN11xlslib_core9CContinueE[_ZTIN11xlslib_core9CContinueE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
collect2: error: ld returned 1 exit status
Makefile:634: recipe for target 'testC' failed
make[2]: *** [testC] Error 1
make[2]: Leaving directory '/shujv/par/xlslib/targets/test'
Makefile:364: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/shujv/par/xlslib/targets'
Makefile:461: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

但是targets/test下确实生成了testCPP文件,执行此文件,成功生成了各种xls文件。再观察它的中间目录,…/…/src/.libs/,虽然没有生成libxls.a,但相应的so文件是有的,正好我们要用的就是so文件,所以这个报错不影响。

/shujv/par/xlslib$ cd targets/test
/shujv/par/xlslib/targets/test$ ./testCPP
    # Test finished


/shujv/par/xlslib/src/.libs$ ls -l libxls.so*
lrwxrwxrwx 1 kylin kylin      15 66 09:08 libxls.so -> libxls.so.3.0.0
lrwxrwxrwx 1 kylin kylin      15 66 09:08 libxls.so.3 -> libxls.so.3.0.0
-rwxrwxr-x 1 kylin kylin 3610952 66 09:08 libxls.so.3.0.0

将它们复制到我存放so文件的目录,然后,用我们自己的程序去调用这个库,成功。

g++ -std=c++14 excel_benchmark.cpp BasicExcel.cpp -o excel_benchmarkw -DUSE_BASICEXCEL -DUSE_XLSLIB -I /par/xlslib/src -O3 -lxls

./excel_benchmarkw
Benchmark report saved to benchmark_results.xls

补记:这个xlslib库是在g++ 5.4版本下编译的so文件,但不影响我用g++ 14编译的源代码用-lxls命令选项动态链接它。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值