I've just noticed the following build failure on Ubuntu 25.04 on VisionFive2 board: ``` $ gcc --version gcc (Ubuntu 14.2.0-19ubuntu2) 14.2.0 $ gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -I../include -I../VEX/pub -I../VEX/pub -DVGA_riscv64=1 -DVGO_linux=1 -DVGP_riscv64_linux=1 -DVGPV_riscv64_linux_vanilla=1 -I../coregrind -DVG_LIBDIR="\"/home/ubuntu/.bin/libexec/valgrind"\" -DVG_PLATFORM="\"riscv64-linux\"" -g -MT m_dispatch/libcoregrind_riscv64_linux_a-dispatch-riscv64-linux.o -MD -MP -MF m_dispatch/.deps/libcoregrind_riscv64_linux_a-dispatch-riscv64-linux.Tpo -c -o m_dispatch/libcoregrind_riscv64_linux_a-dispatch-riscv64-linux.o `test -f 'm_dispatch/dispatch-riscv64-linux.S' || echo './'`m_dispatch/dispatch-riscv64-linux.S m_dispatch/dispatch-riscv64-linux.S: Assembler messages: m_dispatch/dispatch-riscv64-linux.S:170: Error: illegal operands `ld t0,OFFSET_riscv64_pc-2048(s0)' make[3]: *** [Makefile:4349: m_dispatch/libcoregrind_riscv64_linux_a-dispatch-riscv64-linux.o] Error 1 ``` Similarly, Clang also rejects the assembly code: ``` m_dispatch/dispatch-riscv64-linux.S:170:31: error: unexpected token ld t0, OFFSET_riscv64_pc-2048(s0) ^ ```
The issue only manifests if I use the git repository, not the official 3.25 tarball.
(In reply to Martin Liška from comment #1) > The issue only manifests if I use the git repository, not the official 3.25 > tarball. Do you run autogen.sh before configure?
Constants like OFFSET_riscv64_pc are generated by compiling VEX/auxprogs/genoffsets.c to an .s file and grepping out the defines. See the pub/libvex_guest_offsets.h rule in Makefile.vex.am: # This is very uggerly. Need to sed out both "xyzzyN" and # "xyzzy$N" since gcc on different targets emits the constants # differently -- with a leading $ on x86/amd64 but none on ppc32/64. # ICC also emits the constants differently with a leading # #define Might that go wrong somehow for you?
Created attachment 181227 [details] autogen + configure log I can confirm the problem is the `VEX/pub/libvex_guest_offsets.h` file is not created when running autogen.sh + configure for the git version of the project.
The bit of Makefile that does this is pub/libvex_guest_offsets.h: auxprogs/genoffsets.c \ pub/libvex_basictypes.h \ pub/libvex_guest_x86.h \ pub/libvex_guest_amd64.h \ pub/libvex_guest_ppc32.h \ pub/libvex_guest_ppc64.h \ pub/libvex_guest_arm.h \ pub/libvex_guest_arm64.h \ pub/libvex_guest_s390x.h \ pub/libvex_guest_mips32.h \ pub/libvex_guest_mips64.h \ pub/libvex_guest_riscv64.h rm -f auxprogs/genoffsets.s $(mkdir_p) auxprogs pub $(CC) $(CFLAGS_FOR_GENOFFSETS) \ $(LIBVEX_CFLAGS_NO_LTO) \ $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) \ -O -S -o auxprogs/genoffsets.s \ $(srcdir)/auxprogs/genoffsets.c grep xyzzy auxprogs/genoffsets.s | grep "^[# ]*#define" \ | sed "s/# #define/#define/g" \ | sed "s/xyzzy\\$$//g" \ | sed "s/xyzzy#//g" \ | sed "s/xyzzy//g" \ > pub/libvex_guest_offsets.h rm -f auxprogs/genoffsets.s this - deletes the old asm file - runs gcc on the C file and outputs asm - greps for xyzzy and then filters out a load of stuff You should be able to run just those commands by doing cd VEX make pub/libvex_guest_offsets.h Can you run some of those commands by hand to see where it is going wrong?
If I run the run `make pub/libvex_guest_offsets.h` in the VEC folder, then I got correctly generated header file: ``` $ make pub/libvex_guest_offsets.h rm -f auxprogs/genoffsets.s /usr/bin/mkdir -p auxprogs pub gcc \ -Wbad-function-cast -fstrict-aliasing \ -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-unused-result -Wcast-align -Wcast-qual -Wwrite-strings -Wempty-body -Wformat -Wformat-signedness -Wformat-security -Wignored-qualifiers -Wmissing-parameter-type -Wlogical-op -Wenum-conversion -Wimplicit-fallthrough=2 -Wold-style-declaration -finline-functions -fno-stack-protector -fno-strict-aliasing -fno-builtin \ -O -S -o auxprogs/genoffsets.s \ ./auxprogs/genoffsets.c grep xyzzy auxprogs/genoffsets.s | grep "^[# ]*#define" \ | sed "s/# #define/#define/g" \ | sed "s/xyzzy\\$//g" \ | sed "s/xyzzy#//g" \ | sed "s/xyzzy//g" \ > pub/libvex_guest_offsets.h rm -f auxprogs/genoffsets.s $ grep OFFSET_riscv64_pc pub/libvex_guest_offsets.h #define OFFSET_riscv64_pc 272 ```
Does a single process build work OK?
Does this not happen on a fresh checkout or after doing a make distclean ?
I can confirm that if I build the Valgrind with `make -j1`, then it builds correctly, while previously I used `make -j4`.
(In reply to Martin Liška from comment #9) > I can confirm that if I build the Valgrind with `make -j1`, then it builds > correctly, while previously I used `make -j4`. Do you run autogen.sh? The problem is either that parallel make is failing to produce pub/libvex_guest_offsets.h or somehow make is reaching coregrind before the header has been generated. I believe that automake is supposed to only run parallel make recursively in subdirectories. It's not parallel at the top level. Can you post the first 30 lines of make.log (up to the first C file compiled in VEX) when you do make distclean ./autogen.sh make -j 4 2>&1 | tee make.log (change the redirection to |& if you use [t]csh)
I retried building the project from the git repo and it works fine now. Thus let's close it.