You are not logged in.

#1 2020-06-01 19:57:16

amlamarra
Member
Registered: 2015-06-25
Posts: 50

Unable to compile with the cross-mipsel-linux-gnu-gcc package

I'm trying to get a gcc mipsel cross compiler. I installed the cross-mipsel-linux-gnu-gcc package and tried to compile a simple hello-world.c program:

$ mipsel-linux-gnu-gcc -nolibc test.c 
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/ld: cannot find crt1.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/ld: cannot find -lgcc
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/ld: cannot find -lgcc
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/ld: cannot find crtend.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status

Does anyone know how to fix this?

Last edited by amlamarra (2020-06-01 23:55:20)

Offline

#2 2020-06-01 20:58:20

loqs
Member
Registered: 2014-03-06
Posts: 17,373

Re: Unable to compile with the cross-mipsel-linux-gnu-gcc package

Is the mipsel-linux-gcc package intended to run without libc?  What if you pass the -nolibc option to mipsel-linux-gnu-gcc?

Offline

#3 2020-06-01 21:09:31

amlamarra
Member
Registered: 2015-06-25
Posts: 50

Re: Unable to compile with the cross-mipsel-linux-gnu-gcc package

It is intended to be run WITH libc. When I tried the "-nolibc" option, I got the same results.

Offline

#4 2020-06-01 21:26:06

loqs
Member
Registered: 2014-03-06
Posts: 17,373

Re: Unable to compile with the cross-mipsel-linux-gnu-gcc package

Is there an equivalent to https://aur.archlinux.org/packages/powe … gnu-glibc/ for mipsel-linux-gnu?
Edit:
https://aur.archlinux.org/cgit/aur.git/ … nu-gcc#n30

	./configure \
		"--prefix=${_sysroot}" \
		"--bindir=/usr/bin" "--program-prefix=${_target}-" \
		"--with-sysroot=${_sysroot}" \
		"--target=${_target}" \
		--oldincludedir=/../../../usr/include \
		--with-gnu-as --with-gnu-ld \
		--disable-nls --disable-threads \
		--enable-languages=c,c++ \
		--disable-multilib --disable-libgcj \
		--enable-lto --disable-werror \
		--without-headers --disable-shared
	
	make all-gcc "inhibit_libc=true"

Why would the build be passing --without-headers to configure and "inhibit_libc=true" to make if the package was intended to use libc?

Last edited by loqs (2020-06-01 21:37:29)

Offline

#5 2020-06-01 21:41:33

mpan
Member
Registered: 2012-08-01
Posts: 1,208
Website

Re: Unable to compile with the cross-mipsel-linux-gnu-gcc package

amlamarra:
Since there is no package named “cross-mipsel-linux-gnu-gcc”, I asume you mean your own package based on cross-mipsel-linux-gnu-gcc. The one thing that doesn’t fit i that your output suggests gcc-4.9.4, while the PKGBUILD is building gcc-10.1.0. So are we talking about the same thing?

If this is the case, have you read the comments on the AUR page? They are clear this is not a mipel-linux-gnu, but mipsel-none-gnu. The name of the package is wrong. It is built without libc.

Last edited by mpan (2020-06-01 21:42:09)


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#6 2020-06-01 21:51:36

loqs
Member
Registered: 2014-03-06
Posts: 17,373

Re: Unable to compile with the cross-mipsel-linux-gnu-gcc package

https://aur.archlinux.org/packages/cros … gnu-gcc49/ ?
Edit:
What as the output of:

cat test.c
mipsel-linux-gnu-gcc -v test.c 

Last edited by loqs (2020-06-01 22:21:33)

Offline

#7 2020-06-01 23:15:32

amlamarra
Member
Registered: 2015-06-25
Posts: 50

Re: Unable to compile with the cross-mipsel-linux-gnu-gcc package

mpan wrote:

amlamarra:
Since there is no package named “cross-mipsel-linux-gnu-gcc”, I asume you mean your own package based on cross-mipsel-linux-gnu-gcc. The one thing that doesn’t fit i that your output suggests gcc-4.9.4, while the PKGBUILD is building gcc-10.1.0. So are we talking about the same thing?

If this is the case, have you read the comments on the AUR page? They are clear this is not a mipel-linux-gnu, but mipsel-none-gnu. The name of the package is wrong. It is built without libc.

