Trouble building MIPS

Home Forums Forum Trouble building MIPS

This topic contains 5 replies, has 2 voices, and was last updated by  tMH 8 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #76556 Reply

    Ben

    Just playing around with the toolchain, attempting to build a mips elf file for Linux. Downloaded and untar’d the latest distribution, and attempting to do a simple hello world:

    ellcc/bin/ecc -target mipsel-ellcc-linux hello.c
    /home/callpop/xcompilers/ellcc/bin/ecc-ld: cannot find /home/callpop/xcompilers/ellcc/bin/../libecc/lib/mipsel/linux/crt1.o: No such file or directory
    /home/callpop/xcompilers/ellcc/bin/ecc-ld: cannot find /home/callpop/xcompilers/ellcc/bin/../libecc/lib/mipsel/linux/crtbegin.o: No such file or directory
    /home/callpop/xcompilers/ellcc/bin/ecc-ld: cannot find -lc
    /home/callpop/xcompilers/ellcc/bin/ecc-ld: cannot find -lcompiler-rt
    ecc: error: linker command failed with exit code 1 (use -v to see invocation)

    Everything appears to be in the right place, but it looks like the paths aren’t being constructed properly for the link stage. According to the ellcc/libecc/config/mipsel-linux-eng description, the linker needs to find the runtime libraries in $R/lib/mipsel-linux-eng/, but it looks like it’s only using “mipsel”, which doesn’t exist. Bug? Am I missing something?

    #76557 Reply

    rich
    Keymaster

    Hi Ben,

    In version 0.1.28 and earlier, use “-target mipsel-linux-eng”. After version 0.1.29, use “-target mips32r2el-linux”. In both cases, the file in ellcc/libecc/config with the same name as the -target arguments is used to tell the compiler where to find stuff.

    -Rich

    #76562 Reply

    Ben

    Thanks for the quick reply! I’m now seeing:

    $ellcc/bin/ecc -target mips32r2el-linux hello.c -v
    ecc 0.1.28 based on clang version 3.9.0 (trunk) (based on LLVM 3.9.0svn)
    Target: mips32r2el--linux
    Thread model: posix
    InstalledDir: /home/callpop/xcompilers/ellcc/bin
     "/home/callpop/xcompilers/ellcc/bin/ecc" -cc1 -triple mips32r2el--linux -S -disable-free -main-file-name hello.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -no-integrated-as -mconstructor-aliases -target-cpu mips32r2 -target-abi o32 -mfloat-abi hard -target-linker-version 2.24 -v -dwarf-column-info -debugger-tuning=gdb -resource-dir /home/callpop/xcompilers/ellcc/bin/../libecc -internal-isystem /usr/local/include -internal-isystem /home/callpop/xcompilers/ellcc/bin/../libecc/clang -internal-externc-isystem /include -internal-externc-isystem /usr/include -fno-dwarf-directory-asm -fdebug-compilation-dir /home/callpop/xcompilers -ferror-limit 19 -fmessage-length 80 -fobjc-runtime=gcc -fdiagnostics-show-option -o /tmp/hello-004bff.s -x c hello.c
    clang -cc1 version 3.9.0 based upon LLVM 3.9.0svn default target x86_64-pc-linux-gnu
    ignoring nonexistent directory "/include"
    #include "..." search starts here:
    #include <...> search starts here:
     /usr/local/include
     /home/callpop/xcompilers/ellcc/bin/../libecc/clang
     /usr/include
    End of search list.
     "/usr/bin/as" -march mips32r2 -mabi 32 -mno-shared -call_nonpic -EL -o /tmp/hello-c2daac.o /tmp/hello-004bff.s
    Assembler messages:
    Fatal error: invalid -march= option: 

    mips32r2′
    ecc: error: assembler command failed with exit code 1 (use -v to see invocation)`

    Looks to me like it’s trying to use the native version of as and not (as I would expect) the one that is included in the ellcc distribution in ellcc/bin/mips-elf-as. Am I missing something in my ecc invocation or installation?

    #76568 Reply

    rich
    Keymaster

    Hi Ben,

    That configuration only works with version 0.1.29:

    [~] dev% ellcc/bin/ecc -target mips32r2el-linux hello.c 
    [~] dev% file a.out
    a.out: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, statically linked, BuildID[sha1]=224a9bbbfdccf5f15573226ba61e78481bf2fc50, not stripped
    [~] dev% ./ellcc/bin/qemu-mipsel ./a.out
    hello world
    [~] dev% 
    

    For version 0.1.28 and earlier, use “-target mipsel-linux-eng”:

    [~/tmp] dev% ellcc/bin/ecc -target mipsel-linux-eng ~/hello.c -v
    ecc 0.1.28 based on clang version 3.9.0 (trunk) (based on LLVM 3.9.0svn)
    Target: mipsel-ellcc-linux
    Thread model: posix
    InstalledDir: /home/rich/tmp/ellcc/bin
     "/home/rich/tmp/ellcc/bin/ecc" -cc1 -triple mipsel-ellcc-linux -S -disable-free -main-file-name hello.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -no-integrated-as -mconstructor-aliases -target-cpu mips32r2 -target-abi o32 -mfloat-abi hard -target-linker-version 2.24 -v -dwarf-column-info -debugger-tuning=gdb -resource-dir /home/rich/tmp/ellcc/bin/../libecc -internal-isystem /home/rich/tmp/ellcc/bin/../libecc/include/mips -internal-isystem /home/rich/tmp/ellcc/bin/../libecc/include -fno-dwarf-directory-asm -fdebug-compilation-dir /home/rich/tmp -ferror-limit 19 -fmessage-length 80 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/hello-cdeb4c.s -x c /home/rich/hello.c
    clang -cc1 version 3.9.0 based upon LLVM 3.9.0svn default target x86_64-pc-linux-gnu
    #include "..." search starts here:
    #include < ...> search starts here:
     /home/rich/tmp/ellcc/bin/../libecc/include/mips
     /home/rich/tmp/ellcc/bin/../libecc/include
    End of search list.
     "/home/rich/tmp/ellcc/bin/mips-elf-as" -o /tmp/hello-150683.o -EL /tmp/hello-cdeb4c.s
     "/home/rich/tmp/ellcc/bin/ecc-ld" -nostdlib -L/home/rich/tmp/ellcc/bin/../libecc/lib/mipsel-linux-eng -m elf32elmip --build-id --eh-frame-hdr -o a.out -e _start -Bstatic /home/rich/tmp/ellcc/bin/../libecc/lib/mipsel-linux-eng/crt1.o /home/rich/tmp/ellcc/bin/../libecc/lib/mipsel-linux-eng/crtbegin.o /tmp/hello-150683.o -( -lc -lcompiler-rt -) /home/rich/tmp/ellcc/bin/../libecc/lib/mipsel-linux-eng/crtend.o
    /home/rich/tmp/ellcc/bin/ecc-ld: /home/rich/tmp/ellcc/bin/../libecc/lib/mipsel-linux-eng/libc.a(syscall.o): warning: linking abicalls files with non-abicalls files
    [~/tmp] dev% 
    

    -Rich

    #76571 Reply

    Ben

    Thanks! For some reason I thought I’d downloaded the latest version but must have missed it. That works 🙂

    #77305 Reply

    tMH

    Hello everyone!
    I use ellcc-0.1.32 version, trying to make ircII, and what I get:
    /home/dev/ellcc/bin/ecc -target mips32r2el-linux -I. -I/home/dev/ircii-20131230/include -I/home/dev/ircii-20131230/source/rijndael -pipe -g -O2 -static -DHAVE_CONFIG_H -o mksiginc mksiginc.o -ltermcap -lcrypt
    clang-3.9: warning: argument unused during compilation: ‘-g’
    /home/dev/ellcc/bin/ecc-ld: cannot find -ltermcap
    clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation)
    Makefile:342: recipe for target ‘mksiginc’ failed
    make: *** [mksiginc] Error 1

    Please explain, how to fix this “cannot find -ltermcap” thingie ?
    Thanks in advance!
    -Viktor.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Trouble building MIPS
Your information: