Re: YACCQ : Yet Another Cross Compiler Question ... cannot compute suffix of object files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> Do you really want to build a native riscv64 compiler to run on the
>> target, or are you trying to build a cross-compiler to run on x86_64
>> and build binaries for riscv64?
> 
> OK, I missed this from your first mail among the tousands of lines of logs:
> 
> "I really just want a bare bones compiler that will run in that target
> RISC-V rv64imafdc
> target boxen"
> 
> So you do want a native risc64 compiler, sorry for misunderstanding that!
>

Bingo .. exactly. The idea here is that the target box has no native
compiler and in my mind that makes it pretty much useless.


> So the problem does seem to be that the in-tree gmp configuration is
> detecting "none" as the target.
> 

I am making progress and am past the gmp build part. In fact the libmpfr
library is beatly sitting in gmp/.libs/libgmp.a and I checked that it is
in fact full of RISC-V contents :

vesta_$ ar tv gmp/.libs/libgmp.a | grep 'assert'
rw-r--r-- 0/0  16608 Jan  1 00:00 1970 assert.o
vesta_$

So that file "assert.o" exists :

vesta_$ ls -lapb ./gmp/assert.o
-rw-r--r--  1 dclarke  devl  16608 Feb 18 07:04 ./gmp/assert.o

It is for the target system :

vesta_$ file ./gmp/assert.o
./gmp/assert.o: ELF 64-bit LSB relocatable, UCB RISC-V, version 1
(SYSV), with debug_info, not stripped
vesta_$

Okay so I did post a very long detailed mail that shows every step I
took to get to the mpfr build stage where things fail again.  Let me
find a link :


     https://gcc.gnu.org/ml/gcc-help/2019-02/msg00068.html


So there ( I was getting tired and the tone isn't pure ) is where I laid
out this idea, this minor glimmer of understanding, that there are two
compilers at work here : the native "_FOR_BUILD_ and then there is also
the cross "_FOR_TARGET" compiler.  A pile of env vars exist and I grep
into the configure script to see them.  That email lays all that out.

Near the middle of that email I lay out how I run configure with CFLAGS
and CXXFLAGS set for the cross. That may be wrong. I perhaps should only
be setting env vars CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.  However
I must be close to the needed magic because libiberty builds and then
gmp and then into mpfr where things halt with :

.
.
.
libtool: link: ( cd ".libs" && rm -f "libgmp.la" && ln -s "../libgmp.la"
"libgmp.la" )
gmake[4]: Leaving directory
'/usr/home/dclarke/rv64g_local/build/gcc-8.2.0_rv64imafdc.007/gmp'
gmake[3]: Leaving directory
'/usr/home/dclarke/rv64g_local/build/gcc-8.2.0_rv64imafdc.007/gmp'
gmake[2]: Leaving directory
'/usr/home/dclarke/rv64g_local/build/gcc-8.2.0_rv64imafdc.007/gmp'
mkdir ./mpfr
Configuring in ./mpfr
configure: creating cache ./config.cache
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for riscv64-unknown-freebsd12.0-strip... /usr/local/bin/strip
checking for a thread-safe mkdir -p... ../../gcc-8.2.0/mpfr/install-sh -c -d
checking for gawk... /usr/local/bin/gawk
.
. a few usual lines ... nothing scary here
.

checking for math/round... yes
checking for math/trunc... yes
checking for math/floor... yes
checking for math/ceil... yes
checking for math/nearbyint... yes
checking for _mulx_u64... cannot test, assume no
checking for long double... yes
checking format of `long double' floating point... IEEE quad, little endian
checking for TLS support using C11... cannot test, assume no
checking for TLS support... cannot test, assume no
checking if __float128 with hex constants is supported... no
checking for Static Assertion support... yes
checking for library containing clock_gettime... none required
checking for gmp.h... yes
checking whether gcc __attribute__ ((mode (XX))) works... yes
checking for recent GMP... yes
checking usable gmp.h at link time... yes
checking for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency... cannot test
checking for __gmpz_init in -lgmp... no
configure: error: libgmp not found or uses a different ABI (including
static vs shared).
Please read the INSTALL file -- see "In case of problem".
gmake[1]: *** [Makefile:5139: configure-mpfr] Error 1
gmake[1]: Leaving directory
'/usr/home/dclarke/rv64g_local/build/gcc-8.2.0_rv64imafdc.007'
gmake: *** [Makefile:906: all] Error 2
vesta_$

OKay so that is where I am at.

The message "libgmp not found or uses a different ABI" may be due to the
output libgmp library from the previous stage being 32-bit or something
odd like that. Easy for me to check the ELF header of its contents.

vesta_$ ls -lapb gmp/.libs
total 3943
drwxr-xr-x   2 dclarke  devl         5 Feb 18 07:05 ./
drwxr-xr-x  15 dclarke  devl        68 Feb 18 07:05 ../
-rw-r--r--   1 dclarke  devl  10242668 Feb 18 07:05 libgmp.a
lrwxr-xr-x   1 dclarke  devl        12 Feb 18 07:05 libgmp.la ->
../libgmp.la
-rw-r--r--   1 dclarke  devl       875 Feb 18 07:05 libgmp.lai

vesta_$ ls -lapb gmp/assert.
gmp/assert.lo gmp/assert.o
vesta_$ ls -lapb gmp/assert.o
-rw-r--r--  1 dclarke  devl  16608 Feb 18 07:04 gmp/assert.o
vesta_$ file gmp/assert.o
gmp/assert.o: ELF 64-bit LSB relocatable, UCB RISC-V, version 1 (SYSV),
with debug_info, not stripped
vesta_$
vesta_$ $READELF_FOR_TARGET -e gmp/assert.o
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           RISC-V
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          0 (bytes into file)
  Start of section headers:          15328 (bytes into file)
  Flags:                             0x5, RVC, double-float ABI
  Size of this header:               64 (bytes)
  Size of program headers:           0 (bytes)
  Number of program headers:         0
  Size of section headers:           64 (bytes)
  Number of section headers:         20
  Section header string table index: 19

.
.
.

So it is pure 64-bit and for the correct architecture.

Feels like progress as I am at the mpfr stage of the show.


-- 
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional

ps: Also thank you .. I don't know of any one else that really
    understands the gcc build process like you so any help you provide
    is gold.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux