开发Hi3518第一个示例程序Say Hello to HarmonyOS就出现问题了
本帖最后由 sunsili 于 2023-3-8 23:32 编辑开发Hi3518第一个示例程序Say Hello to HarmonyOS
开发环境 windows10 + wsl:ubuntu
获取源码
开发者需要在Linux服务器上下载并解压一套源代码,获取Hi3518源码(下载链接https://gitee.com/openharmony/docs/blob/master/get-code/%E6%BA%90%E7%A0%81%E8%8E%B7%E5%8F%96.md)。更多源码获取方式,请见源码获取。
下载是用windows10, 放在e盘
在当前目录新建目录
cd ~
mkdir HarmonyOS_code
解压源码
tar -zxvf /mnt/e/code-1.0.tar.gz -C ~/HarmonyOS_code
修改应用程序
我每次开发新东西好像都是先Say hello,我先Say hello
源码applications/sample/camera/app/src目录内helloworld.c代码如下所示,用户可以自定义修改打印内容(例如:修改OHOS为World)。当前应用程序可支持ISO C及C++的代码开发。
vscode 安装wsl:ubuntu插件可以打开 wsl:ubuntu文件, 这点用win10非常方便
<p>#include <stdio.h>
#include "los_sample.h"
int main(int argc, char **argv)
{
printf("\n************************************************\n");
printf("Hi I'm Lojam, Hello OHOS!\n\r");
printf("Copyright @Sunshine Silicon \n\r ");
printf("\n************************************************\n\n");
LOS_Sample(g_num); // 鸿蒙系统特有的我也不知道是什么意思, 应该定义打函数,这样定义有点不詹够方便,要关闭log时,每一个都要注释,同一个示例目录里 调用los_samle.c里的LOS_Sample函数
return 0;
}</p><p>los_samle.c内容</p><p>#include <stdio.h></p><p>int g_num = 81;
void LOS_Sample(int param)
{
printf("This is a sample: Param = %d\n", param);
}</p>
看看这个目录的Makefile内容
STATIC_COMPILE = n
编译
之前Linux开发uboot、内核、文件系统、应用是分开编译的,一般只编译一次烧录,应用直接make编译出来copy到硬件环境里就可以了
这里是所有的uboot、内核、文件系统、应用一起编译初次使用还有,后面老全部编译就很麻烦了,编译时间长,希望可以应用直接编译,然后copy到板子里,后面写应用或驱动就方便多了
python build.py ipcamera_hi3518ev300 -b debug
编译出错了,把编译日志放出来,希望能有大神帮助解决
……没有找到./adapt_liteos_config.sh:…………
/home/fan/HarmonyOS_Code/vendor/hisi/hi35xx/middleware/source/third_party/ffmpeg
./adapt_liteos_config.sh: 4: function: not found
sed: -e expression #1, char 0: no previous regular expression
./adapt_liteos_config.sh: 11: function: not found
./adapt_liteos_config.sh: 19: function: not found
adapt ffmpeg for liteos
./adapt_liteos_config.sh: 29: effect_opt: not found
./adapt_liteos_config.sh: 30: effect_opt: not found
./adapt_liteos_config.sh: 31: effect_opt: not found
./adapt_liteos_config.sh: 32: effect_opt: not found
./adapt_liteos_config.sh: 33: effect_opt: not found
./adapt_liteos_config.sh: 34: effect_opt: not found
./adapt_liteos_config.sh: 35: effect_opt: not found
./adapt_liteos_config.sh: 36: effect_opt: not found
./adapt_liteos_config.sh: 37: effect_opt: not found
./adapt_liteos_config.sh: 38: effect_opt: not found
./adapt_liteos_config.sh: 39: effect_opt: not found
./adapt_liteos_config.sh: 40: effect_opt: not found
./adapt_liteos_config.sh: 41: effect_opt: not found
./adapt_liteos_config.sh: 42: effect_opt: not found
./adapt_liteos_config.sh: 43: effect_opt: not found
./adapt_liteos_config.sh: 44: effect_opt: not found
./adapt_liteos_config.sh: 45: effect_opt: not found
./adapt_liteos_config.sh: 46: effect_opt: not found
./adapt_liteos_config.sh: 48: cancel_opt: not found
./adapt_liteos_config.sh: 49: cancel_opt: not found
./adapt_liteos_config.sh: 50: cancel_opt: not found
./adapt_liteos_config.sh: 51: cancel_opt: not found
./adapt_liteos_config.sh: 52: cancel_opt: not found
./adapt_liteos_config.sh: 53: cancel_opt: not found
./adapt_liteos_config.sh: 54: cancel_opt: not found
./adapt_liteos_config.sh: 55: cancel_opt: not found
./adapt_liteos_config.sh: 56: cancel_opt: not found
……
libavdevice/alsa.c:31:10: fatal error: 'alsa/asoundlib.h' file not found
#include <alsa/asoundlib.h>
^~~~~~~~~~~~~~~~~~
libavdevice/alsa_dec.c:48:10: fatal error: 'alsa/asoundlib.h' file not found
#include <alsa/asoundlib.h>
^~~~~~~~~~~~~~~~~~
1 error generated.
In file included from libavdevice/alldevices.c:23:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:317:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:491:
In file included from ./libavutil/internal.h:42:
./libavutil/timer.h:37:11: fatal error: 'asm/unistd.h' file not found
# include <asm/unistd.h>
^~~~~~~~~~~~~~
libavdevice/android_camera.c:29:10: fatal error: 'camera/NdkCameraDevice.h' file not found
#include <camera/NdkCameraDevice.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** Error 1
make: *** Waiting for unfinished jobs....
In file included from libavdevice/bktr.c:27:
In file included from ./libavformat/internal.h:27:
In file included from ./libavformat/avformat.h:317:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:491:
In file included from ./libavutil/internal.h:42:
./libavutil/timer.h:37:11: fatal error: 'asm/unistd.h' file not found
# include <asm/unistd.h>
^~~~~~~~~~~~~~
1 error generated.
make: *** Error 1
make: *** Error 1
libavdevice/alsa_enc.c:40:10: fatal error: 'alsa/asoundlib.h' file not found
#include <alsa/asoundlib.h>
^~~~~~~~~~~~~~~~~~
In file included from libavdevice/decklink_dec_c.c:23:
In file included from ./libavformat/avformat.h:317:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:491:
In file included from ./libavutil/internal.h:42:
./libavutil/timer.h:37:11: fatal error: 'asm/unistd.h' file not found
# include <asm/unistd.h>
^~~~~~~~~~~~~~
1 error generated.
libavdevice/avfoundation.m:28:9: fatal error: 'AVFoundation/AVFoundation.h' file not found
#import <AVFoundation/AVFoundation.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** Error 1
1 error generated.
In file included from libavdevice/avdevice.c:19:
In file included from ./libavutil/avassert.h:31:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:491:
In file included from ./libavutil/internal.h:42:
./libavutil/timer.h:37:11: fatal error: 'asm/unistd.h' file not found
# include <asm/unistd.h>
^~~~~~~~~~~~~~
In file included from libavdevice/decklink_enc_c.c:22:
In file included from ./libavformat/avformat.h:317:
In file included from ./libavcodec/avcodec.h:31:
In file included from ./libavutil/samplefmt.h:24:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:491:
In file included from ./libavutil/internal.h:42:
./libavutil/timer.h:37:11: fatal error: 'asm/unistd.h' file not found
# include <asm/unistd.h>
^~~~~~~~~~~~~~
make: *** Error 1
1 error generated.
libavdevice/caca.c:21:10: fatal error: 'caca.h' file not found
#include <caca.h>
^~~~~~~~
1 error generated.
1 error generated.
1 error generated.
1 error generated.
make: *** Error 1
make: *** Error 1
make: *** Error 1
make: *** Error 1
make: *** Error 1
1 error generated.
make: *** Error 1
In file included from libavdevice/dshow_common.c:22:
In file included from libavdevice/dshow_capture.h:27:
In file included from libavdevice/avdevice.h:48:
In file included from ./libavutil/log.h:25:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:491:
In file included from ./libavutil/internal.h:42:
./libavutil/timer.h:37:11: fatal error: 'asm/unistd.h' file not found
# include <asm/unistd.h>
^~~~~~~~~~~~~~
In file included from libavdevice/dshow.c:22:
In file included from libavdevice/dshow_capture.h:27:
In file included from libavdevice/avdevice.h:48:
In file included from ./libavutil/log.h:25:
In file included from ./libavutil/avutil.h:296:
In file included from ./libavutil/common.h:491:
In file included from ./libavutil/internal.h:42:
./libavutil/timer.h:37:11: fatal error: 'asm/unistd.h' file not found
# include <asm/unistd.h>
^~~~~~~~~~~~~~
1 error generated.
make: *** Error 1
1 error generated.
make: *** Error 1
libavdevice/decklink_enc.cpp:31libavdevice/decklink_common.cpp:10::28 :fatal error10: :'DeckLinkAPI.h' file not found
fatal error: 'DeckLinkAPI.h' file not found
#include <DeckLinkAPI.h>
#include <DeckLinkAPI.h> ^~~~~~~~~~~~~~~
^~~~~~~~~~~~~~~
libavdevice/decklink_dec.cpp:33:10: fatal error: 'DeckLinkAPI.h' file not found
#include <DeckLinkAPI.h>
^~~~~~~~~~~~~~~
1 error generated.
1 error generated.
make: *** Error 1
make: *** Error 1
1 error generated.
make: *** Error 1
make: Leaving directory '/home/fan/HarmonyOS_Code/vendor/hisi/hi35xx/middleware/source/third_party/ffmpeg/ffmpeg-y'
make: *** Error 2
Traceback (most recent call last):
File "../../build/lite/build_ext_components.py", line 64, in <module>
sys.exit(main())
File "../../build/lite/build_ext_components.py", line 58, in main
cmd_exec(args.command)
File "../../build/lite/build_ext_components.py", line 32, in cmd_exec
raise Exception("{} failed, return code is {}".format(cmd, ret_code))
Exception: ['./build.sh', '/home/fan/HarmonyOS_Code/out/ipcamera_hi3518ev300', 'hi3518ev300', 'liteos_a', 'clang', '/home/fan/llvm/bin/..'] failed, return code is 2
后面用物理机ubuntu编译通过的了
http://bbs.sunsili.com/thread-225308-1-1.html
可能这里说的
在win10 的linux 子系统下,之前编译homanyOS一直编译不过,也是找不头文件。猜测,微软linux子系统和windows 本身的文件系统兼容性做的不好, 都没有中文路径,
页:
[1]