Buildroot and GStreamer Support

Hi,

There is nothing for Buildroot on your Firmware Resources page.

So I’ve tried Amlogic’s latest Buildroot by following their instructions for mesongxl_p212_release, hoping that the differences with the VIM are limited enough.

The resulting image did not boot because of a RAM issue, so I switched to your U-Boot binary. Then, the image layout was not compatible with your U-Boot, so I tweaked the boot environment variables in U-Boot. Then, the kernel could start, but it was always oopsing, so I switched to the ubuntu branch of your kernel. The boot finally worked, but then gst-play-1.0 segfaulted (launched from the serial link):

# gst-play-1.0 /media/4K/Sony_4K_HDR_Camp.mp4
Press 'k' to see a list of keyboard shortcuts.
Now playing /media/4K/Sony_4K_HDR_Camp.mp4
[  221.724422@1] vfm_map_store:rm default
[  221.724487@1] vfm_map_store:add default decoder ppmgr deinterlace amvideo
[  221.732998@1] codec:HEVC stbuf alloced at 0000000067800000, size = 15728640
[  221.739114@1] codec:free_alloced_keep_buffer           (null).          (null).          (null)
[  221.748260@1] codec:h265:pts_unstable=0
[  221.751785@1] codec:h265: ver (201602101,0) decinfo: 3840x2160 rate=1601

[  221.781276@1] tv_vout: vout [tv_set_vframe_rate_hint] duration = 1601, policy = 1!
[  221.783189@1] tv_vout: vout [framerate_automation_process] duration = 1601
[  221.790002@1] tv_vout: framerate_automation_process[1102] fps_playing_flag = 1
[  221.797368@1] tv_vout: fr_vsource = 5994
[  221.801048@1] tv_vout: mode_target=10,is_receiver_supported=1
[  221.807118@1] tv_vout: vout [framerate_automation_set_mode] mode_target = 10
[  221.813792@1] fb: current vmode=720p60hz
[  221.827763@0] codec:hevc video changed to 4096 x 2048 30 fps clk->667MHZ
[  221.829183@0] codec:video first pts = 0
[  221.832983@0] fb: osd[0] enable: 0 (qtdemux0:sink)
[  221.861123@0] vout_serve: osd0=> x:0,y:0,w:0,h:0
[  221.861123@0] osd1=> x:0,y:0,w:0,h:0
[  221.863694@0] fb: current vmode=720p60hz
[  221.895826@0] codec:Audio stbuf alloced at 00000000771a0000, size = 1572864
[  221.897480@0] codec:audio first pts = 0
[codec_init]-[associate_dec_supported:0]
[  221.923670@0] audio_dsp: codec_fatal_err value:0

[  221.932788@1] codec:first check in apts <0x0:0x780> ok!
[  221.952517@0] aml_spdif_dai: aml_hw_iec958_init,runtime->rate=48000, same source mode(1)
[  221.954996@0] aml_spdif_dai: share the same clock
[  221.959609@0] aml_spdif_dai: iec958 mode PCM16
[  221.964139@0] aml_audio_hw: IEC958 16bit
[  221.967897@0] hdmitx: audio: aout notify rate 48000
[  221.972789@0] hdmitx: audio: aout notify size 16
[  221.977290@0] hdmitx: audio: no update
[  221.981046@0] aml_snd_m8_card aml_m8_snd.46: i2s/958 same source
[  221.987670@0] codec:audio first pts = 780
[  221.991101@0] codec:amstream_do_ioctl error :fffffffffffffdfd, 80085309
[  221.997687@0] codec:audio pts started::::::: 0
[audio_dec_init]BuildDate--Mar 30 2017  BuildTime--17:19:32MyFaadDecoder init first in
begin audio_decoder_init,buf size 768
enter NeAACDecInit
check the loas frame failed
[NeAACDecInit 1203]aac init finished. cost bits0
init sucess cost 0
[audio_decoder_init] Init OK adif_present :0 adts_present:1 latm_present:0,sr 48000,ch 2
 MyFaadDecoder decoder init finished total cost 0 bytes,consu[  222.092940@0] aml_snd_m8_card aml_m8_snd.46: I2S playback enable
[  222.097454@0] aml_snd_m8_card aml_m8_snd.46: IEC958 playback enable
med time 7 ms
[  222.159546@0] codec:timestamp_apts_enable enable:1,
[  222.159575@0] codec:audio pts started::::::: 1
[  222.166038@2] codec:video first checkin pts = 5de
[  222.167847@2] codec:first check in vpts <0x0:0x5de> ok!
[  222.173282@0] codec:Bit depth luma = 10
[  222.176818@0] codec:Bit depth chroma = 10
[  222.180798@0] codec:set pic_list_init_flag 1
[  222.185137@0] codec:allocate begin
[  222.195541@0] codec:allocate end
[  222.196110@0] codec:init_decode_head_hw: (3840, 2160) body_size 0xff0000 header_size 0x7f80
[  222.201353@2] multiqueue0:src[2571]: unhandled input address range fault (11) at 0x452a000000227, esr 0x92000004
[  222.201360@2] pgd = ffffffc064bae000
[  222.201365@2] [452a000000227] *pgd=0000000000000000
[  222.201365@2]
[  222.201372@2] CPU: 2 PID: 2571 Comm: multiqueue0:src Not tainted 3.14.29-kvim-g09040b0-dirty #1
[  222.201375@2] task: ffffffc052a47000 ti: ffffffc0647fc000 task.ti: ffffffc0647fc000
[  222.201389@2] PC is at 0x7fa2e74a78
[  222.201391@2] LR is at 0x7fa2e754a8
[  222.201393@2] pc : [<0000007fa2e74a78>] lr : [<0000007fa2e754a8>] pstate: 20000000
[  222.201394@2] sp : 0000007fa37fae60
[  222.201398@2] x29: 0000007fa37fae60 x28: 0000007f9c058280
[  222.201400@2] x27: 0000000000000001 x26: 0000007f9c0582b0
[  222.201403@2] x25: 0000000000000000 x24: 0000007f9c0580f0
[  222.201406@2] x23: 0000007f9c058128 x22: 0000007fa37faf68
[  222.201409@2] x21: 0000007f94c06830 x20: fffffffffffffff8
[  222.201412@2] x19: 0000000000000000 x18: 0000007fa37fd950
[  222.201415@2] x17: 0000007fa2e74a64 x16: 0000007fa2efda10
[  222.201418@2] x15: 0000000000bdd800 x14: 0000000000000000
[  222.201421@2] x13: 0000000000000000 x12: 0000000000000000
[  222.201423@2] x11: 0000000000000000 x10: 0000000000000000
[  222.201426@2] x9 : 0000000000000000 x8 : 0000000000000000
[  222.201429@2] x7 : 0000000000000000 x6 : 0000007fa37fb080
[  222.201437@2] x5 : 0000000000000000 x4 : 0000000000000001
[  222.201440@2] x3 : 0000000000000800 x2 : 9c0452a00000007f
[  222.201443@2] x1 : 0000007fa37faf68 x0 : 9c0452a00000007f
[  222.201443@2]
[  222.338835@0] aml_snd_m8_card aml_m8_snd.46: I2S playback disable
[  222.344784@0] aml_snd_m8_card aml_m8_snd.46: IEC958 playback disable
[  222.351234@0] codec:init_buf_spec2 3840 2160
[  222.355310@0] codec:set pic_list_init_flag to 2
[  222.356405@2] tv_vout: vout [tv_set_vframe_rate_end_hint] return mode = 10, policy = 1!
[  222.356410@2] tv_vout: vout [framerate_automation_set_mode] mode_target = 10
[  222.356438@2] fb: current vmode=720p60hz
[  222.378818@0] codec:free_alloced_keep_buffer           (null).          (null).          (null)
[  222.387257@0] codec:video first pts = 0
[  222.411199@0] codec:release cma begin
[  222.416322@0] codec:release cma end
[  222.416351@0] codec:uninit_buf_list, blackout 1 r1 buf_mode 1 r1 rel_cma_flag 1 hevc->predisp_addr 0 pre_alloc_addr(0, 0)
[  222.425146@0] codec:uninit list
[  222.441245@3] codec:hevc video changed to 0 x 0 0 fps clk->200MHZ
[  222.442902@3] codec:adec_release
[  222.444896@3] codec:video first pts = 0
[  222.448743@3] aml_spdif_dai: share the same clock
[  222.453517@3] aml_audio_hw: IEC958 16bit
[  222.457218@3] hdmitx: audio: aout notify rate 48000
[  222.462070@3] hdmitx: audio: aout notify size 16
[  222.466616@3] hdmitx: audio: no update
Segmentation fault
#

Do you have something ready for Buildroot and GStreamer on VIM that could directly be used instead of debugging this?

Why do you have several U-Boot and Linux branches? Couldn’t you have a single branch using instead different defconfigs for Nougat and Ubuntu? Couldn’t this branch be identical to Amlogic’s with only the VIM board and DTS files added?

Is there any documentation describing the current branches and why one should choose one branch rather than another in order to get all the latest fixes and features? E.g., for Buildroot on VIM, should I use one of the Vim/Nougat/ubuntu branches, or should I add support for the VIM to Amlogic’s U-Boot and Linux sources inside their Buildroot package? The ODROID-C2 is already in this package, so maybe you can ask Amlogic to add the VIM too.

Do you or Amlogic have any plans of mainlining S905X and VIM support (as complete as possible) into U-Boot, Linux, and Buildroot? That would be great and much faster than relying on the community to do it. Although Amlogic is working on Linux 4.9, their current stable version uses 3.14.29, though 3.14 is not longterm and its current iteration in mainline is 3.14.79.

By the way, the commit 2e7dc31cf2a8e3665e5c68ee03d177134b2c90ca breaks the build in your ubuntu branch of Linux with the toolchain that you recommend, because of this chunk:

diff --git a/lib/mpi/mpi-inline.h b/lib/mpi/mpi-inline.h
index e2b3985..3b176a5 100644
--- a/lib/mpi/mpi-inline.h
+++ b/lib/mpi/mpi-inline.h
@@ -30,7 +30,7 @@
 #define G10_MPI_INLINE_H
 
 #ifndef G10_MPI_INLINE_DECL
-#define G10_MPI_INLINE_DECL  extern inline
+#define G10_MPI_INLINE_DECL  inline
 #endif
 
 G10_MPI_INLINE_DECL mpi_limb_t

The build is fixed if this chunk is reverted.

1 Like

Wow, so many questions, I will try to answer all the questions one by one:

  1. We also just follow the openlinux instructions to build buildroot but didn’t do too much test on it :wink:

But I remembered that the video play works when I build buildroot-0930 version; regarding the latest buildroot-170310, I tried to build as linux-4.9, but the got the Mali GPU compile error, and I stop to forward that.

  1. Regarding the branches of U-Boot and Linux repository:
  • we tend to keep a branch to follow up the Amlogic official Android source code, in our Github, Vim branch is for Android M, and Nougat is for Android N (We might need to rename Vim branch as Mmallow)
  • ubuntu branch is for Linux Distro:
    • Linux: currently based on 3.14.29
    • U-Boot: we want to keep ENV more simple, but we didn’t found a better solution to suit both Android and Linux in a single branch yet

Yes, as what you said, we need to keep research a better way to manage the branches for different Android versions / Linux versions and Amlogic buildroot versions :slight_smile:

  1. A good idea to push Amlogic to support Khadas VIM officially, will try to do that.

  2. Martin, Neil Armstrong and their team are working at to let upstream linux to support Khadas VIM, and I’ve received a eamil from Martin that, Khadas VIM might be added to official upstream linux from v4.12.

  3. What do you mean here?

Thanks!

  1. Great news!

  2. I mean this:

