Skip to contentSkip to conversation

hw/core/loader-fit.c:105:41: error: expected expression

Qemu-devel Programmingkid 4 participants 9 messages Jul 25, 2017 – Jul 26, 2017

lore
Share & tools
lore
#0 lore raw

While compiling the mips64el-softmmu target I encountered these errors:

CC hw/display/g364fb.o
hw/core/loader-fit.c:105:41: error: expected expression

        *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                        ^
hw/core/loader-fit.c:105:32: error: use of undeclared identifier 'fdt32_t'
        *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                               ^
hw/core/loader-fit.c:108:41: error: expected expression
        *addr = fdt64_to_cpu(*(fdt64_t *)prop);
                                        ^
hw/core/loader-fit.c:108:32: error: use of undeclared identifier 'fdt64_t'
        *addr = fdt64_to_cpu(*(fdt64_t *)prop);
                               ^
hw/core/loader-fit.c:278:19: warning: implicit declaration of function
      'fdt_first_subnode' is invalid in C99 [-Wimplicit-function-declaration]
            off = fdt_first_subnode(itb, configs);
                  ^
hw/core/loader-fit.c:286:23: warning: implicit declaration of function
      'fdt_next_subnode' is invalid in C99 [-Wimplicit-function-declaration]
                off = fdt_next_subnode(itb, off);
                      ^

2 warnings and 4 errors generated.
make: *** [hw/core/loader-fit.o] Error 1
make: *** Waiting for unfinished jobs….

Steps to reproduce the error:
./configure --target-list=mips64el-softmmu && make

#1 lore raw

Hi John,

Quoted 7 lines · Programmingkid

While compiling the mips64el-softmmu target I encountered these errors:

CC hw/display/g364fb.o
hw/core/loader-fit.c:105:41: error: expected expression

         *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                         ^

hw/core/loader-fit.c:105:32: error: use of undeclared identifier 'fdt32_t'

It seems you are missing the libfdt headers, so indeed you found bug.

Replacing CONFIG_FITLOADER by CONFIG_FDT in hw/core/Makefile.objs and default-configs/mips64el-softmmu.mak should fix it, can you try?

Quoted 16 lines
         *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                ^
hw/core/loader-fit.c:108:41: error: expected expression
         *addr = fdt64_to_cpu(*(fdt64_t *)prop);
                                         ^
hw/core/loader-fit.c:108:32: error: use of undeclared identifier 'fdt64_t'
         *addr = fdt64_to_cpu(*(fdt64_t *)prop);
                                ^
hw/core/loader-fit.c:278:19: warning: implicit declaration of function
       'fdt_first_subnode' is invalid in C99 [-Wimplicit-function-declaration]
             off = fdt_first_subnode(itb, configs);
                   ^
hw/core/loader-fit.c:286:23: warning: implicit declaration of function
       'fdt_next_subnode' is invalid in C99 [-Wimplicit-function-declaration]
                 off = fdt_next_subnode(itb, off);
                       ^
Quoted 3 lines

2 warnings and 4 errors generated.
make: *** [hw/core/loader-fit.o] Error 1
make: *** Waiting for unfinished jobs….

It'd be useful if next time you also tell which compiler/version are you using.

Quoted 2 lines

Steps to reproduce the error:
./configure --target-list=mips64el-softmmu && make

And also the ./configure output, I'm interested by:

"fdt support no"

Regards,

Phil.

#2 lore raw
Quoted 13 lines · Philippe Mathieu-Daudé

Hi John,

Quoted 6 lines · Programmingkid

While compiling the mips64el-softmmu target I encountered these errors:
CC hw/display/g364fb.o
hw/core/loader-fit.c:105:41: error: expected expression

        *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                        ^

hw/core/loader-fit.c:105:32: error: use of undeclared identifier 'fdt32_t'

Quoted 3 lines

It seems you are missing the libfdt headers, so indeed you found bug.

Replacing CONFIG_FITLOADER by CONFIG_FDT in hw/core/Makefile.objs and default-configs/mips64el-softmmu.mak should fix it, can you try?

That appears to help make things move past the loader-fit.c file. Here are the new errors:

  CC      hw/core/loader-fit.o
  CC      hw/dma/rc4030.o
  CC      hw/ide/via.o
hw/core/loader-fit.c:105:41: error: expected expression
        *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                        ^
hw/core/loader-fit.c:105:32: error: use of undeclared identifier 'fdt32_t'
        *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                               ^
hw/core/loader-fit.c:108:41: error: expected expression
        *addr = fdt64_to_cpu(*(fdt64_t *)prop);
                                        ^
hw/core/loader-fit.c:108:32: error: use of undeclared identifier 'fdt64_t'
        *addr = fdt64_to_cpu(*(fdt64_t *)prop);
                               ^
hw/core/loader-fit.c:278:19: warning: implicit declaration of function
      'fdt_first_subnode' is invalid in C99 [-Wimplicit-function-declaration]
            off = fdt_first_subnode(itb, configs);
                  ^
hw/core/loader-fit.c:286:23: warning: implicit declaration of function
      'fdt_next_subnode' is invalid in C99 [-Wimplicit-function-declaration]
                off = fdt_next_subnode(itb, off);
                      ^

2 warnings and 4 errors generated.
make: *** [hw/core/loader-fit.o] Error 1
make: *** Waiting for unfinished jobs....

Quoted 21 lines
Quoted 17 lines
        *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                               ^
hw/core/loader-fit.c:108:41: error: expected expression
        *addr = fdt64_to_cpu(*(fdt64_t *)prop);
                                        ^
hw/core/loader-fit.c:108:32: error: use of undeclared identifier 'fdt64_t'
        *addr = fdt64_to_cpu(*(fdt64_t *)prop);
                               ^
hw/core/loader-fit.c:278:19: warning: implicit declaration of function
      'fdt_first_subnode' is invalid in C99 [-Wimplicit-function-declaration]
            off = fdt_first_subnode(itb, configs);
                  ^
hw/core/loader-fit.c:286:23: warning: implicit declaration of function
      'fdt_next_subnode' is invalid in C99 [-Wimplicit-function-declaration]
                off = fdt_next_subnode(itb, off);
                      ^
Quoted 3 lines

2 warnings and 4 errors generated.
make: *** [hw/core/loader-fit.o] Error 1
make: *** Waiting for unfinished jobs….

Quoted 1 line

It'd be useful if next time you also tell which compiler/version are you using.

gcc -v:

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Quoted 7 lines
Quoted 3 lines

Steps to reproduce the error:
./configure --target-list=mips64el-softmmu && make

And also the ./configure output, I'm interested by:

"fdt support no”

Actually it was "fdt support yes”.

Quoted 4 lines

Regards,

Phil.

Thanks for the help. Here is some more info that might help:

Here is the full configure output:

./configure --target-list=mips64el-softmmu

Install prefix    /usr/local
BIOS directory    /usr/local/share/qemu
binary directory  /usr/local/bin

library directory /usr/local/lib
module directory /usr/local/lib/qemu
libexec directory /usr/local/libexec
include directory /usr/local/include
config directory /usr/local/etc
local state directory /usr/local/var
Manual directory /usr/local/share/man
ELF interp prefix /usr/gnemul/qemu-%M

