public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] Makefile: Report error and stop if we can't set TARGET
@ 2024-12-19 16:36 Stefano Brivio
  2024-12-20  0:21 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Stefano Brivio @ 2024-12-19 16:36 UTC (permalink / raw)
  To: passt-dev

I don't think it's necessarily productive to check all the possible
error conditions in the Makefile, but this one is annoying: issue
'make' without a C compiler, then install one, and build again.

Then run passt and it will mysteriously terminate on epoll_wait(),
because seccomp.h is good enough to build against, but the resulting
seccomp filter doesn't allow any system call. Not really fun to debug.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 1fce737..464eef1 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,7 @@ VERSION ?= $(shell git describe --tags HEAD 2>/dev/null || echo "unknown\ versio
 DUAL_STACK_SOCKETS := 1
 
 TARGET ?= $(shell $(CC) -dumpmachine)
+$(if $(TARGET),,$(error Failed to get target architecture))
 # Get 'uname -m'-like architecture description for target
 TARGET_ARCH := $(firstword $(subst -, ,$(TARGET)))
 TARGET_ARCH := $(patsubst [:upper:],[:lower:],$(TARGET_ARCH))
-- 
@@ -16,6 +16,7 @@ VERSION ?= $(shell git describe --tags HEAD 2>/dev/null || echo "unknown\ versio
 DUAL_STACK_SOCKETS := 1
 
 TARGET ?= $(shell $(CC) -dumpmachine)
+$(if $(TARGET),,$(error Failed to get target architecture))
 # Get 'uname -m'-like architecture description for target
 TARGET_ARCH := $(firstword $(subst -, ,$(TARGET)))
 TARGET_ARCH := $(patsubst [:upper:],[:lower:],$(TARGET_ARCH))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Makefile: Report error and stop if we can't set TARGET
  2024-12-19 16:36 [PATCH] Makefile: Report error and stop if we can't set TARGET Stefano Brivio
@ 2024-12-20  0:21 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2024-12-20  0:21 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: passt-dev

[-- Attachment #1: Type: text/plain, Size: 1459 bytes --]

On Thu, Dec 19, 2024 at 05:36:34PM +0100, Stefano Brivio wrote:
> I don't think it's necessarily productive to check all the possible
> error conditions in the Makefile, but this one is annoying: issue
> 'make' without a C compiler, then install one, and build again.
> 
> Then run passt and it will mysteriously terminate on epoll_wait(),
> because seccomp.h is good enough to build against, but the resulting
> seccomp filter doesn't allow any system call. Not really fun to debug.
> 
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>

Haven't hit that, but it does sound really annoying.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Makefile b/Makefile
> index 1fce737..464eef1 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -16,6 +16,7 @@ VERSION ?= $(shell git describe --tags HEAD 2>/dev/null || echo "unknown\ versio
>  DUAL_STACK_SOCKETS := 1
>  
>  TARGET ?= $(shell $(CC) -dumpmachine)
> +$(if $(TARGET),,$(error Failed to get target architecture))
>  # Get 'uname -m'-like architecture description for target
>  TARGET_ARCH := $(firstword $(subst -, ,$(TARGET)))
>  TARGET_ARCH := $(patsubst [:upper:],[:lower:],$(TARGET_ARCH))

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-20  1:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-19 16:36 [PATCH] Makefile: Report error and stop if we can't set TARGET Stefano Brivio
2024-12-20  0:21 ` David Gibson

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).