perf build: Fix broken feature check for llvm due to C++ standard

Message ID 20230712083037.4081444-1-tmricht@linux.ibm.com
State New
Headers
Series perf build: Fix broken feature check for llvm due to C++ standard |

Commit Message

Thomas Richter July 12, 2023, 8:30 a.m. UTC
  Perf build auto-detects features and packages already installed
for its build. This is done in directory tools/build/feature. This
directory contains small sample programs. When they successfully
compile the necessary prereqs in form of libraries and header
files are present.

Such a check is also done for llvm. And this check fails.
Fix this and update to the latest C++ standard.

Output before:
 # rm -f ./test-llvm.bin; make test-llvm.bin; ./test-llvm.bin
 g++  -MD -Wall -Werror -o test-llvm.bin test-llvm.cpp \
	 	> test-llvm.make.output 2>&1 -std=gnu++14 \
	-I/usr/include 		\
	-L/usr/lib64		\
	-lLLVM-16		\
			\
	> test-llvm.make.output 2>&1

 make: *** [Makefile:343: test-llvm.bin] Error 1
 -bash: ./test-llvm.bin: No such file or directory
 #

Output after:
 # rm -f ./test-llvm.bin; make test-llvm.bin; ./test-llvm.bin
 g++  -MD -Wall -Werror -o test-llvm.bin test-llvm.cpp \
	 	> test-llvm.make.output 2>&1 -std=gnu++17 \
	-I/usr/include 		\
	-L/usr/lib64		\
	-lLLVM-16		\
			\
	> test-llvm.make.output 2>&1
 Hello World!
 #

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
 tools/build/feature/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ian Rogers July 13, 2023, 3:10 a.m. UTC | #1
On Wed, Jul 12, 2023 at 1:35 AM Thomas Richter <tmricht@linux.ibm.com> wrote:
>
> Perf build auto-detects features and packages already installed
> for its build. This is done in directory tools/build/feature. This
> directory contains small sample programs. When they successfully
> compile the necessary prereqs in form of libraries and header
> files are present.
>
> Such a check is also done for llvm. And this check fails.
> Fix this and update to the latest C++ standard.
>
> Output before:
>  # rm -f ./test-llvm.bin; make test-llvm.bin; ./test-llvm.bin
>  g++  -MD -Wall -Werror -o test-llvm.bin test-llvm.cpp \
>                 > test-llvm.make.output 2>&1 -std=gnu++14 \
>         -I/usr/include          \
>         -L/usr/lib64            \
>         -lLLVM-16               \
>                         \
>         > test-llvm.make.output 2>&1
>
>  make: *** [Makefile:343: test-llvm.bin] Error 1
>  -bash: ./test-llvm.bin: No such file or directory
>  #
>
> Output after:
>  # rm -f ./test-llvm.bin; make test-llvm.bin; ./test-llvm.bin
>  g++  -MD -Wall -Werror -o test-llvm.bin test-llvm.cpp \
>                 > test-llvm.make.output 2>&1 -std=gnu++17 \
>         -I/usr/include          \
>         -L/usr/lib64            \
>         -lLLVM-16               \
>                         \
>         > test-llvm.make.output 2>&1
>  Hello World!
>  #
>
> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>

Tested-by: Ian Rogers <irogers@google.com>

Tested with clang/llvm 15.

Thanks,
Ian

> ---
>  tools/build/feature/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 0f0aa9b7d7b5..f8db69654791 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -340,7 +340,7 @@ $(OUTPUT)test-jvmti-cmlr.bin:
>         $(BUILD)
>
>  $(OUTPUT)test-llvm.bin:
> -       $(BUILDXX) -std=gnu++14                                 \
> +       $(BUILDXX) -std=gnu++17                                 \
>                 -I$(shell $(LLVM_CONFIG) --includedir)          \
>                 -L$(shell $(LLVM_CONFIG) --libdir)              \
>                 $(shell $(LLVM_CONFIG) --libs Core BPF)         \
> --
> 2.41.0
>
  

Patch

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 0f0aa9b7d7b5..f8db69654791 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -340,7 +340,7 @@  $(OUTPUT)test-jvmti-cmlr.bin:
 	$(BUILD)
 
 $(OUTPUT)test-llvm.bin:
-	$(BUILDXX) -std=gnu++14 				\
+	$(BUILDXX) -std=gnu++17					\
 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
 		-L$(shell $(LLVM_CONFIG) --libdir)		\
 		$(shell $(LLVM_CONFIG) --libs Core BPF)		\