Skip to content

multiple definition error when building a project using mpp and libvpx #580

@MarcA711

Description

@MarcA711

Rockchip mpp uses functions with the same name as libvpx. This leads to a multiple definition error when using both, mpp and libvpx, in a project together. Here is the build output when trying to build ffmpeg-rockchip from @nyanmisaka including libvpx:

/opt/ct-ng/lib/gcc/aarch64-ffbuild-linux-gnu/13.2.0/../../../../aarch64-ffbuild-linux-gnu/bin/ld/opt/ct-ng/lib/gcc/aarch64-ffbuild-linux-gnu/13.2.0/../../../../aarch64-ffbuild-linux-gnu/bin/ld: /opt/ffbuild/lib/librockchip_mpp.a(hal_vp9d_com.c.o):: (.rodata+0x0): multiple definition of `vp9_kf_partition_probs'; /opt/ffbuild/lib/libvpx.a(vp9_entropymode.c.o):(.rodata+0x190)/opt/ffbuild/lib/librockchip_mpp.a(hal_vp9d_com.c.o):(.rodata+0x0): multiple definition of `vp9_kf_partition_probs'; /opt/ffbuild/lib/libvpx.a(vp9_entropymode.c.o):(: first defined here
/opt/ct-ng/lib/gcc/aarch64-ffbuild-linux-gnu/13.2.0/../../../../aarch64-ffbuild-linux-gnu/bin/ld: /opt/ffbuild/lib/librockchip_mpp.a(hal_vp9d_com.c.o):(.rodata.rodata+0x30): multiple definition of `vp9_kf_uv_mode_prob'; /opt/ffbuild/lib/libvpx.a(vp9_entropymode.c.o):(.rodata+0x+0x190): first defined here
/opt/ct-ng/lib/gcc/aarch64-ffbuild-linux-gnu/13.2.0/../../../../aarch64-ffbuild-linux-gnu/bin/ld1c0: /opt/ffbuild/lib/librockchip_mpp.a(hal_vp9d_com.c.o):(.rodata+0x)30): multiple definition of `vp9_kf_uv_mode_prob: first defined here'; /opt/ffbuild/lib/libvpx.a(vp9_entropymode.c.o):(.rodata+0x
1c0): first defined here/opt/ct-ng/lib/gcc/aarch64-ffbuild-linux-gnu/13.2.0/../../../../aarch64-ffbuild-linux-gnu/bin/ld
/opt/ct-ng/lib/gcc/aarch64-ffbuild-linux-gnu/13.2.0/../../../../aarch64-ffbuild-linux-gnu/bin/ld: /opt/ffbuild/lib/librockchip_mpp.a(hal_vp9d_com.c.o):(.rodata: +0xb0): multiple definition of `vp9_kf_y_mode_prob'; /opt/ffbuild/lib/libvpx.a(vp9_entropymode.c.o):(.rodata/opt/ffbuild/lib/librockchip_mpp.a(hal_vp9d_com.c.o):(+0x.rodata220): first defined here+0x
b0): multiple definition of `vp9_kf_y_mode_prob'; /opt/ffbuild/lib/libvpx.a(vp9_entropymode.c.o):(.rodata+0x220): first defined here
/opt/ct-ng/lib/gcc/aarch64-ffbuild-linux-gnu/13.2.0/../../../../aarch64-ffbuild-linux-gnu/bin/ld: /opt/ffbuild/lib/librockchip_mpp.a(hal_vp9d_com.c.o):(.rodata+0x0): multiple definition of `vp9_kf_partition_probs'; /opt/ffbuild/lib/libvpx.a(vp9_entropymode.c.o):(.rodata+0x190): first defined here
/opt/ct-ng/lib/gcc/aarch64-ffbuild-linux-gnu/13.2.0/../../../../aarch64-ffbuild-linux-gnu/bin/ld: /opt/ffbuild/lib/librockchip_mpp.a(hal_vp9d_com.c.o):(.rodata+0x30): multiple definition of `vp9_kf_uv_mode_prob'; /opt/ffbuild/lib/libvpx.a(vp9_entropymode.c.o):(.rodata+0x1c0): first defined here
/opt/ct-ng/lib/gcc/aarch64-ffbuild-linux-gnu/13.2.0/../../../../aarch64-ffbuild-linux-gnu/bin/ld: /opt/ffbuild/lib/librockchip_mpp.a(hal_vp9d_com.c.o):(.rodata+0xb0): multiple definition of `vp9_kf_y_mode_prob'; /opt/ffbuild/lib/libvpx.a(vp9_entropymode.c.o):(.rodata+0x220): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:133: ffmpeg_g] Error 1
make: *** Waiting for unfinished jobs....
collect2: error: ld returned 1 exit status
make: *** [Makefile:133: ffprobe_g] Error 1
collect2: error: ld returned 1 exit status
make: *** [Makefile:133: ffplay_g] Error 1

I propose to rename the functions that are also used in the libvpx project (maybe prefix them with mpp_).

It seems, that there were files copied from the libvpx project (similar to #530). Note, that libvpx is licensed under BSD-3-Clause license. As far as I know, this license allows to modify the source code of libvpx and include it in your project, but it obliges you to add a copy of the BSD license to your project. Maybe it is enough to just add the BSD license as a comment to the source code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions