linux libbz2.so.1,mipsel-linux-uclibc交叉编译 libbzip2

作者提供了一个编译so的脚本:

看起来只用CC,很简单的。

不过作者提供的Makefile很复杂,不懂这俩有啥区别。

# This Makefile builds a shared version of the library,

# libbz2.so.1.0.6, with soname libbz2.so.1.0,

# at least on x86-Linux (RedHat 7.2),

# with gcc-2.96 20000731 (Red Hat Linux 7.1 2.96-98).

# Please see the README file for some important info

# about building the library like this.

# ------------------------------------------------------------------

# This file is part of bzip2/libbzip2, a program and library for

# lossless, block-sorting data compression.

#

# bzip2/libbzip2 version 1.0.6 of 6 September 2010

# Copyright (C) 1996-2010 Julian Seward

#

# Please read the WARNING, DISCLAIMER and PATENTS sections in the

# README file.

#

# This program is released under the terms of the license contained

# in the file LICENSE.

# ------------------------------------------------------------------

SHELL=/bin/sh

CC=gcc

BIGFILES=-D_FILE_OFFSET_BITS=64

CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES)

OBJS= blocksort.o \

huffman.o \

crctable.o \

randtable.o \

compress.o \

decompress.o \

bzlib.o

all: $(OBJS)

$(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS)

$(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.6

rm -f libbz2.so.1.0

ln -s libbz2.so.1.0.6 libbz2.so.1.0

clean:

rm -f $(OBJS) bzip2.o libbz2.so.1.0.6 libbz2.so.1.0 bzip2-shared

blocksort.o: blocksort.c

$(CC) $(CFLAGS) -c blocksort.c

huffman.o: huffman.c

$(CC) $(CFLAGS) -c huffman.c

crctable.o: crctable.c

$(CC) $(CFLAGS) -c crctable.c

randtable.o: randtable.c

$(CC) $(CFLAGS) -c randtable.c

compress.o: compress.c

$(CC) $(CFLAGS) -c compress.c

decompress.o: decompress.c

$(CC) $(CFLAGS) -c decompress.c

bzlib.o: bzlib.c

$(CC) $(CFLAGS) -c bzlib.c

zhangbin@bogon:~/bcm/unimedia/depvlc/libbzip2/code_bzip2-1.0.6$ zhangbin@bogon:~/bcm/unimedia/depvlc/libbzip2/code_bzip2-1.0.6$

zhangbin@bogon:~/bcm/unimedia/depvlc/libbzip2/code_bzip2-1.0.6$

zhangbin@bogon:~/bcm/unimedia/depvlc/libbzip2/code_bzip2-1.0.6$ source   bzip2_build.sh

mipsel-linux-uclibc-gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c blocksort.c

mipsel-linux-uclibc-gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c huffman.c

mipsel-linux-uclibc-gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c crctable.c

mipsel-linux-uclibc-gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c randtable.c

mipsel-linux-uclibc-gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c compress.c

mipsel-linux-uclibc-gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c decompress.c

mipsel-linux-uclibc-gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c bzlib.c

mipsel-linux-uclibc-gcc -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 blocksort.o huffman.o crctable.o randtable.o compress.o decompress.o bzlib.o

mipsel-linux-uclibc-gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -o bzip2-shared bzip2.c libbz2.so.1.0.6

/tmp/ccf3RPEE.o: In function `applySavedTimeInfoToOutputFile':

/home/lbteam/zhangbin/bcm/unimedia/depvlc/libbzip2/code_bzip2-1.0.6/bzip2.c:1059: warning: the use of OBSOLESCENT `utime' is discouraged, use `utimes'

rm -f libbz2.so.1.0

ln -s libbz2.so.1.0.6 libbz2.so.1.0

zhangbin@bogon:~/bcm/unimedia/depvlc/libbzip2/code_bzip2-1.0.6$

只需要so文件就好了吧。

0818b9ca8b590ca3270a3433284dd417.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值