Code not compiling on raspberry pi 4 but compiles fine on rasperry pi 3 B [Raspberry Pi]

Abhiram Shibu

Sergeant Rank 9
Jan 1, 2017
185
7,800
I have this code, currently I didn't polish it at all because its under development. But I am having an issue with compiling this. I have a sdcard with raspbean. If I put the sdcard into raspberry pi 3 and compile this, it works but if I put the sdcard and compile in raspberry pi 4, it puts out this error with linking
Bash:
/usr/bin/ld: test: in function `partitionOK':
:(.text+0xf0): multiple definition of `partitionOK'; /tmp/ccMcfdbw.o:test.c:(.text+0x0): first defined here
/usr/bin/ld: test: in function `_fini':
:(.fini+0x0): multiple definition of `_fini'; /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crti.o:(.fini+0x0): first defined here
/usr/bin/ld: test: in function `__data_start':
:(.data+0x0): multiple definition of `__data_start'; /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crt1.o:(.data+0x0): first defined here
/usr/bin/ld: test: in function `__data_start':
:(.data+0x4): multiple definition of `__dso_handle'; /usr/lib/gcc/arm-linux-gnueabihf/8/crtbegin.o:(.data+0x0): first defined here
/usr/bin/ld: test:(.rodata+0x0): multiple definition of `_IO_stdin_used'; /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crt1.o:(.rodata.cst4+0x0): first defined here
/usr/bin/ld: test: in function `_start':
:(.text+0x0): multiple definition of `_start'; /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crt1.o:(.text+0x0): first defined here
/usr/bin/ld: test: in function `main':
:(.text+0x1ac): multiple definition of `main'; /tmp/ccMcfdbw.o:test.c:(.text+0xbc): first defined here
/usr/bin/ld: test: in function `printhelp':
:(.text+0x178): multiple definition of `printhelp'; /tmp/ccMcfdbw.o:test.c:(.text+0x88): first defined here
/usr/bin/ld: test: in function `_init':
:(.init+0x0): multiple definition of `_init'; /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crti.o:(.init+0x0): first defined here
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/8/crtend.o:(.tm_clone_table+0x0): multiple definition of `__TMC_END__'; test::(.data+0x8): first defined here

collect2: error: ld returned 1 exit status


Hope you will help me, thanks in advance.
To compile..
Bash:
git clone https://github.com/ABHIRAMSHIBU/rpimultiboot/
cd rpimultiboot
gcc test.c -o test


If properly compiled
Bash:
sudo ./test -p [partitionNumberOfAlterativeBootPartition]
for example if you have mmcblk0p3 then use -p 3 Now the pi should technically boot into that partition. :)
 


Advertisement

Latest Posts