I'm not sure what you mean. There IS a package called "cross-mipsel-linux-gnu-gcc", which is what I installed and attempted to use. I did read the comments on the AUR page, but I'm not sure what it means or what to do about it.

And I'm not referring to any of my packages. I'm basically looking for the equivalent of the "gcc-8-mipsel-linux-gnu" package available in the Debian repos. Something that'll let me use GCC to compile C source code to the mipsel architecture.

Last edited by amlamarra (2020-06-01 23:21:32)

Offline

#8 2020-06-01 23:17:31

amlamarra
Member
Registered: 2015-06-25
Posts: 50

Re: Unable to compile with the cross-mipsel-linux-gnu-gcc package

loqs wrote:

https://aur.archlinux.org/packages/cros … gnu-gcc49/ ?
Edit:
What as the output of:

cat test.c
mipsel-linux-gnu-gcc -v test.c 
andrew ~/build $ cat test.c 
int main () {
  ;
  return 0;
}
andrew ~/build $ mipsel-linux-gnu-gcc -v test.c 
Using built-in specs.
COLLECT_GCC=mipsel-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/usr/lib/cross-mipsel-linux-gnu/libexec/gcc/mipsel-linux-gnu/10.1.0/lto-wrapper
Target: mipsel-linux-gnu
Configured with: ./configure --prefix=/usr/lib/cross-mipsel-linux-gnu --bindir=/usr/bin --program-prefix=mipsel-linux-gnu- --with-sysroot=/usr/lib/cross-mipsel-linux-gnu --target=mipsel-linux-gnu --oldincludedir=/../../../usr/include --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c,c++ --disable-multilib --disable-libgcj --enable-lto --disable-werror --without-headers --disable-shared
Thread model: single
Supported LTO compression algorithms: zlib zstd
gcc version 10.1.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-mllsc' '-mno-shared' '-EL' '-mabi=32'
 /usr/lib/cross-mipsel-linux-gnu/libexec/gcc/mipsel-linux-gnu/10.1.0/cc1 -quiet -v test.c -mel -quiet -dumpbase test.c -mllsc -mno-shared -mabi=32 -auxbase test -version -o /tmp/ccOybt4u.s
GNU C17 (GCC) version 10.1.0 (mipsel-linux-gnu)
        compiled by GNU C version 10.1.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/lib/cross-mipsel-linux-gnu/usr/local/include"
ignoring nonexistent directory "/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/include"
ignoring nonexistent directory "/usr/lib/cross-mipsel-linux-gnu/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/include
 /usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/include-fixed
End of search list.
GNU C17 (GCC) version 10.1.0 (mipsel-linux-gnu)
        compiled by GNU C version 10.1.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 3f2ddb86c77c63cd35ba6d0381981f16
COLLECT_GCC_OPTIONS='-v' '-mllsc' '-mno-shared' '-EL' '-mabi=32'
 /usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/as -v -EL -O1 -mabi=32 -mno-shared -KPIC -o /tmp/ccg42mby.o /tmp/ccOybt4u.s
GNU assembler version 2.34 (mipsel-linux-gnu) using BFD version (GNU Binutils) 2.34
COMPILER_PATH=/usr/lib/cross-mipsel-linux-gnu/libexec/gcc/mipsel-linux-gnu/10.1.0/:/usr/lib/cross-mipsel-linux-gnu/libexec/gcc/mipsel-linux-gnu/10.1.0/:/usr/lib/cross-mipsel-linux-gnu/libexec/gcc/mipsel-linux-gnu/:/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/:/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/:/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/
LIBRARY_PATH=/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/:/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/lib/:/usr/lib/cross-mipsel-linux-gnu/lib/
COLLECT_GCC_OPTIONS='-v' '-mllsc' '-mno-shared' '-EL' '-mabi=32'
 /usr/lib/cross-mipsel-linux-gnu/libexec/gcc/mipsel-linux-gnu/10.1.0/collect2 -plugin /usr/lib/cross-mipsel-linux-gnu/libexec/gcc/mipsel-linux-gnu/10.1.0/liblto_plugin.so -plugin-opt=/usr/lib/cross-mipsel-linux-gnu/libexec/gcc/mipsel-linux-gnu/10.1.0/lto-wrapper -plugin-opt=-fresolution=/tmp/cc5BWbrz.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc --sysroot=/usr/lib/cross-mipsel-linux-gnu --eh-frame-hdr -EL -dynamic-linker /lib/ld.so.1 -melf32ltsmip crt1.o crti.o crtbegin.o -L/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0 -L/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/lib -L/usr/lib/cross-mipsel-linux-gnu/lib /tmp/ccg42mby.o -lgcc -lc -lgcc crtend.o crtn.o
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/ld: cannot find crt1.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/ld: cannot find -lgcc
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/ld: cannot find -lc
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/ld: cannot find -lgcc
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/ld: cannot find crtend.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/10.1.0/../../../../mipsel-linux-gnu/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status

I did try the "cross-mipsel-linux-gnu-gcc49" package with the same results.

Offline

#9 2020-06-01 23:40:21

mpan
Member
Registered: 2012-08-01
Posts: 1,208
Website

Re: Unable to compile with the cross-mipsel-linux-gnu-gcc package

amlamarra wrote:

I'm not sure what you mean. There IS a package called "cross-mipsel-linux-gnu-gcc", which is what I installed and attempted to use.

Clearly there is not:

 $ pacman -Si cross-mipsel-linux-gnu-gcc
error: package 'cross-mipsel-linux-gnu-gcc' was not found
amlamarra wrote:

And I'm not referring to any of my packages. I'm basically looking for the equivalent of the "gcc-8-mipsel-linux-gnu" package available in the Debian repos. Something that'll let me use GCC to compile C source code to the mipsel architecture.

Arch does not have any packages for cross-compiling to MIPS. You need to build that yourself. To do that, you must (this is an outline!):

  1. Build binutils to handle MIPS architecture.

  2. Build gcc cross-compiler for MIPS (stage 1; that is without libc).

  3. Build a libc for MIPS. For example glibc.

  4. If needed, build gcc cross-compiler for MIPS again (stage 2).

You may see how Stefan Schmidt did that for PowerPC64 in his AUR submissions. If I haven’t missed anything, the path was: powerpc64-linux-gnu-binutilspowerpc64-linux-gnu-gcc-stage1powerpc64-linux-gnu-glibc-headers (requires independently built powerpc64-linux-gnu-linux-api-headers, but you may already have those on the target system) → powerpc64-linux-gnu-gcc-stage2powerpc64-linux-gnu-glibc (the complete target version). Note that for other architectures this may require some tweaking and that thrimbor has used some PKGBUILD tricks to streamline the process while replacing stage1 with stage2 (with replaces, provides and conflicts).

Since I do not know how easy it will be to find here people, who built a MIPS cross-compiler on Arch, you may need to ask about specific tweaks on MIPS-related fora and IRC channels, as each architecture may have its quirks. What works for AVR8 or PowerPC may not work on MIPS. In particular for MIPS people may offer you libc other than glibc.

As for the versions… the new log build shows a different version (10.1) than the first post (4.9). ¯\_(ツ)_/¯

Last edited by mpan (2020-06-01 23:45:22)


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#10 2020-06-01 23:53:55

amlamarra
Member
Registered: 2015-06-25
Posts: 50

Re: Unable to compile with the cross-mipsel-linux-gnu-gcc package

Sorry, since this is under the "AUR Issues" category, I assumed everyone would assume AUR package if I did not specify.

$ yay -Si cross-mipsel-linux-gnu-gcc
:: Querying AUR...
Repository      : aur
Name            : cross-mipsel-linux-gnu-gcc
...

I think I will try to build the cross-compiler myself.

And you're right about my first post. I must have gotten mixed up when copy-pasting from my multiple attempts at this. That output is from this package: https://aur.archlinux.org/packages/cros … gnu-gcc49/

Edit: Fixed that.

Last edited by amlamarra (2020-06-01 23:55:37)

Offline

#11 2020-06-02 00:16:00

mpan
Member
Registered: 2012-08-01
Posts: 1,208
Website

Re: Unable to compile with the cross-mipsel-linux-gnu-gcc package

Mea culpa: for some reason I thought we are in a different forum section. hmm

The Arch Wiki article related to cross-compiling suggests crosstool-ng for building a toolchain in an automated way. I am not endorsing this method, as I have never used it myself and I’m only telling about it because the Wiki mentions it. Whatever you use, understand what it did and why.

Last edited by mpan (2020-06-02 00:23:30)


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

Board footer

Powered by FluxBB