Source path       /Users/john/Documents/Development/Projects/Qemu/qemu-git
C compiler        cc
Host C compiler   cc
C++ compiler      c++
Objective-C compiler clang
ARFLAGS           rv
CFLAGS            -O2 -g 
QEMU_CFLAGS       -I/usr/local/Cellar/pixman/0.34.0/include/pixman-1 -I$(SRC_PATH)/dtc/libfdt -D_REENTRANT -I/usr/local/Cellar/glib/2.46.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.46.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -DNCURSES_WIDECHAR -D_DARWIN_C_SOURCE -I/opt/local/include -m64 -mcx16 -DOS_OBJECT_USE_OBJC=0 -arch x86_64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv  -Wno-string-plus-int -Wno-initializer-overrides -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/local/Cellar/gnutls/3.4.11/include -I/usr/local/Cellar/nettle/3.2/include -I/usr/local/Cellar/libtasn1/4.8/include -I/opt/local/include -I/usr/local/Cellar/nettle/3.2/include   -I/usr/local/Cellar/libpng/1.6.29/include/libpng16 -I/usr/local/Cellar/libusb/1.0.20/include/libusb-1.0 -I/usr/local/Cellar/usbredir/0.7.1/include
LDFLAGS           -m64 -framework CoreFoundation -framework IOKit -arch x86_64 -g 
make              make
install           install
python            python -B
smbd              /usr/sbin/smbd
module support    no
host CPU          x86_64
host big endian   no
target list       mips64el-softmmu
gprof enabled     no
sparse enabled    no
strip binaries    yes
profiler          no
static build      no
Cocoa support     yes
pixman            system
SDL support       no 
GTK support       no 
GTK GL support    no
VTE support       yes (0.39.92)
TLS priority      NORMAL
GNUTLS support    yes
GNUTLS rnd        yes
libgcrypt         no
libgcrypt kdf     no
nettle            yes (3.2)
nettle kdf        yes
libtasn1          yes
curses support    yes
virgl support     no
curl support      yes
mingw32 support   no
Audio drivers     coreaudio
Block whitelist (rw) 
Block whitelist (ro) 
VirtFS support    no
VNC support       yes
VNC SASL support  yes
VNC JPEG support  yes
VNC PNG support   yes
xen support       no
brlapi support    no
bluez  support    no
Documentation     yes
PIE               no
vde support       no
netmap support    no
Linux AIO support no
ATTR/XATTR support no
Install blobs     yes
KVM support       no
HAX support       yes
TCG support       yes
TCG debug enabled no
TCG interpreter   no
RDMA support      no
fdt support       yes
preadv support    no
fdatasync         no
madvise           yes
posix_madvise     yes

libcap-ng support no
vhost-net support no
vhost-scsi support no
vhost-vsock support no

Trace backends    log
spice support     no 
rbd support       no
xfsctl support    no
smartcard support no
libusb            yes
usb net redir     yes
OpenGL support    no
OpenGL dmabufs    no
libiscsi support  no
libnfs support    no

build guest agent yes
QGA VSS support no
QGA w32 disk info no
QGA MSI support no
seccomp support no
coroutine backend sigaltstack
coroutine pool yes
debug stack usage no
crypto afalg no
GlusterFS support no

gcov              gcov
gcov enabled      no
TPM support       yes
libssh2 support   no
TPM passthrough   no
QOM debugging     yes
Live block migration yes
lzo support       no
snappy support    no
bzip2 support     yes

NUMA host support no
tcmalloc support no
jemalloc support no
avx2 optimization no
replication support yes
VxHS block device no

#3 lore raw
Quoted 6 lines · Programmingkid
Quoted 6 lines · Philippe Mathieu-Daudé

Hi John,

On 07/25/2017 07:55 PM, Programmingkid wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

While compiling the mips64el-softmmu target I encountered these errors:
CC hw/display/g364fb.o
hw/core/loader-fit.c:105:41: error: expected expression

        *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                        ^

hw/core/loader-fit.c:105:32: error: use of undeclared identifier 'fdt32_t'

It seems you are missing the libfdt headers, so indeed you found bug.

Configure requires libfdt to exist to enable mips64el-softmmu, so something is going wrong with our configure test compared to how QEMU itself is being built.

Quoted 8 lines

That appears to help make things move past the loader-fit.c file. Here are the new errors:

  CC      hw/core/loader-fit.o
  CC      hw/dma/rc4030.o
  CC      hw/ide/via.o
hw/core/loader-fit.c:105:41: error: expected expression
        *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                        ^

...this is still failing on loader-fit.c in the same way.

Quoted 5 lines
Quoted 3 lines

And also the ./configure output, I'm interested by:

"fdt support no”

Actually it was "fdt support yes”.

Configure thinks the fdt headers are available...

Quoted 12 lines

./configure --target-list=mips64el-softmmu

Install prefix    /usr/local
BIOS directory    /usr/local/share/qemu
binary directory  /usr/local/bin

library directory /usr/local/lib
module directory /usr/local/lib/qemu
libexec directory /usr/local/libexec
include directory /usr/local/include
config directory /usr/local/etc
local state directory /usr/local/var
Manual directory /usr/local/share/man
ELF interp prefix /usr/gnemul/qemu-%M

Quoted 8 lines
Source path       /Users/john/Documents/Development/Projects/Qemu/qemu-git
C compiler        cc
Host C compiler   cc
C++ compiler      c++
Objective-C compiler clang
ARFLAGS           rv
CFLAGS            -O2 -g
QEMU_CFLAGS       -I/usr/local/Cellar/pixman/0.34.0/include/pixman-1 -I$(SRC_PATH)/dtc/libfdt -D_REENTRANT -I/usr/local/Cellar/glib/2.46.2/include

...and it's put our local copy of libfdt on the include path.

The fdt32_t type that the compiler is complaining
about ought to be defined in the header in
dtc/libfdt/libfdt_env.h.

I wonder if you have an old copy of that submodule; if so then "git submodule update" ought to fix it.

thanks
-- PMM

#4 lore raw
Quoted 34 lines · Peter Maydell
Quoted 6 lines · Programmingkid
Quoted 6 lines · Philippe Mathieu-Daudé

Hi John,

On 07/25/2017 07:55 PM, Programmingkid wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

While compiling the mips64el-softmmu target I encountered these errors:
CC hw/display/g364fb.o
hw/core/loader-fit.c:105:41: error: expected expression

       *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                       ^

hw/core/loader-fit.c:105:32: error: use of undeclared identifier 'fdt32_t'

It seems you are missing the libfdt headers, so indeed you found bug.

Configure requires libfdt to exist to enable mips64el-softmmu, so something is going wrong with our configure test compared to how QEMU itself is being built.

Quoted 8 lines

That appears to help make things move past the loader-fit.c file. Here are the new errors:

 CC      hw/core/loader-fit.o
 CC      hw/dma/rc4030.o
 CC      hw/ide/via.o
hw/core/loader-fit.c:105:41: error: expected expression
       *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                       ^

...this is still failing on loader-fit.c in the same way.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

And also the ./configure output, I'm interested by:

"fdt support no”

Actually it was "fdt support yes”.

Configure thinks the fdt headers are available…

They appear to be available. The dtc/libfdt folder does have the files QEMU uses.

Quoted 22 lines
Quoted 13 lines

./configure --target-list=mips64el-softmmu

Install prefix    /usr/local
BIOS directory    /usr/local/share/qemu
binary directory  /usr/local/bin

library directory /usr/local/lib
module directory /usr/local/lib/qemu
libexec directory /usr/local/libexec
include directory /usr/local/include
config directory /usr/local/etc
local state directory /usr/local/var
Manual directory /usr/local/share/man
ELF interp prefix /usr/gnemul/qemu-%M

Quoted 8 lines
Source path       /Users/john/Documents/Development/Projects/Qemu/qemu-git
C compiler        cc
Host C compiler   cc
C++ compiler      c++
Objective-C compiler clang
ARFLAGS           rv
CFLAGS            -O2 -g
QEMU_CFLAGS       -I/usr/local/Cellar/pixman/0.34.0/include/pixman-1 -I$(SRC_PATH)/dtc/libfdt -D_REENTRANT -I/usr/local/Cellar/glib/2.46.2/include
Quoted 5 lines

