当前位置: 首页 > 工具软件 > bash2mp4 > 使用案例 >

mp4v2编译(含交叉编译)

寿元白
2023-12-01

下载开源库

新建文件夹,用于存放生成的库

cd
mkdir mp4v2_out

指定目录 指定编译器 指定规则

autoreconf -i
//报错不影响编译

./configure
./configure CFLAGS="-O2 -muclibc" CPPFLAGS="-O2 -muclibc" CXXFLAGS="-O2 -muclibc" LDFLAGS="-O2 -muclibc" CC=mips-linux-gnu-gcc CXX=mips-linux-gnu-g++ --host=mips-linux-gnu --prefix=/home/test/mp4v2_out(自己指定) --disable-option-checking --disable-debug --disable-optimize --disable-fvisibility --disable-gch --disable-largefile --disable-util --disable-dependency-tracking --disable-libtool-lock

3).(GNUmakefile/Makefile)
在CFLAGS/CPPFLAGS/CXXFLAGS/LDFLAGS添加选项 -muclibc
此项.config已经配置

编译

make

make install
//库会直接到prefix配置的目录里去

其他参考

https://blog.csdn.net/aaa794708075/article/details/79130901

使用gcc编译

重新配置,删除mips相关

./configure CFLAGS="-O2" CPPFLAGS="-O2" CXXFLAGS="-O2" LDFLAGS="-O2" CC=gcc CXX=g++ --prefix=/home/test/mp4v2_out(自己指定) --disable-option-checking --disable-debug --disable-optimize --disable-fvisibility --disable-gch --disable-largefile --disable-util --disable-dependency-tracking --disable-libtool-lock

make时会报错

/bin/bash ./libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H   -I./include -I./include -I. -I. -O2 -Wall -Wformat  -c -o src/3gp.lo src/3gp.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I./include -I./include -I. -I. -O2 -Wall -Wformat -c src/3gp.cpp  -fPIC -DPIC -o src/.libs/3gp.o
In file included from ./src/src.h:28:0,
                 from ./src/impl.h:6,
                 from src/3gp.cpp:28:
./src/mp4util.h: In function ‘void* mp4v2::impl::MP4Malloc(size_t)’:
./src/mp4util.h:58:41: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
   log.errorf("MP4Malloc size=%d\n", size);
                                         ^
In file included from ./include/libavcodec/hevc.h:111:0,
                 from ./src/mp4file.h:36,
                 from ./src/src.h:31,
                 from ./src/impl.h:6,
                 from src/3gp.cpp:28:
./include/libavformat/avio.h: At global scope:
./include/libavformat/avio.h:100:29: error: conflicting declaration ‘typedef long long unsigned int uint64_t’
 typedef unsigned long long  uint64_t;
                             ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h:9:0,
                 from /usr/include/inttypes.h:27,
                 from ./libplatform/platform_posix.h:32,
                 from ./libplatform/platform.h:24,
                 from ./src/src.h:6,
                 from ./src/impl.h:6,
                 from src/3gp.cpp:28:
/usr/include/stdint.h:55:27: note: previous declaration as ‘typedef long unsigned int uint64_t’
 typedef unsigned long int uint64_t;
                           ^
In file included from ./include/libavcodec/hevc.h:111:0,
                 from ./src/mp4file.h:36,
                 from ./src/src.h:31,
                 from ./src/impl.h:6,
                 from src/3gp.cpp:28:
./include/libavformat/avio.h:105:27: error: conflicting declaration ‘typedef long long int int64_t’
 typedef signed long long  int64_t;
                           ^
In file included from /usr/include/stdlib.h:314:0,
                 from /usr/include/c++/5/cstdlib:72,
                 from ./libplatform/platform_base.h:26,
                 from ./libplatform/platform_posix.h:31,
                 from ./libplatform/platform.h:24,
                 from ./src/src.h:6,
                 from ./src/impl.h:6,
                 from src/3gp.cpp:28:
/usr/include/x86_64-linux-gnu/sys/types.h:197:1: note: previous declaration as ‘typedef long int int64_t’
 __intN_t (64, __DI__);
 ^
make: *** [src/3gp.lo] Error 1

注释掉重复定义的内容

vim include/libavformat/avio.h

/* typedef unsigned long long 	uint64_t; */

/* typedef signed long long 	int64_t; */

 类似资料: