君正交叉编译链工具mips-gcc540-glibc222-64bit-r3.3.0.smaller.bz2编译st-device-sdk-c

bash 复制代码
git clone https://github.com/SmartThingsCommunity/st-device-sdk-c.git

cd st-device-sdk-c

git submodule update --init --recursive

#下载补丁包,下载地址https://github.ecodesamsung.com/SolutionsEngineering/TechSupport_Shawyar/blob/main/patch


#把下载的三个补丁文件放到st-device-sdk-c目录下,然后执行下面的三条语句

patch -p1 < 0001-PATCH-Requirement-change-to-apply-for-AV-SDK.patch
patch -p1 < 0002-Get-libiotcore.so-as-the-build-output.patch
patch -p1 < 0003-PATCH-cameraSDK-based-on-Raspberry.patch

#cd st-device-sdk-c

#执行 cmake -B build

-- The C compiler identification is GNU 5.4.0

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Check for working C compiler: /opt/mips-gcc540-glibc222-64bit-r3.3.0.smaller/bin/mips-linux-gnu-gcc - skipped //此处会显示所用的编译器

-- Detecting C compile features

-- Detecting C compile features - done

include default stdk_config

Enter component.cmake

-- Looking for deps/json/cJSON/cJSON.h

如果遇到错误:cmake的版本过低,使用以下命令:

cmake -B build -DCMAKE_POLICY_VERSION_MINIMUM=3.5

#cd build

#make
遇到这样的错误: 78% Building C object src/CMakeFiles/iotcore.dir/iot_api.c.o
78% Building C object src/CMakeFiles/iotcore.dir/iot_capability.c.o
79% Building C object src/CMakeFiles/iotcore.dir/iot_wt.c.o
79% Building C object src/CMakeFiles/iotcore.dir/iot_main.c.o
79% Building C object src/CMakeFiles/iotcore.dir/iot_nv_data.c.o
80% Building C object src/CMakeFiles/iotcore.dir/iot_util.c.o
80% Building C object src/CMakeFiles/iotcore.dir/iot_uuid.c.o
81% Building C object src/CMakeFiles/iotcore.dir/iot_root_ca.c.o
81% Building C object src/CMakeFiles/iotcore.dir/iot_log_file.c.o
81% Building C object src/CMakeFiles/iotcore.dir/iot_dump_log.c.o
82% Building C object src/CMakeFiles/iotcore.dir/port/bsp/raspberry/bluez/advertisement.c.o
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
from /usr/include/glib-2.0/glib/gtypes.h:32,
from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glib-2.0/gobject/gbinding.h:28,
from /usr/include/glib-2.0/glib-object.h:22,
from /usr/include/glib-2.0/gio/gioenums.h:28,
from /usr/include/glib-2.0/gio/giotypes.h:28,
from /usr/include/glib-2.0/gio/gio.h:26,
from /opt/test/st-device-sdk-c/src/port/bsp/raspberry/bluez/advertisement.c:21:
/usr/include/glib-2.0/glib/gtypes.h: In function '_GLIB_CHECKED_ADD_U64':
/usr/include/glib-2.0/glib/gmacros.h:738:31: error: static assertion failed: "Expression evaluates to false"
#define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
^
/usr/include/glib-2.0/glib/gtypes.h:463:3: note: in expansion of macro 'G_STATIC_ASSERT'
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
^
make2: *** src/CMakeFiles/iotcore.dir/build.make:193: src/CMakeFiles/iotcore.dir/port/bsp/raspberry/bluez/advertisement.c.o Error 1
make1: *** CMakeFiles/Makefile2:429: src/CMakeFiles/iotcore.dir/all Error 2
make: *** Makefile:130: all Error 2

解决办法:

sudo apt-get install gcc-multilib g++-multilib

sudo dpkg --add-architecture i386

sudo apt-get install libc6:i386

sudo apt-get install libglib2.0-0:i386 libglib2.0-dev:i386

#解决完以上问题后,使用以下步骤重新编译

export PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig:/usr/share/pkgconfig

删除build目录后,在项目根目录下重新执行

cmake -B build 或者 cmake -B build -DCMAKE_POLICY_VERSION_MINIMUM=3.5

cd build

make

相关推荐
apocelipes1 天前
常用编程语言和库的正则表达式性能对比
c语言·c++·python·性能优化·golang·开发工具和环境
LDR00616 天前
Type-C 快充全面升级!LDR6601 赋能个人护理便携电机,重塑剃须刀 / 理发器新体验
c语言·开发语言
雪碧聊技术16 天前
Tree.js是什么?一文讲透
开发语言·javascript·ecmascript
码云数智-园园16 天前
C++20 Modules 模块详解
java·开发语言·spring
swordbob16 天前
NIO的channel中什么是 fd(File Descriptor,文件描述符)
java·开发语言·nio
源分享16 天前
Java线程同步的多种实现方法(非常详细)
java·开发语言·jvm
Luminous.16 天前
C语言--day30
c语言·开发语言
玖玥拾16 天前
C/C++ 数据结构(七)栈、容器适配器
c语言·数据结构·c++··容器适配器
何以解忧,唯有..16 天前
Go语言循环语句详解:for、range与循环控制
开发语言·算法·golang
謓泽16 天前
C语言不是语法,是通往机器的地图。
c语言·开发语言