From 5369affe398b04ad27dbdc331fd2d3a193269006 Mon Sep 17 00:00:00 2001 From: Daniel Barry Date: Wed, 11 Dec 2024 19:27:40 +0000 Subject: [PATCH 1/2] configure: -pthread with intel_gpu Since the intel_gpu component uses mutexes, which use POSIX threads on some systems, -pthread needs to be used when this component is configured-in. These changes have been tested on the Intel Max 1550 GPU. --- src/configure | 2 +- src/configure.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/configure b/src/configure index 7473697ee..9159ca8cc 100755 --- a/src/configure +++ b/src/configure @@ -6974,7 +6974,7 @@ for comp in $components; do # check for intel_gpu or rocp_sdk component to determine if we need -lstdc++ in LDFLAGS if (test "x$comp" = "xintel_gpu" || test "x$comp" = "xrocp_sdk"); then - LDFLAGS="$LDFLAGS -lstdc++" + LDFLAGS="$LDFLAGS -lstdc++ -pthread" fi if test "x$comp" = "xsysdetect" ; then diff --git a/src/configure.in b/src/configure.in index f503454d0..43197dd4d 100644 --- a/src/configure.in +++ b/src/configure.in @@ -1965,7 +1965,7 @@ for comp in $components; do # check for intel_gpu or rocp_sdk component to determine if we need -lstdc++ in LDFLAGS if (test "x$comp" = "xintel_gpu" || test "x$comp" = "xrocp_sdk"); then - LDFLAGS="$LDFLAGS -lstdc++" + LDFLAGS="$LDFLAGS -lstdc++ -pthread" fi if test "x$comp" = "xsysdetect" ; then From 2f265efb52aa2b4c1b6020559112b025aed52356 Mon Sep 17 00:00:00 2001 From: Daniel Barry Date: Wed, 11 Dec 2024 19:30:46 +0000 Subject: [PATCH 2/2] intel_gpu: remove unnecessary linker flags Since the flag -lstdc++ is already included from the configure script, it does not need to be included in the component's Rules and Makefiles. Also, -g is already included in the recipes, it is not needed in the linker flags variable. These changes have been tested on the Intel Max 1550 GPU. --- src/components/intel_gpu/Rules.intel_gpu | 4 ++-- src/components/intel_gpu/tests/Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/intel_gpu/Rules.intel_gpu b/src/components/intel_gpu/Rules.intel_gpu index d5262981a..f23f28f96 100644 --- a/src/components/intel_gpu/Rules.intel_gpu +++ b/src/components/intel_gpu/Rules.intel_gpu @@ -15,7 +15,7 @@ GPUOBJS = GPUMetricInterface.o GPUMetricHandler.o linux_intel_gpu_metrics.o COMPOBJS += $(GPUOBJS) CFLAGS += $(LDL) -g -DDEBUG -I$(GPU_INTERNAL) -I$(GPU_INTERNAL)/inc -D_GLIBCXX_USE_CXX11_ABI=1 -LDFLAGS += -g -lstdc++ -ldl +LDFLAGS += -ldl GPUMetricInterface.o: $(GPU_INTERNAL)/src/GPUMetricInterface.cpp $(GPUHEADER) $(CXX) -g -fpic $(CFLAGS) $(CPPFLAGS) -I$(GPU_INTERNAL)/inc -I$(INTEL_L0_HEADERS) -o GPUMetricInterface.o -c $(GPU_INTERNAL)/src/GPUMetricInterface.cpp @@ -24,6 +24,6 @@ GPUMetricHandler.o: $(GPU_INTERNAL)/src/GPUMetricHandler.cpp $(GPUHEADER) $(GPU $(CXX) -g -fpic $(CFLAGS) $(CPPFLAGS) -I$(GPU_INTERNAL)/inc -I$(INTEL_L0_HEADERS) -o GPUMetricHandler.o -c $(GPU_INTERNAL)/src/GPUMetricHandler.cpp linux_intel_gpu_metrics.o: $(GPUCOMP)/linux_intel_gpu_metrics.c $(GPUHEADER) - $(CC) $(LIBCFLAGS) $(CFLAGS) $(CPPFLAGS) $(OPTFLAGS) -g -o linux_intel_gpu_metrics.o -c $(GPUCOMP)/linux_intel_gpu_metrics.c $(LDFLAG) + $(CC) $(LIBCFLAGS) $(CFLAGS) $(CPPFLAGS) $(OPTFLAGS) -g -o linux_intel_gpu_metrics.o -c $(GPUCOMP)/linux_intel_gpu_metrics.c $(LDFLAGS) ##clean: diff --git a/src/components/intel_gpu/tests/Makefile b/src/components/intel_gpu/tests/Makefile index a79a77936..2ffef709f 100644 --- a/src/components/intel_gpu/tests/Makefile +++ b/src/components/intel_gpu/tests/Makefile @@ -4,7 +4,7 @@ CFLAGS += -DDEBUG -I../../../testlib INTEL_L0_HEADERS ?=/usr/include INTEL_L0_LIB64 ?=/usr/lib -CPPLDFLAGS+=-lstdc++ -ldl +CPPLDFLAGS+=-ldl GPULIB=-L$(INTEL_L0_LIB64) -lze_loader %.o:%.c