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

Dennis Clarke dclarke@blastwave.org
Mon Feb 18 00:07:00 GMT 2019


On 2/17/19 5:48 PM, Segher Boessenkool wrote:
> On Sun, Feb 17, 2019 at 04:34:31PM -0600, Segher Boessenkool wrote:
>> On Sun, Feb 17, 2019 at 04:48:03PM -0500, Dennis Clarke wrote:
>>> There seems to be a few of those around :
>>
>> The first was the build-*/libiberty one.
> 

OKay the config.log down in the libiberty directory seems to suggest
that there is some confusion about CFLAGS or similar :

vesta_$ cat  build-x86_64-unknown-freebsd12.0/libiberty/config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.64.  Invocation command line was

  $ /home/dclarke/rv64g_local/build/gcc-8.2.0/libiberty/configure
--srcdir=../../../gcc-8.2.0/libiberty --cache-file=./config.cache
--with-sysroot=/riscv64/rootfs --prefix=/usr/local/gcc8
--without-headers --with-build-time-tools=/opt/tools/bin
--with-as=/opt/tools/bin/riscv64-unknown-freebsd12.0-as
--with-ld=/opt/tools/bin/riscv64-unknown-freebsd12.0-ld
--disable-multilib --enable-threads=posix --enable-tls
--disable-bootstrap --disable-libquadmath --disable-libgomp
--disable-libvtv --enable-checking=all --disable-nls
--enable-decimal-float=no --with-diagnostics-color=never --disable-lto
--without-newlib --disable-werror --disable-libatomic --disable-lib
--enable-languages=c,c++ --program-transform-name=s,y,y,
--disable-option-checking
--with-build-subdir=build-x86_64-unknown-freebsd12.0
--build=x86_64-unknown-freebsd12.0 --host=x86_64-unknown-freebsd12.0
--target=riscv64-unknown-freebsd12.0

## --------- ##
## Platform. ##
## --------- ##

hostname = vesta
uname -m = amd64
uname -r = 12.0-RELEASE
uname -s = FreeBSD
uname -v = FreeBSD 12.0-RELEASE r341666 GENERIC

/usr/bin/uname -p = amd64
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /opt/tools/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /sbin
PATH: /bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /opt/schily/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2342: creating cache ./config.cache
configure:2493: checking whether to enable maintainer-specific portions
of Makefiles
configure:2503: result: no
configure:2518: checking for makeinfo
configure:2545: result: makeinfo --split-size=5000000
configure:2585: checking for perl
configure:2601: found /usr/local/bin/perl
configure:2612: result: perl
configure:2631: checking build system type
configure:2645: result: x86_64-unknown-freebsd12.0
configure:2665: checking host system type
configure:2678: result: x86_64-unknown-freebsd12.0
configure:2703: checking for x86_64-unknown-freebsd12.0-ar
configure:2730: result: ar
configure:2795: checking for x86_64-unknown-freebsd12.0-ranlib
configure:2822: result: ranlib
configure:2907: checking whether to install libiberty headers and static
library
configure:2930: result: no
configure:2932: target_header_dir =
configure:2944: checking for x86_64-unknown-freebsd12.0-gcc
configure:2971: result: gcc
configure:3240: checking for C compiler version
configure:3249: gcc --version >&5
eval: gcc: not found
configure:3260: $? = 127
configure:3249: gcc -v >&5
eval: gcc: not found
configure:3260: $? = 127
configure:3249: gcc -V >&5
eval: gcc: not found
configure:3260: $? = 127
configure:3249: gcc -qversion >&5
eval: gcc: not found
configure:3260: $? = 127
configure:3276: gcc -o conftest  --sysroot=/riscv64/rootfs
-L/riscv64/rootfs/lib  conftest.c  >&5
eval: gcc: not found
configure:3279: $? = 127
configure:3467: checking for suffix of object files
configure:3489: gcc -c  --sysroot=/riscv64/rootfs -L/riscv64/rootfs/lib
conftest.c >&5
eval: gcc: not found
configure:3493: $? = 127
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:3507: error: in
`/home/dclarke/rv64g_local/build/gcc-8.2.0_rv64imafdc.002/build-x86_64-unknown-freebsd12.0/libiberty':
configure:3510: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=x86_64-unknown-freebsd12.0
ac_cv_env_CC_set=set
ac_cv_env_CC_value=gcc
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value=''
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value='--sysroot=/riscv64/rootfs -L/riscv64/rootfs/lib'
ac_cv_env_CPP_set=''
ac_cv_env_CPP_value=''
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value=''
ac_cv_env_LIBS_set=''
ac_cv_env_LIBS_value=''
ac_cv_env_build_alias_set=set
ac_cv_env_build_alias_value=x86_64-unknown-freebsd12.0
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=x86_64-unknown-freebsd12.0
ac_cv_env_target_alias_set=set
ac_cv_env_target_alias_value=riscv64-unknown-freebsd12.0
ac_cv_host=x86_64-unknown-freebsd12.0
ac_cv_prog_AR=ar
ac_cv_prog_CC=gcc
ac_cv_prog_MAKEINFO='makeinfo --split-size=5000000'
ac_cv_prog_PERL=perl
ac_cv_prog_RANLIB=ranlib

## ----------------- ##
## Output variables. ##
## ----------------- ##

AR='ar'
BUILD_INFO='info'
CC='gcc'
CFLAGS=''
CHECK=''
CPP=''
CPPFLAGS='--sysroot=/riscv64/rootfs -L/riscv64/rootfs/lib'
DEFS=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
GREP='/usr/local/bin/grep'
HAVE_PERL=''
INSTALL_DATA='/usr/bin/install -c -m 644'
INSTALL_DEST=''
INSTALL_PROGRAM='/usr/bin/install -c'
INSTALL_SCRIPT='/usr/bin/install -c'
LDFLAGS=''
LIBOBJS=''
LIBS=''
LTLIBOBJS=''
MAINT='#'
MAKEINFO='makeinfo --split-size=5000000'
NOASANFLAG=''
NOTMAINT=''
NO_MINUS_C_MINUS_O=''
OBJEXT=''
OUTPUT_OPTION=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
PERL='perl'
PICFLAG=''
RANLIB='ranlib'
SHELL='/bin/sh'
ac_ct_CC=''
ac_libiberty_warn_cflags=''
bindir='${exec_prefix}/bin'
build='x86_64-unknown-freebsd12.0'
build_alias='x86_64-unknown-freebsd12.0'
build_cpu='x86_64'
build_os='freebsd12.0'
build_vendor='unknown'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec_prefix='NONE'
host='x86_64-unknown-freebsd12.0'
host_alias='x86_64-unknown-freebsd12.0'
host_cpu='x86_64'
host_os='freebsd12.0'
host_vendor='unknown'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
libiberty_topdir='../../../gcc-8.2.0/libiberty/..'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
pexecute=''
prefix='/usr/local/gcc8'
program_transform_name='s,y,y,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias='riscv64-unknown-freebsd12.0'
target_header_dir=''

## ------------------- ##
## File substitutions. ##
## ------------------- ##

host_makefile_frag=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""

configure: exit 1
vesta_$


> 
> I think maybe you need to specify a --target as well...  cross-built
> native is not the most usual configuration.

Well this is a tricky situation to be sure. I am running everything on a
FreeBSD 12 x86_64 boxen which is happy to build all the required cross
compiler toolset that I need from the RISC-V project. That then results
in a bucket of goodness in /opt/tools/bin wherein we see full triplet
named things like :

vesta_$ ls -lapb /opt/tools/bin/riscv64-unknown-freebsd12.0-gcc
-rwxr-xr-x  2 dclarke  devl  3531784 Feb 16 19:51
/opt/tools/bin/riscv64-unknown-freebsd12.0-gcc
vesta_$

That works neatly and compiles hellow world type stuff and even the
whole libgmp and libmpfr etc sources into native RISC-V rv64gc type ELF
output.  Neato.  It is also what I use to fully compile the whole
of FreeBSD "world" and "kernel" all of which gets sent to a target
system root filesystem structure.  Also very neat.

The problem, the real issue and bone breaker here is that there is
no compiler anywhere in that new foreign architecture target. So I
need to create at least gcc for C and C++ into that output filesystem.
It has to be a purely RISC-V type compiler and so here we are.

Maybe I am doing this ALL wrong and should use the native x86_64 gcc
that is on the x86_64 box to produce the output RISC-V?  Nope.  That
can not be right.  The native gcc on the x86_64 "host" has no clue how
to create rv64gc assembly or then object files etc.  So I am sure I
need to use the cross compiler in /opt/tools/bin for this task.

Not sure I can disable libiberty and still get a functional compiler.

> 
> Have you seen https://gcc.gnu.org/wiki/FAQ#configure_suffix by the way?

Hrmmmm ... nope .... going there now.  Seems to suggest I need to look
in other places. I do have MPFR, GMP and MPC already built and installed
into the target sysroot within /usr/local/lib.  Okay .. these are good
hints.  I will keep digging.


Dennis

ps: forgot to say a much needed "thank you!" as I am lost without a few
folks says "look over there..." when I am sure others have done this.



More information about the Gcc-help mailing list