Skip to contentSkip to conversation

meson: Fix initrd-stress.img build

PATCH Applied Fabiano Rosas 4 participants 8 messages May 25, 2023 – May 26, 2023 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover meson: Fix initrd-stress.img build

Just a small fix to the build of the initrd used by the migration guestperf.py script.

$ cd build
$ make tests/migration/initrd-stress.img   <-- BROKEN
$ ./tests/migration/guestperf.py --binary /path/to/qemu-system-x86_64 \
--initrd ./tests/migration/initrd-stress.img --debug

Fabiano Rosas (2):
meson: Remove leftover comment
meson: Add static glib dependency for initrd-stress.img

 meson.build                 | 2 --
 tests/migration/meson.build | 4 +++-
 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.35.3
#1 lore raw

PATCH 1/2 meson: Remove leftover comment

Commit d2e6f9272d ("fuzz: remove fork-fuzzing scaffolding") removed the linker script and forgot to remove the comment.

---
 meson.build | 2 --
 1 file changed, 2 deletions(-)
meson.build +0 -2
index ef181ff2df..ba1b7012cd 100644
@@ -395,8 +395,6 @@ if targetos != 'sunos' and not get_option('tsan')
   qemu_ldflags += cc.get_supported_link_arguments('-Wl,--warn-common')
 endif
 
-# Specify linker-script with add_project_link_arguments so that it is not placed
-# within a linker --start-group/--end-group pair
 if get_option('fuzzing')
   # Specify a filter to only instrument code that is directly related to
   # virtual-devices.
Signature · 1 line
2.35.3
#2 lore raw

PATCH 2/2 meson: Add static glib dependency for initrd-stress.img

In reply to Fabiano Rosas

We recently moved glib detection code to meson but the static libs were left out. Add a specific dependency for stress.c which is linked statically.

$ make V=1 tests/migration/initrd-stress.img

before:
cc -m64 -mcx16 -o tests/migration/stress ... -static -Wl,--start-group /usr/lib64/libglib-2.0.so -Wl,--end-group
...
bin/ld: attempted static link of dynamic object `/usr/lib64/libglib-2.0.so'

after:
cc -m64 -mcx16 -o tests/migration/stress ... -static -pthread -Wl,--start-group -lm /usr/lib64/libpcre.a -lglib-2.0 -Wl,--end-group

Fixes fc9a809e0d ("build: move glib detection and workarounds to meson")
---
 tests/migration/meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/migration/meson.build +3 -1
index dd562355a1..ac71f13290 100644
@@ -1,9 +1,11 @@
 sysprof = dependency('sysprof-capture-4', required: false)
+glib_static = dependency('glib-2.0', version: glib_req_ver, required: false,
+                         method: 'pkg-config', static: true)
 
 stress = executable(
   'stress',
   files('stress.c'),
-  dependencies: [glib, sysprof],
+  dependencies: [glib_static, sysprof],
   link_args: ['-static'],
   build_by_default: false,
 )
Signature · 1 line
2.35.3
Reviewed-by Tested-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] meson: Add static glib dependency for initrd-stress.img

Quoted 12 lines · Fabiano Rosas

We recently moved glib detection code to meson but the static libs were left out. Add a specific dependency for stress.c which is linked statically.

$ make V=1 tests/migration/initrd-stress.img

before:
cc -m64 -mcx16 -o tests/migration/stress ... -static -Wl,--start-group /usr/lib64/libglib-2.0.so -Wl,--end-group
...
bin/ld: attempted static link of dynamic object `/usr/lib64/libglib-2.0.so'

Quoted 6 lines

after:
cc -m64 -mcx16 -o tests/migration/stress ... -static -pthread -Wl,--start-group -lm /usr/lib64/libpcre.a -lglib-2.0 -Wl,--end-group

Fixes fc9a809e0d ("build: move glib detection and workarounds to meson")

queued.

#4 lore raw

Re: [PATCH 2/2] meson: Add static glib dependency for initrd-stress.img

In reply to Fabiano Rosas
Quoted 27 lines · Fabiano Rosas

We recently moved glib detection code to meson but the static libs were left out. Add a specific dependency for stress.c which is linked statically.

$ make V=1 tests/migration/initrd-stress.img

before:
cc -m64 -mcx16 -o tests/migration/stress ... -static -Wl,--start-group /usr/lib64/libglib-2.0.so -Wl,--end-group
...
bin/ld: attempted static link of dynamic object `/usr/lib64/libglib-2.0.so'

after:
cc -m64 -mcx16 -o tests/migration/stress ... -static -pthread -Wl,--start-group -lm /usr/lib64/libpcre.a -lglib-2.0 -Wl,--end-group

Fixes fc9a809e0d ("build: move glib detection and workarounds to meson")
---
 tests/migration/meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/migration/meson.build +0 -0
index dd562355a1..ac71f13290 100644

tests/migration/meson.build line 3

Quoted 3 lines
tests/migration/meson.build +2 -0
@@ -1,9 +1,11 @@
 sysprof = dependency('sysprof-capture-4', required: false)
+glib_static = dependency('glib-2.0', version: glib_req_ver, required: false,
+                         method: 'pkg-config', static: true)

Since required: false, the result might be "not found", which means we'll still hit the linker error. I think we need to surround the 'executable()' bit in

if glib_static.found()

     ...

endif

tests/migration/meson.build

Quoted 10 lines
tests/migration/meson.build +1 -1
 stress = executable(
   'stress',
   files('stress.c'),
-  dependencies: [glib, sysprof],
+  dependencies: [glib_static, sysprof],
   link_args: ['-static'],
   build_by_default: false,
 )
 

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#5 lore raw

Re: [PATCH 2/2] meson: Add static glib dependency for initrd-stress.img

Quoted 36 lines · Daniel P. Berrangé
Quoted 27 lines · Fabiano Rosas

We recently moved glib detection code to meson but the static libs were left out. Add a specific dependency for stress.c which is linked statically.

$ make V=1 tests/migration/initrd-stress.img

before:
cc -m64 -mcx16 -o tests/migration/stress ... -static -Wl,--start-group /usr/lib64/libglib-2.0.so -Wl,--end-group
...
bin/ld: attempted static link of dynamic object `/usr/lib64/libglib-2.0.so'

after:
cc -m64 -mcx16 -o tests/migration/stress ... -static -pthread -Wl,--start-group -lm /usr/lib64/libpcre.a -lglib-2.0 -Wl,--end-group

Fixes fc9a809e0d ("build: move glib detection and workarounds to meson")
---
 tests/migration/meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/migration/meson.build +0 -0
index dd562355a1..ac71f13290 100644

tests/migration/meson.build line 3

Quoted 3 lines
tests/migration/meson.build +2 -0
@@ -1,9 +1,11 @@
 sysprof = dependency('sysprof-capture-4', required: false)
+glib_static = dependency('glib-2.0', version: glib_req_ver, required: false,
+                         method: 'pkg-config', static: true)

Since required: false, the result might be "not found", which means we'll still hit the linker error. I think we need to surround the 'executable()' bit in

Quoted 4 lines

if glib_static.found()

     ...

endif

Right, but this time it would be a helpful linker error that would tell you what you are actually missing. Since this is "build_by_default:
false" I think we're better off letting the error through.

#7 lore raw
Quoted 1 line · Paolo Bonzini

Queued, thanks.

The second patch looks incomplete to me.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|