Bug 2383 - koji loongarch build error: Architecture is not included: loongarch64
Summary: koji loongarch build error: Architecture is not included: loongarch64
Status: NEW
Alias: None
Product: Anolis OS 8
Classification: Anolis OS
Component: BaseOS Packages (show other bugs) BaseOS Packages
Version: 8.6
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: geliwei-ali
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-13 17:47 UTC by lc
Modified: 2022-10-25 18:56 UTC (History)
1 user (show)

See Also:


Attachments
resolve build error (1.10 KB, patch)
2022-10-14 16:08 UTC, lc
Details
resolve build error (4.66 KB, patch)
2022-10-14 16:08 UTC, lc
Details
resolve build error (968 bytes, patch)
2022-10-14 16:09 UTC, lc
Details
spec file (16.84 KB, text/x-rpm-spec)
2022-10-14 16:10 UTC, lc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lc uniontech_group 2022-10-13 17:47:13 UTC
Description of problem:
loongarch build error
/builddir/build/BUILD/opa-ff-10.11.0.2/builtinclude.OPENIB_FF.release/iba/public/ispinlock_osd.h:190:2: error: #error "Unsupported CPU type"

Version-Release number of selected component (if applicable):
10.11.0.2-1.0.1

How reproducible:
koji build dist-an8.7 --nowait   git+https://gitee.com/src-anolis-os/opa-ff.git#origin/a8 --scratch --arch-override=loongarch64
Steps to Reproduce:
1.
2.
3.

Actual results:

/builddir/build/BUILD/opa-ff-10.11.0.2/builtinclude.OPENIB_FF.release/iba/public/ispinlock_osd.h:190:2: error: #error "Unsupported CPU type"
Expected results:


Additional info:
Comment 1 lc uniontech_group 2022-10-13 18:07:01 UTC
在这个报错前还有编译报错,已打补丁解决,补丁如下:
---
 MakeTools/funcs-ext.sh  | 5 +++++
 OpenIb_Host/ff_build.sh | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/MakeTools/funcs-ext.sh b/MakeTools/funcs-ext.sh
index cde728a..6a597fc 100755
--- a/MakeTools/funcs-ext.sh
+++ b/MakeTools/funcs-ext.sh
@@ -642,6 +642,11 @@ function settarget()
            export BUILD_TARGET_TOOLCHAIN=GNU
            export BUILD_TARGET=X86_64
            ;;
+    LOONGARCH64)
+        targetos LINUX
+        export BUILD_TARGET_TOOLCHAIN=GNU
+        export BUILD_TARGET=loongarch64
+        ;;
        PPC64)
            targetos LINUX
            export BUILD_TARGET_TOOLCHAIN=GNU
diff --git a/OpenIb_Host/ff_build.sh b/OpenIb_Host/ff_build.sh
index 2eabf1a..8477834 100755
--- a/OpenIb_Host/ff_build.sh
+++ b/OpenIb_Host/ff_build.sh
@@ -37,7 +37,7 @@ export BUILD_PLATFORM="LINUX"

 source ../MakeTools/funcs-ext.sh

-settarget x86_64
+settarget `uname -m` 
 settl

 # This is a user level file to build the basic project

---
 Makerules/Target.LINUX.GNU.loongarch64 | 107 +++++++++++++++++++++++++
 1 file changed, 107 insertions(+)
 create mode 100755 Makerules/Target.LINUX.GNU.loongarch64

