From f425e57a89d411f4a9497abb4f8b0015e029776a Mon Sep 17 00:00:00 2001 From: ctyunsystem Date: Wed, 15 Jun 2022 17:12:52 +0800 Subject: [PATCH] fix qemu-4.x c++ link error --- libcareplus.spec | 1 + src/Makefile | 1 + src/kpatch_cc.c | 2 +- src/libcare-patch-make | 6 +++--- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libcareplus.spec b/libcareplus.spec index fd446e0..0468df7 100644 --- a/libcareplus.spec +++ b/libcareplus.spec @@ -87,6 +87,7 @@ rm -rf $RPM_BUILD_ROOT %files devel %defattr(-,root,root) %{_bindir}/libcare-cc +%{_bindir}/libcare-cxx %{_bindir}/libcare-patch-make %{_bindir}/kpatch_gensrc %{_bindir}/kpatch_strip diff --git a/src/Makefile b/src/Makefile index e7d7c08..1bcb11c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -120,5 +120,6 @@ install: all $(INSTALL) -m 0500 kpatch_make $(DESTDIR)/$(bindir)/kpatch_make $(INSTALL) -m 0500 kpatch_strip $(DESTDIR)/$(bindir)/kpatch_strip $(INSTALL) -m 0500 libcare-dump $(DESTDIR)/$(bindir)/libcare-dump + ln -sf $(bindir)/libcare-cc $(DESTDIR)/$(bindir)/libcare-cxx .PHONY: all clean test tests tests-gensrc tests-strip diff --git a/src/kpatch_cc.c b/src/kpatch_cc.c index 0f68328..32d7d13 100644 --- a/src/kpatch_cc.c +++ b/src/kpatch_cc.c @@ -261,7 +261,7 @@ static void init(int argc_, const char **argv_) prog_name = argv_[0]; if (strcmp(prog_name, "g++") == 0 || strcmp(prog_name, "c++") == 0 || - strcmp(prog_name, "kpcc++") == 0) { + strstr(prog_name, "libcare-cxx")) { realgccenv = "KPCXXREAL"; realgcc = "/usr/bin/g++"; } diff --git a/src/libcare-patch-make b/src/libcare-patch-make index 41e5926..a6f73c5 100755 --- a/src/libcare-patch-make +++ b/src/libcare-patch-make @@ -42,7 +42,7 @@ prepare_env() { export IS_LIBCARE_CC=y export CC=$KPATCH_PATH/libcare-cc - export CXX=$CC + export CXX=$KPATCH_PATH/libcare-cxx MAKE_OUTPUT=/dev/stdout @@ -98,7 +98,7 @@ build_objects() { export KPCC_DBGFILTER_ARGS="" echo "${green}BUILDING ORIGINAL CODE${reset}" - local lp_make_env_original="CC=${CC}" + local lp_make_env_original="CC=${CC} CXX=${CXX}" make $LPMAKEFILE $JOBS_MAKE ${lp_make_env_original} >$MAKE_OUTPUT 2>&1 echo "${green}INSTALLING ORIGINAL OBJECTS INTO $LPMAKE_ORIGINAL_DIR${reset}" @@ -125,7 +125,7 @@ build_objects() { export KPCC_APPEND_ARGS="-Wl,-q" echo "${green}BUILDING PATCHED CODE${reset}" - local lp_make_env_patched="CC=${CC}" + local lp_make_env_patched="CC=${CC} CXX=${CXX}" make $LPMAKEFILE $JOBS_MAKE ${lp_make_env_patched} >$MAKE_OUTPUT 2>&1 echo "${green}INSTALLING PATCHED OBJECTS INTO $LPMAKE_PATCHED_DIR${reset}" -- Gitee