Skip to contentSkip to conversation

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

PATCH In review Thomas Richter 2 participants 5 messages Jul 12, 2023 – Jul 13, 2023

lore
Share & tools
lore
#0 lore raw

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

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!
 #
---
 tools/build/feature/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/feature/Makefile +1 -1
index 0f0aa9b7d7b5..f8db69654791 100644
@@ -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)		\
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/1 perf build: Fix broken feature check for clang due to C++ standard and changed library packaging

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 clang. And this check fails.

Fix this and update to the latest C++ standard and use the new library provided by clang (which contains new packaging) see this link for reference:
https://fedoraproject.org/wiki/Changes/Stop-Shipping-Individual-Component-Libraries-In-clang-lib-Package

Output before:

 # rm -f ./test-clang.bin; make test-clang.bin; ./test-clang.bin; \
	ll test-clang.make.output
 g++  -MD -Wall -Werror -o test-clang.bin test-clang.cpp \
	 	> test-clang.make.output 2>&1 -std=gnu++14 \
	-I/usr/include 		\
	-L/usr/lib64		\
	-Wl,--start-group -lclangBasic -lclangDriver	\
	  -lclangFrontend -lclangEdit -lclangLex	\
	  -lclangAST -Wl,--end-group 			\
	-lLLVM-16	\
			\
	> test-clang.make.output 2>&1
 make: *** [Makefile:356: test-clang.bin] Error 1
 -bash: ./test-clang.bin: No such file or directory
 -rw-r--r--. 1 root root 252041 Jul 12 09:56 test-clang.make.output
 #

File test-clang.make.output contains many lines of unreferenced symbols.

Output after:

 # rm -f ./test-clang.bin; make test-clang.bin; ./test-clang.bin; \
	cat test-clang.make.output
 g++  -MD -Wall -Werror -o test-clang.bin test-clang.cpp \
	 > test-clang.make.output 2>&1 -std=gnu++17	\
	-I/usr/include 		\
	-L/usr/lib64		\
	-Wl,--start-group -lclang-cpp -Wl,--end-group	\
	-lLLVM-16	\
			\
	> test-clang.make.output 2>&1
 #
---
 tools/build/feature/Makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/build/feature/Makefile +2 -4
index f8db69654791..0b4a6e43c5cc 100644
@@ -353,12 +353,10 @@ $(OUTPUT)test-llvm-version.bin:
 		> $(@:.bin=.make.output) 2>&1
 
 $(OUTPUT)test-clang.bin:
-	$(BUILDXX) -std=gnu++14					\
+	$(BUILDXX) -std=gnu++17					\
 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
 		-L$(shell $(LLVM_CONFIG) --libdir)		\
-		-Wl,--start-group -lclangBasic -lclangDriver	\
-		  -lclangFrontend -lclangEdit -lclangLex	\
-		  -lclangAST -Wl,--end-group 			\
+		-Wl,--start-group -lclang-cpp -Wl,--end-group	\
 		$(shell $(LLVM_CONFIG) --libs Core option)	\
 		$(shell $(LLVM_CONFIG) --system-libs)		\
 		> $(@:.bin=.make.output) 2>&1
Signature · 1 line
2.41.0
Tested-by on v1 1/1
#2 lore raw

Re: [PATCH] perf build: Fix broken feature check for clang due to C++ standard and changed library packaging

Quoted 48 lines · Thomas Richter

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 clang. And this check fails.

Fix this and update to the latest C++ standard and use the new library provided by clang (which contains new packaging) see this link for reference:
https://fedoraproject.org/wiki/Changes/Stop-Shipping-Individual-Component-Libraries-In-clang-lib-Package

Output before:

 # rm -f ./test-clang.bin; make test-clang.bin; ./test-clang.bin; \
        ll test-clang.make.output
 g++  -MD -Wall -Werror -o test-clang.bin test-clang.cpp \
                > test-clang.make.output 2>&1 -std=gnu++14 \
        -I/usr/include          \
        -L/usr/lib64            \
        -Wl,--start-group -lclangBasic -lclangDriver    \
          -lclangFrontend -lclangEdit -lclangLex        \
          -lclangAST -Wl,--end-group                    \
        -lLLVM-16       \
                        \
        > test-clang.make.output 2>&1
 make: *** [Makefile:356: test-clang.bin] Error 1
 -bash: ./test-clang.bin: No such file or directory
 -rw-r--r--. 1 root root 252041 Jul 12 09:56 test-clang.make.output
 #

File test-clang.make.output contains many lines of unreferenced symbols.

Output after:

 # rm -f ./test-clang.bin; make test-clang.bin; ./test-clang.bin; \
        cat test-clang.make.output
 g++  -MD -Wall -Werror -o test-clang.bin test-clang.cpp \
         > test-clang.make.output 2>&1 -std=gnu++17     \
        -I/usr/include          \
        -L/usr/lib64            \
        -Wl,--start-group -lclang-cpp -Wl,--end-group   \
        -lLLVM-16       \
                        \
        > test-clang.make.output 2>&1
 #
Quoted 1 line

Thanks!
Ian

Quoted 26 lines
---
 tools/build/feature/Makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/build/feature/Makefile +2 -5
index f8db69654791..0b4a6e43c5cc 100644
@@ -353,12 +353,10 @@ $(OUTPUT)test-llvm-version.bin:
                > $(@:.bin=.make.output) 2>&1
 
 $(OUTPUT)test-clang.bin:
-       $(BUILDXX) -std=gnu++14                                 \
+       $(BUILDXX) -std=gnu++17                                 \
                -I$(shell $(LLVM_CONFIG) --includedir)          \
                -L$(shell $(LLVM_CONFIG) --libdir)              \
-               -Wl,--start-group -lclangBasic -lclangDriver    \
-                 -lclangFrontend -lclangEdit -lclangLex        \
-                 -lclangAST -Wl,--end-group                    \
+               -Wl,--start-group -lclang-cpp -Wl,--end-group   \
                $(shell $(LLVM_CONFIG) --libs Core option)      \
                $(shell $(LLVM_CONFIG) --system-libs)           \
                > $(@:.bin=.make.output) 2>&1
--

2.41.0

#3 lore raw

Re: [PATCH] perf build: Fix broken feature check for clang due to C++ standard and changed library packaging

Quoted 50 lines · Ian Rogers
Quoted 48 lines · Thomas Richter

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 clang. And this check fails.

Fix this and update to the latest C++ standard and use the new library provided by clang (which contains new packaging) see this link for reference:
https://fedoraproject.org/wiki/Changes/Stop-Shipping-Individual-Component-Libraries-In-clang-lib-Package

Output before:

 # rm -f ./test-clang.bin; make test-clang.bin; ./test-clang.bin; \
        ll test-clang.make.output
 g++  -MD -Wall -Werror -o test-clang.bin test-clang.cpp \
                > test-clang.make.output 2>&1 -std=gnu++14 \
        -I/usr/include          \
        -L/usr/lib64            \
        -Wl,--start-group -lclangBasic -lclangDriver    \
          -lclangFrontend -lclangEdit -lclangLex        \
          -lclangAST -Wl,--end-group                    \
        -lLLVM-16       \
                        \
        > test-clang.make.output 2>&1
 make: *** [Makefile:356: test-clang.bin] Error 1
 -bash: ./test-clang.bin: No such file or directory
 -rw-r--r--. 1 root root 252041 Jul 12 09:56 test-clang.make.output
 #

File test-clang.make.output contains many lines of unreferenced symbols.

Output after:

 # rm -f ./test-clang.bin; make test-clang.bin; ./test-clang.bin; \
        cat test-clang.make.output
 g++  -MD -Wall -Werror -o test-clang.bin test-clang.cpp \
         > test-clang.make.output 2>&1 -std=gnu++17     \
        -I/usr/include          \
        -L/usr/lib64            \
        -Wl,--start-group -lclang-cpp -Wl,--end-group   \
        -lLLVM-16       \
                        \
        > test-clang.make.output 2>&1
 #
Quoted 3 lines
Quoted 1 line

Ah, presumably obsolete to:
https://lore.kernel.org/linux-perf-users/[email protected]/

Thanks,
Ian

Quoted 29 lines

Thanks!
Ian

Quoted 26 lines
---
 tools/build/feature/Makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/build/feature/Makefile +2 -5
index f8db69654791..0b4a6e43c5cc 100644
@@ -353,12 +353,10 @@ $(OUTPUT)test-llvm-version.bin:
                > $(@:.bin=.make.output) 2>&1
 
 $(OUTPUT)test-clang.bin:
-       $(BUILDXX) -std=gnu++14                                 \
+       $(BUILDXX) -std=gnu++17                                 \
                -I$(shell $(LLVM_CONFIG) --includedir)          \
                -L$(shell $(LLVM_CONFIG) --libdir)              \
-               -Wl,--start-group -lclangBasic -lclangDriver    \
-                 -lclangFrontend -lclangEdit -lclangLex        \
-                 -lclangAST -Wl,--end-group                    \
+               -Wl,--start-group -lclang-cpp -Wl,--end-group   \
                $(shell $(LLVM_CONFIG) --libs Core option)      \
                $(shell $(LLVM_CONFIG) --system-libs)           \
                > $(@:.bin=.make.output) 2>&1
--

2.41.0

Tested-by on v1 1/1
#4 lore raw
In reply to Thomas Richter
Quoted 36 lines · Thomas Richter

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!
 #
Quoted 1 line

Tested with clang/llvm 15.

Thanks,
Ian

Quoted 20 lines
---
 tools/build/feature/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/feature/Makefile +1 -2
index 0f0aa9b7d7b5..f8db69654791 100644
@@ -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