lib/mpi/generic_mpih-mul1.o: In function `mpihelp_add_1':
generic_mpih-mul1.c:(.text+0x0): multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x0): first defined here
lib/mpi/generic_mpih-mul1.o: In function `mpihelp_add':
generic_mpih-mul1.c:(.text+0x7c): multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x7c): first defined here
lib/mpi/generic_mpih-mul1.o: In function `mpihelp_sub_1':
generic_mpih-mul1.c:(.text+0x174): multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x174): first defined here
lib/mpi/generic_mpih-mul1.o: In function `mpihelp_sub':
generic_mpih-mul1.c:(.text+0x1f0): multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x1f0): first defined here
lib/mpi/generic_mpih-mul2.o: In function `mpihelp_add_1':
generic_mpih-mul2.c:(.text+0x0): multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x0): first defined here
lib/mpi/generic_mpih-mul2.o: In function `mpihelp_add':
generic_mpih-mul2.c:(.text+0x7c): multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x7c): first defined here
lib/mpi/generic_mpih-mul2.o: In function `mpihelp_sub_1':
generic_mpih-mul2.c:(.text+0x174): multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x174): first defined here
lib/mpi/generic_mpih-mul2.o: In function `mpihelp_sub':
generic_mpih-mul2.c:(.text+0x1f0): multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x1f0): first defined here
lib/mpi/generic_mpih-mul3.o: In function `mpihelp_add_1':
generic_mpih-mul3.c:(.text+0x0): multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x0): first defined here
lib/mpi/generic_mpih-mul3.o: In function `mpihelp_add':
generic_mpih-mul3.c:(.text+0x7c): multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x7c): first defined here
lib/mpi/generic_mpih-mul3.o: In function `mpihelp_sub_1':
generic_mpih-mul3.c:(.text+0x174): multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x174): first defined here
lib/mpi/generic_mpih-mul3.o: In function `mpihelp_sub':
generic_mpih-mul3.c:(.text+0x1f0): multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x1f0): first defined here
lib/mpi/generic_mpih-rshift.o: In function `mpihelp_add_1':
generic_mpih-rshift.c:(.text+0x0): multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x0): first defined here
lib/mpi/generic_mpih-rshift.o: In function `mpihelp_add':
generic_mpih-rshift.c:(.text+0x7c): multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x7c): first defined here
lib/mpi/generic_mpih-rshift.o: In function `mpihelp_sub_1':
generic_mpih-rshift.c:(.text+0x174): multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x174): first defined here
lib/mpi/generic_mpih-rshift.o: In function `mpihelp_sub':
generic_mpih-rshift.c:(.text+0x1f0): multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x1f0): first defined here
lib/mpi/generic_mpih-sub1.o: In function `mpihelp_add_1':
generic_mpih-sub1.c:(.text+0x0): multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x0): first defined here
lib/mpi/generic_mpih-sub1.o: In function `mpihelp_add':
generic_mpih-sub1.c:(.text+0x7c): multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x7c): first defined here
lib/mpi/generic_mpih-sub1.o: In function `mpihelp_sub_1':
generic_mpih-sub1.c:(.text+0x174): multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x174): first defined here
lib/mpi/generic_mpih-sub1.o: In function `mpihelp_sub':
generic_mpih-sub1.c:(.text+0x1f0): multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x1f0): first defined here
lib/mpi/generic_mpih-add1.o: In function `mpihelp_add_1':
generic_mpih-add1.c:(.text+0x0): multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x0): first defined here
lib/mpi/generic_mpih-add1.o: In function `mpihelp_add':
generic_mpih-add1.c:(.text+0x7c): multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x7c): first defined here
lib/mpi/generic_mpih-add1.o: In function `mpihelp_sub_1':
generic_mpih-add1.c:(.text+0x174): multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x174): first defined here
lib/mpi/generic_mpih-add1.o: In function `mpihelp_sub':
generic_mpih-add1.c:(.text+0x1f0): multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x1f0): first defined here
lib/mpi/mpicoder.o: In function `mpihelp_add_1':
mpicoder.c:(.text+0x570): multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x0): first defined here
lib/mpi/mpicoder.o: In function `mpihelp_add':
mpicoder.c:(.text+0x5ec): multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x7c): first defined here
lib/mpi/mpicoder.o: In function `mpihelp_sub_1':
mpicoder.c:(.text+0x6e4): multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x174): first defined here
lib/mpi/mpicoder.o: In function `mpihelp_sub':
mpicoder.c:(.text+0x760): multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x1f0): first defined here
lib/mpi/mpi-bit.o: In function `mpihelp_add_1':
mpi-bit.c:(.text+0x58): multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x0): first defined here
lib/mpi/mpi-bit.o: In function `mpihelp_add':
mpi-bit.c:(.text+0xd4): multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x7c): first defined here
lib/mpi/mpi-bit.o: In function `mpihelp_sub_1':
mpi-bit.c:(.text+0x1cc): multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x174): first defined here
lib/mpi/mpi-bit.o: In function `mpihelp_sub':
mpi-bit.c:(.text+0x248): multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x1f0): first defined here
lib/mpi/mpi-cmp.o: In function `mpihelp_add_1':
mpi-cmp.c:(.text+0x148): multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x0): first defined here
lib/mpi/mpi-cmp.o: In function `mpihelp_add':
mpi-cmp.c:(.text+0x1c4): multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x7c): first defined here
lib/mpi/mpi-cmp.o: In function `mpihelp_sub_1':
mpi-cmp.c:(.text+0x2bc): multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x174): first defined here
lib/mpi/mpi-cmp.o: In function `mpihelp_sub':
mpi-cmp.c:(.text+0x338): multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x1f0): first defined here
lib/mpi/mpih-cmp.o: In function `mpihelp_add_1':
mpih-cmp.c:(.text+0x0): multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x0): first defined here
lib/mpi/mpih-cmp.o: In function `mpihelp_add':
mpih-cmp.c:(.text+0x7c): multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x7c): first defined here
lib/mpi/mpih-cmp.o: In function `mpihelp_sub_1':
mpih-cmp.c:(.text+0x174): multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x174): first defined here
lib/mpi/mpih-cmp.o: In function `mpihelp_sub':
mpih-cmp.c:(.text+0x1f0): multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x1f0): first defined here
lib/mpi/mpih-div.o: In function `mpihelp_add_1':
mpih-div.c:(.text+0x0): multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x0): first defined here
lib/mpi/mpih-div.o: In function `mpihelp_add':
mpih-div.c:(.text+0x7c): multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x7c): first defined here
lib/mpi/mpih-div.o: In function `mpihelp_sub_1':
mpih-div.c:(.text+0x174): multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x174): first defined here
lib/mpi/mpih-div.o: In function `mpihelp_sub':
mpih-div.c:(.text+0x1f0): multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x1f0): first defined here
lib/mpi/mpih-mul.o: In function `mpihelp_add_1':
mpih-mul.c:(.text+0x4f4): multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x0): first defined here
lib/mpi/mpih-mul.o: In function `mpihelp_add':
mpih-mul.c:(.text+0x570): multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x7c): first defined here
lib/mpi/mpih-mul.o: In function `mpihelp_sub_1':
mpih-mul.c:(.text+0x668): multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x174): first defined here
lib/mpi/mpih-mul.o: In function `mpihelp_sub':
mpih-mul.c:(.text+0x6e4): multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x1f0): first defined here
lib/mpi/mpi-pow.o: In function `mpihelp_add_1':
mpi-pow.c:(.text+0x920): multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x0): first defined here
lib/mpi/mpi-pow.o: In function `mpihelp_add':
mpi-pow.c:(.text+0x99c): multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x7c): first defined here
lib/mpi/mpi-pow.o: In function `mpihelp_sub_1':
mpi-pow.c:(.text+0xa94): multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x174): first defined here
lib/mpi/mpi-pow.o: In function `mpihelp_sub':
mpi-pow.c:(.text+0xb10): multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x1f0): first defined here
lib/mpi/mpiutil.o: In function `mpihelp_add_1':
mpiutil.c:(.text+0x5c): multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x0): first defined here
lib/mpi/mpiutil.o: In function `mpihelp_add':
mpiutil.c:(.text+0xd8): multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x7c): first defined here
lib/mpi/mpiutil.o: In function `mpihelp_sub_1':
mpiutil.c:(.text+0x1d0): multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x174): first defined here
lib/mpi/mpiutil.o: In function `mpihelp_sub':
mpiutil.c:(.text+0x24c): multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:generic_mpih-lshift.c:(.text+0x1f0): first defined here
scripts/Makefile.build:444: recipe for target 'lib/mpi/mpi.o' failed
make[2]: *** [lib/mpi/mpi.o] Error 1
scripts/Makefile.build:455: recipe for target 'lib/mpi' failed
make[1]: *** [lib/mpi] Error 2
Makefile:856: recipe for target 'lib' failed
make: *** [lib] Error 2
make: *** Waiting for unfinished jobs....

Hi, BenTh.WS:
I haven’t got this compile issue here with both:

  • make -j6 ARCH=arm64 CROSS_COMPILE=/opt/toolchains/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux/bin/aarch64-linux-gnu- Image
  • make -j6 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image

My host PC is Ubuntu-16.04, and default aarch64-linux-gnu-gcc comes with following version:

gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 

Can you kindly check and confirm again with this?

Hi Gouwa,

I’m building the current ubuntu branch, so at commit 09040b0aabd740df1caaead39d7ac3710f769980, on:

$ lsb_release -a
LSB Version:	core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.2 LTS
Release:	16.04
Codename:	xenial

using the recommended toolchain:

$ aarch64-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=[...]/gcc-linaro-aarch64-linux-gnu-4.9/bin/aarch64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=[...]/gcc-linaro-aarch64-linux-gnu-4.9/bin/../libexec/gcc/aarch64-linux-gnu/4.9.2/lto-wrapper
Target: aarch64-linux-gnu
Configured with: /cbuild/slaves/oorts/crosstool-ng/builds/aarch64-linux-gnu-linux/.build/src/gcc-linaro-4.9-2014.09/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=aarch64-linux-gnu --prefix=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-linux-gnu-linux/install --with-sysroot=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-linux-gnu-linux/install/aarch64-linux-gnu/libc --enable-languages=c,c++,fortran --disable-multilib --enable-multiarch --with-arch=armv8-a --with-pkgversion='crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09' --with-bugurl=https://bugs.launchpad.net/gcc-linaro --enable-__cxa_atexit --disable-libmudflap --enable-libgomp --disable-libssp --with-gmp=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-linux-gnu-linux/.build/aarch64-linux-gnu/build/static --with-mpfr=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-linux-gnu-linux/.build/aarch64-linux-gnu/build/static --with-mpc=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-linux-gnu-linux/.build/aarch64-linux-gnu/build/static --with-isl=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-linux-gnu-linux/.build/aarch64-linux-gnu/build/static --with-cloog=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-linux-gnu-linux/.build/aarch64-linux-gnu/build/static --with-libelf=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-linux-gnu-linux/.build/aarch64-linux-gnu/build/static --enable-threads=posix --disable-libstdcxx-pch --enable-linker-build-id --enable-plugin --with-local-prefix=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-linux-gnu-linux/install/aarch64-linux-gnu/libc --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.9.2 20140904 (prerelease) (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09) 

