谷动谷力

 找回密码
 立即注册
查看: 1659|回复: 1
打印 上一主题 下一主题
收起左侧

开发Hi3518第一个示例程序Say Hello to HarmonyOS就出现问题了

[复制链接]
跳转到指定楼层
楼主
发表于 2021-8-7 23:41:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 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非常方便

  1. <p>#include <stdio.h>
  2. #include "los_sample.h"

  3. int main(int argc, char **argv)
  4. {
  5.     printf("\n************************************************\n");
  6.     printf("Hi I'm Lojam, Hello OHOS!\n\r");
  7.     printf("Copyright @Sunshine Silicon \n\r ");
  8.     printf("\n************************************************\n\n");

  9.     LOS_Sample(g_num); // 鸿蒙系统特有的我也不知道是什么意思, 应该定义打函数,这样定义有点不詹够方便,要关闭log时,每一个都要注释,同一个示例目录里 调用los_samle.c里的LOS_Sample函数

  10.     return 0;
  11. }</p><p>los_samle.c内容</p><p>#include <stdio.h></p><p>int g_num = 81;
  12. void LOS_Sample(int param)
  13. {
  14.     printf("This is a sample: Param = %d\n", param);
  15. }</p>
复制代码


看看这个目录的Makefile内容

  1. 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[1]: *** [ffbuild/common.mak:60: libavdevice/alsa.o] Error 1
make[1]: *** 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[1]: *** [ffbuild/common.mak:60: libavdevice/alldevices.o] Error 1
make[1]: *** [ffbuild/common.mak:60: libavdevice/alsa_dec.o] 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[1]: *** [ffbuild/common.mak:60: libavdevice/bktr.o] 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[1]: *** [ffbuild/common.mak:60: libavdevice/android_camera.o] 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[1]: *** [ffbuild/common.mak:60: libavdevice/decklink_dec_c.o] Error 1
make[1]: *** [ffbuild/common.mak:60: libavdevice/alsa_enc.o] Error 1
make[1]: *** [ffbuild/common.mak:60: libavdevice/avdevice.o] Error 1
make[1]: *** [ffbuild/common.mak:66: libavdevice/avfoundation.o] Error 1
make[1]: *** [ffbuild/common.mak:60: libavdevice/decklink_enc_c.o] Error 1
1 error generated.
make[1]: *** [ffbuild/common.mak:60: libavdevice/caca.o] 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[1]: *** [ffbuild/common.mak:60: libavdevice/dshow_common.o] Error 1
1 error generated.
make[1]: *** [ffbuild/common.mak:60: libavdevice/dshow.o] 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[1]: *** [ffbuild/common.mak:63: libavdevice/decklink_enc.o] Error 1
make[1]: *** [ffbuild/common.mak:63: libavdevice/decklink_common.o] Error 1
1 error generated.
make[1]: *** [ffbuild/common.mak:63: libavdevice/decklink_dec.o] Error 1
make[1]: Leaving directory '/home/fan/HarmonyOS_Code/vendor/hisi/hi35xx/middleware/source/third_party/ffmpeg/ffmpeg-y'
make: *** [Makefile:41: ffmpeg-y] 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


+10
回复

使用道具 举报

沙发
 楼主| 发表于 2021-8-7 23:44:13 | 只看该作者
后面用物理机ubuntu编译通过的了
http://bbs.sunsili.com/thread-225308-1-1.html
可能这里说的
在win10 的linux 子系统下,之前编译homanyOS一直编译不过,也是找不头文件。猜测,微软linux子系统和windows 本身的文件系统兼容性做的不好, 都没有中文路径,
+10
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|深圳市光明谷科技有限公司|光明谷商城|Sunshine Silicon Corpporation ( 粤ICP备14060730号|Sitemap

GMT+8, 2024-5-18 23:01 , Processed in 0.078034 second(s), 36 queries .

Powered by Discuz! X3.2 Licensed

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表