diff --git a/Makerules/Target.LINUX.GNU.loongarch64 b/Makerules/Target.LINUX.GNU.loongarch64
new file mode 100755
index 0000000..d60c5d2
--- /dev/null
+++ b/Makerules/Target.LINUX.GNU.loongarch64
@@ -0,0 +1,107 @@
+# BEGIN_ICS_COPYRIGHT8 ****************************************
+# 
+# Copyright (c) 2015, Intel Corporation
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# 
+#     * Redistributions of source code must retain the above copyright notice,
+#       this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in the
+#       documentation and/or other materials provided with the distribution.
+#     * Neither the name of Intel Corporation nor the names of its contributors
+#       may be used to endorse or promote products derived from this software
+#       without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# 
+# END_ICS_COPYRIGHT8   ****************************************
+# suffixes and commands to build targets for:
+# BUILD_TARGET_OS=LINUX
+# BUILD_TARGET_TOOLCHAIN=GNU
+# BUILD_TARGET=loongarch64
+# Target specific defines for building LINUX target using GNU tools
+
+SHLIB_VERSION		?= 0.0
+LIB_PREFIX			= $(BUILDDIR)/lib
+SHLIB_SUFFIX		= .so
+SHLIB_VERSION_SUFFIX= .so.$(SHLIB_VERSION)
+ARLIB_SUFFIX		= .a
+EXE_SUFFIX			= 
+OBJ_SUFFIX			= .o
+ifdef BUILD_26
+KOBJ_SUFFIX			= .ko
+else
+KOBJ_SUFFIX			= .o
+endif
+EXP_SUFFIX			= .exp
+RES_SUFFIX			= .res
+PRE_SUFFIX			= .pre
+
+# Paths:
+# let compiler default inclusion of /usr/include, otherwise g++ builds broken
+SYS_INCLUDE_DIRS = 
+SYS_LIB_DIRS	 =
+
+#SBTOOLS_PATH	 = /usr/local/sbtools/x86-linux-rh7.2/mips-linux-2.3.1/bin
+
+CC			= gcc
+CCC			= g++
+LD			= ld
+LINT		= lint
+AR			= ar
+NM			= nm
+
+include $(TL_DIR)/Makerules/Defs.GNU
+
+# for GNU we set an soname on shared libraries
+SHLIB_SONAME=$(notdir $(CMD_TARGETS_SHLIB))
+
+# C/C++ compilation
+# ----------------------------
+# -fcheck-new does the opposite of what the manual implies.
+# -fcheck-new DISABLES the run-time test of return value from new
+CMACH		= -DTARGET_CPU_FAMILY_X86 -Wall -DCPU_BE -fno-strict-aliasing
+CCMACH		= $(CMACH) -fcheck-new -Wno-ctor-dtor-privacy
+CSYS		=
+CCSYS		= $(CSYS)
+CCLIBS		= 
+release_CCOPT_Flags	?=-O
+debug_CCOPT_Flags	=
+# Assemble the optimization flags based upon desired build configuration.
+CCOPT		= $($(strip $(BUILD_CONFIG))_CCOPT_Flags) -DLINUX -Dlinux -D__LINUX__
+# for now assume C++ flags are valid on C compiler
+COPT 		= $(CCOPT)
+release_CCDEBUG_Flags	=
+release_CDEBUG_Flags	=
+debug_CCDEBUG_Flags	=-g -DIB_DEBUG -DIB_TRACE $(CCPROJDEBUG) $(CCLOCALDEBUG)
+debug_CDEBUG_Flags	=-g -DIB_DEBUG -DIB_TRACE $(CPROJDEBUG) $(CLOCALDEBUG)
+# Assemble the debug flags based upon desired build configuration.
+CCDEBUG		= $($(strip $(BUILD_CONFIG))_CCDEBUG_Flags)
+CDEBUG		= $($(strip $(BUILD_CONFIG))_CDEBUG_Flags)
+
+# linking
+# ----------------------------
+LDMACH		= 
+LDSYS		=
+MKSHLIB		= $(CCC) $(CCDEBUG) $(COPT) -shared
+ifeq "$(strip $(LIBFILES))" ""
+MKARLIB		= $(AR) crus$(space)
+else
+MKARLIB		= $(MAKETOOLS_DIR)/mkarlib.sh $(AR) crus$(space)
+endif
+MKPARTIAL	= $(LD) -r -o
+
+LDLIBSRCH	+= $(foreach lib,$(LD_LIB_DIRS),-Xlinker -rpath-link -Xlinker $(lib))
+SYSLIBS		= -lpthread
+LDLIBS		= -Xlinker --start-group $(foreach lib,$(LOCALLIBS) $(LOCALDEPLIBS) $(MODLIBS) $(MODDEPLIBS) $(PROJLIBS) $(PROJDEPLIBS),-l$(lib)) -Xlinker --end-group $(SYSLIBS)
-- 
2.31.1

---
 Makerules/Rules.Common | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makerules/Rules.Common b/Makerules/Rules.Common
index 68465f1..2bbe9bc 100755
--- a/Makerules/Rules.Common
+++ b/Makerules/Rules.Common
@@ -691,7 +691,7 @@ endif # BUILD_TARGET_OS is WIN32
 #-----------------------------------------------------------------------------#
 # Check the environment for the BUILD_TARGET variable for validity
 
-SUPPORTED_TARGETS = ATOM MIPS I386 IA32 IA64 MIPS_BSP CYGWIN WIN32 X86_64 PPC PPC64 EM64T
+SUPPORTED_TARGETS = ATOM MIPS I386 IA32 IA64 MIPS_BSP CYGWIN WIN32 X86_64 PPC PPC64 EM64T loongarch64
 badtarget:
 	@echo "Invalid BUILD_TARGET value was specified: $(BUILD_TARGET)"
 	@echo "Must be one of: $(SUPPORTED_TARGETS)"
-- 
2.31.1
Comment 2 lc uniontech_group 2022-10-14 16:08:13 UTC
Created attachment 411 [details]
resolve build error
Comment 3 lc uniontech_group 2022-10-14 16:08:52 UTC
Created attachment 412 [details]
resolve build error
Comment 4 lc uniontech_group 2022-10-14 16:09:31 UTC
Created attachment 413 [details]
resolve build error
Comment 5 lc uniontech_group 2022-10-14 16:10:13 UTC
Created attachment 414 [details]
spec file