and these command lines:

$ make -j10 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- kvim_defconfig
$ make -j10 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image kvim.dtb modules

The build works with GCC 5. There is no way it can work with GCC 4.9 because inline functions are considered differently between GCC 4.9 and GCC 5. For this build, GCC 4.9 instantiates and exports the functions in each .c file using them, hence the multiple definitions, whereas GCC 5 actually always inlines them. If you want a minimalist example illustrating this:

file.h:

#ifndef _FILE_H_
#define _FILE_H_

inline void foo(void)
{
}

extern void bar(void);

#endif

file.c:

#include "file.h"

void bar(void)
{
	foo();
}

main.c:

#include "file.h"

int main(int argc, char **argv)
{
	foo();
	bar();
	return 0;
}
$ gcc-4.9 -O2 file.c main.c -o test
/tmp/ccvTINgI.o: In function `foo':
main.c:(.text+0x0): multiple definition of `foo'
/tmp/ccKtJhBO.o:file.c:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
$ gcc-5 -O2 file.c main.c -o test

With extern inline:

$ gcc-4.9 -O2 file.c main.c -o test
$ gcc-5 -O2 file.c main.c -o test
/tmp/ccHPuyKx.o: In function `foo':
main.c:(.text+0x0): multiple definition of `foo'
/tmp/ccY6VPKt.o:file.c:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status

With static inline:

$ gcc-4.9 -O2 file.c main.c -o test
$ gcc-5 -O2 file.c main.c -o test

Only static inline is correct for both GCC 4.9 and GCC 5 here. That’s why mainline has fixed the build failure with GCC 5 by replacing extern with static, instead of removing extern as has been done in commit 2e7dc31cf2a8e3665e5c68ee03d177134b2c90ca.

To test with GCC 4.9, please make sure that you have no local changes in the working directory of your repository, and that you are not building on top of a previous build. Also, with -j, the error is sometimes far away in the build log, so it may seem to succeed when it has actually failed. Check that echo $? prints 0 right after the build, or check that the target file has been generated.

1 Like

For more details about the new inline semantics in GCC 5, you can read this:
https://gcc.gnu.org/gcc-5/porting_to.html

Yes, you are right, it did happen when compile the modules.

Can you kindly make a pull request on our Github, and we will merge it then.

Thanks for the feedback!

You’re welcome.

I’ve just created a pull request.

1 Like