...and it's put our local copy of libfdt on the include path.

The fdt32_t type that the compiler is complaining
about ought to be defined in the header in
dtc/libfdt/libfdt_env.h.

The fdt32_t type is not there. Here is the full libfdt_env.h file:

#ifndef _LIBFDT_ENV_H
#define _LIBFDT_ENV_H

#include <stddef.h>
#include <stdint.h>
#include <string.h>

#define _B(n) ((unsigned long long)((uint8_t *)&x)[n])
static inline uint32_t fdt32_to_cpu(uint32_t x)

{
	return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3);
}

#define cpu_to_fdt32(x) fdt32_to_cpu(x)

static inline uint64_t fdt64_to_cpu(uint64_t x)

{
	return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32)
		| (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7);
}

#define cpu_to_fdt64(x) fdt64_to_cpu(x)
#undef _B

#endif /* _LIBFDT_ENV_H */

Quoted 2 lines

I wonder if you have an old copy of that submodule; if so then "git submodule update" ought to fix it.

I’m not sure how to obtain the version of libfdt. I did see a file called version.lds. At the top of this file is this text: "LIBFDT_1.2 {"
So maybe I am using version 1.2. Perhaps the configure test should declare a variable of the fdt32_t type in the test code.

After doing a git submodule update qemu-system-mips64el compiled successfully. Thank you.

#5 lore raw
Quoted 20 lines · Programmingkid
Quoted 20 lines · Peter Maydell
Quoted 5 lines · Programmingkid
Quoted 5 lines · Philippe Mathieu-Daudé

Hi John,

On 07/25/2017 07:55 PM, Programmingkid wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

While compiling the mips64el-softmmu target I encountered these errors:
CC hw/display/g364fb.o
hw/core/loader-fit.c:105:41: error: expected expression

        *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                        ^

hw/core/loader-fit.c:105:32: error: use of undeclared identifier 'fdt32_t'

It seems you are missing the libfdt headers, so indeed you found bug.

Configure requires libfdt to exist to enable mips64el-softmmu, so something is going wrong with our configure test compared to how QEMU itself is being built.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

That appears to help make things move past the loader-fit.c file. Here are the new errors:

  CC      hw/core/loader-fit.o
  CC      hw/dma/rc4030.o
  CC      hw/ide/via.o

It looks you ran "make -j3" firing 3 CC tasks.

Quoted 74 lines
Quoted 6 lines
Quoted 3 lines

hw/core/loader-fit.c:105:41: error: expected expression

        *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                        ^

...this is still failing on loader-fit.c in the same way.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

And also the ./configure output, I'm interested by:

"fdt support no”

Actually it was "fdt support yes”.

Configure thinks the fdt headers are available…

They appear to be available. The dtc/libfdt folder does have the files QEMU uses.

Quoted 22 lines
Quoted 13 lines

./configure --target-list=mips64el-softmmu

Install prefix    /usr/local
BIOS directory    /usr/local/share/qemu
binary directory  /usr/local/bin

library directory /usr/local/lib
module directory /usr/local/lib/qemu
libexec directory /usr/local/libexec
include directory /usr/local/include
config directory /usr/local/etc
local state directory /usr/local/var
Manual directory /usr/local/share/man
ELF interp prefix /usr/gnemul/qemu-%M

Quoted 8 lines
Source path       /Users/john/Documents/Development/Projects/Qemu/qemu-git
C compiler        cc
Host C compiler   cc
C++ compiler      c++
Objective-C compiler clang
ARFLAGS           rv
CFLAGS            -O2 -g
QEMU_CFLAGS       -I/usr/local/Cellar/pixman/0.34.0/include/pixman-1 -I$(SRC_PATH)/dtc/libfdt -D_REENTRANT -I/usr/local/Cellar/glib/2.46.2/include
Quoted 5 lines

...and it's put our local copy of libfdt on the include path.

The fdt32_t type that the compiler is complaining
about ought to be defined in the header in
dtc/libfdt/libfdt_env.h.

The fdt32_t type is not there. Here is the full libfdt_env.h file:

#ifndef _LIBFDT_ENV_H
#define _LIBFDT_ENV_H

#include <stddef.h>
#include <stdint.h>
#include <string.h>

#define _B(n) ((unsigned long long)((uint8_t *)&x)[n])
static inline uint32_t fdt32_to_cpu(uint32_t x)

{
	return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3);
}

#define cpu_to_fdt32(x) fdt32_to_cpu(x)

static inline uint64_t fdt64_to_cpu(uint64_t x)

{
	return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32)
		| (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7);
}

#define cpu_to_fdt64(x) fdt64_to_cpu(x)
#undef _B

#endif /* _LIBFDT_ENV_H */

Quoted 2 lines

I wonder if you have an old copy of that submodule; if so then "git submodule update" ought to fix it.

Quoted 6 lines

I’m not sure how to obtain the version of libfdt. I did see a file called version.lds. At the top of this file is this text: "LIBFDT_1.2 {"
So maybe I am using version 1.2. Perhaps the configure test should declare a variable of the fdt32_t type in the test code.

After doing a git submodule update qemu-system-mips64el compiled successfully. Thank you.

Oops I wanted to ask your "git submodule status" output before that, to reproduce your bug. Anyway checking out a pre-v1.4.2 is enough.

Peter I guess I found the culprit, compile_prog is not called for dtc submodule. I'll send a patch.

Regards,

Phil.

#6 lore raw
In reply to Programmingkid
Quoted 20 lines · Programmingkid
Quoted 20 lines · Peter Maydell
Quoted 5 lines · Programmingkid
Quoted 5 lines · Philippe Mathieu-Daudé

Hi John,

On 07/25/2017 07:55 PM, Programmingkid wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

While compiling the mips64el-softmmu target I encountered these errors:
CC hw/display/g364fb.o
hw/core/loader-fit.c:105:41: error: expected expression

        *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                        ^

hw/core/loader-fit.c:105:32: error: use of undeclared identifier 'fdt32_t'

It seems you are missing the libfdt headers, so indeed you found bug.

Configure requires libfdt to exist to enable mips64el-softmmu, so something is going wrong with our configure test compared to how QEMU itself is being built.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

That appears to help make things move past the loader-fit.c file. Here are the new errors:

  CC      hw/core/loader-fit.o
  CC      hw/dma/rc4030.o
  CC      hw/ide/via.o

It looks you ran "make -j3" firing 3 CC tasks.

Quoted 74 lines
Quoted 6 lines
Quoted 3 lines

hw/core/loader-fit.c:105:41: error: expected expression

        *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                        ^

...this is still failing on loader-fit.c in the same way.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

And also the ./configure output, I'm interested by:

"fdt support no”

Actually it was "fdt support yes”.

Configure thinks the fdt headers are available…

They appear to be available. The dtc/libfdt folder does have the files QEMU uses.

Quoted 22 lines
Quoted 13 lines

./configure --target-list=mips64el-softmmu

Install prefix    /usr/local
BIOS directory    /usr/local/share/qemu
binary directory  /usr/local/bin

library directory /usr/local/lib
module directory /usr/local/lib/qemu
libexec directory /usr/local/libexec
include directory /usr/local/include
config directory /usr/local/etc
local state directory /usr/local/var
Manual directory /usr/local/share/man
ELF interp prefix /usr/gnemul/qemu-%M

Quoted 8 lines
Source path       /Users/john/Documents/Development/Projects/Qemu/qemu-git
C compiler        cc
Host C compiler   cc
C++ compiler      c++
Objective-C compiler clang
ARFLAGS           rv
CFLAGS            -O2 -g
QEMU_CFLAGS       -I/usr/local/Cellar/pixman/0.34.0/include/pixman-1 -I$(SRC_PATH)/dtc/libfdt -D_REENTRANT -I/usr/local/Cellar/glib/2.46.2/include
Quoted 5 lines

...and it's put our local copy of libfdt on the include path.

The fdt32_t type that the compiler is complaining
about ought to be defined in the header in
dtc/libfdt/libfdt_env.h.

The fdt32_t type is not there. Here is the full libfdt_env.h file:

#ifndef _LIBFDT_ENV_H
#define _LIBFDT_ENV_H

#include <stddef.h>
#include <stdint.h>
#include <string.h>

#define _B(n) ((unsigned long long)((uint8_t *)&x)[n])
static inline uint32_t fdt32_to_cpu(uint32_t x)

{
	return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3);
}

#define cpu_to_fdt32(x) fdt32_to_cpu(x)

static inline uint64_t fdt64_to_cpu(uint64_t x)

{
	return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32)
		| (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7);
}

#define cpu_to_fdt64(x) fdt64_to_cpu(x)
#undef _B

#endif /* _LIBFDT_ENV_H */

Quoted 2 lines

I wonder if you have an old copy of that submodule; if so then "git submodule update" ought to fix it.

Quoted 6 lines

I’m not sure how to obtain the version of libfdt. I did see a file called version.lds. At the top of this file is this text: "LIBFDT_1.2 {"
So maybe I am using version 1.2. Perhaps the configure test should declare a variable of the fdt32_t type in the test code.

After doing a git submodule update qemu-system-mips64el compiled successfully. Thank you.

Oops I wanted to ask your "git submodule status" output before that, to reproduce your bug. Anyway checking out a pre-v1.4.2 is enough.

Peter I guess I found the culprit, compile_prog is not called for dtc submodule. I'll send a patch.

Regards,

Phil.

#7 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 44 lines · Philippe Mathieu-Daudé

Hi John,

Quoted 7 lines · Programmingkid

While compiling the mips64el-softmmu target I encountered these errors:

CC hw/display/g364fb.o
hw/core/loader-fit.c:105:41: error: expected expression

         *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                         ^

hw/core/loader-fit.c:105:32: error: use of undeclared identifier 'fdt32_t'

It seems you are missing the libfdt headers, so indeed you found bug.

Replacing CONFIG_FITLOADER by CONFIG_FDT in hw/core/Makefile.objs and default-configs/mips64el-softmmu.mak should fix it, can you try?

Quoted 18 lines
         *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                ^
hw/core/loader-fit.c:108:41: error: expected expression
         *addr = fdt64_to_cpu(*(fdt64_t *)prop);
                                         ^
hw/core/loader-fit.c:108:32: error: use of undeclared identifier 'fdt64_t'
         *addr = fdt64_to_cpu(*(fdt64_t *)prop);
                                ^
hw/core/loader-fit.c:278:19: warning: implicit declaration of function
       'fdt_first_subnode' is invalid in C99
[-Wimplicit-function-declaration]
             off = fdt_first_subnode(itb, configs);
                   ^
hw/core/loader-fit.c:286:23: warning: implicit declaration of function
       'fdt_next_subnode' is invalid in C99
[-Wimplicit-function-declaration]
                 off = fdt_next_subnode(itb, off);
                       ^
Quoted 3 lines

2 warnings and 4 errors generated.
make: *** [hw/core/loader-fit.o] Error 1
make: *** Waiting for unfinished jobs….

It'd be useful if next time you also tell which compiler/version are you using.

Quoted 2 lines

Steps to reproduce the error:
./configure --target-list=mips64el-softmmu && make

Quoted 7 lines

And also the ./configure output, I'm interested by:

"fdt support no"

Regards,

Phil.

Hi,

As Philippe pointed, it looks like something with dtc(libfdt). Could you also try to install DTC into your QEMU source base? By default for mips64el-softmmu, if DTC is not compatible you should get this message.

ERROR: DTC (libfdt) version >= 1.4.2 not present. Your options:
(1) Preferred: Install the DTC (libfdt) devel package
(2) Fetch the DTC submodule, using:
git submodule update --init dtc

Since I am not able to reproduce the problem on my machines, please let us know the detail of your system.

$ ../master/configure --target-list=mips64el-softmmu && make -j
...
  GEN     trace/generated-helpers.c
  CC      mips64el-softmmu/trace/control-target.o
  CC      mips64el-softmmu/trace/generated-helpers.o
  LINK    mips64el-softmmu/qemu-system-mips64el

Regards,
Yongbok

#8 lore raw
Quoted 82 lines · Yongbok Kim
Quoted 44 lines · Philippe Mathieu-Daudé

Hi John,

Quoted 7 lines · Programmingkid

While compiling the mips64el-softmmu target I encountered these errors:

CC hw/display/g364fb.o
hw/core/loader-fit.c:105:41: error: expected expression

        *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                                        ^

hw/core/loader-fit.c:105:32: error: use of undeclared identifier 'fdt32_t'

It seems you are missing the libfdt headers, so indeed you found bug.

Replacing CONFIG_FITLOADER by CONFIG_FDT in hw/core/Makefile.objs and default-configs/mips64el-softmmu.mak should fix it, can you try?

Quoted 18 lines
        *addr = fdt32_to_cpu(*(fdt32_t *)prop);
                               ^
hw/core/loader-fit.c:108:41: error: expected expression
        *addr = fdt64_to_cpu(*(fdt64_t *)prop);
                                        ^
hw/core/loader-fit.c:108:32: error: use of undeclared identifier 'fdt64_t'
        *addr = fdt64_to_cpu(*(fdt64_t *)prop);
                               ^
hw/core/loader-fit.c:278:19: warning: implicit declaration of function
      'fdt_first_subnode' is invalid in C99
[-Wimplicit-function-declaration]
            off = fdt_first_subnode(itb, configs);
                  ^
hw/core/loader-fit.c:286:23: warning: implicit declaration of function
      'fdt_next_subnode' is invalid in C99
[-Wimplicit-function-declaration]
                off = fdt_next_subnode(itb, off);
                      ^
Quoted 3 lines

2 warnings and 4 errors generated.
make: *** [hw/core/loader-fit.o] Error 1
make: *** Waiting for unfinished jobs….

It'd be useful if next time you also tell which compiler/version are you using.

Quoted 2 lines

Steps to reproduce the error:
./configure --target-list=mips64el-softmmu && make

Quoted 7 lines

And also the ./configure output, I'm interested by:

"fdt support no"

Regards,

Phil.

Hi,

As Philippe pointed, it looks like something with dtc(libfdt). Could you also try to install DTC into your QEMU source base? By default for mips64el-softmmu, if DTC is not compatible you should get this message.

ERROR: DTC (libfdt) version >= 1.4.2 not present. Your options:
(1) Preferred: Install the DTC (libfdt) devel package
(2) Fetch the DTC submodule, using:
git submodule update --init dtc

Since I am not able to reproduce the problem on my machines, please let us know the detail of your system.

$ ../master/configure --target-list=mips64el-softmmu && make -j
...
 GEN     trace/generated-helpers.c
 CC      mips64el-softmmu/trace/control-target.o
 CC      mips64el-softmmu/trace/generated-helpers.o
 LINK    mips64el-softmmu/qemu-system-mips64el
Quoted 2 lines

Regards,
Yongbok

My host system is Mac OS 10.12. It looks like I was using an older version of libfdt. Updating fixed the problem. Thank you.