|
【HarmonyOS HiSpark IPC試用】開發(fā)Hi3518第一個示例程序Say Hello to HarmonyOS, <span]
<span]
<span]開發(fā)者需要在Linux服務(wù)器上下載并解壓一套源代碼,獲取Hi3518源碼(下載鏈接https://gitee.com/openharmony/docs/blob/master/get-code/%E6%BA%90%E7%A0%81%E8%8E%B7%E5%8F%96.md)。更多源碼獲取方式,請見源碼獲取。 <span]下載是用windows10, 放在e盤 <span]cd ~ <span]解壓源碼 <span]
<span]
<span]
<span]vscode 安裝wsl:ubuntu插件可以打開 wsl:ubuntu文件, 這點用win10非常方便 <span]#include “l(fā)os_sample.h“ <span]int main(int argc, char **argv) <span] 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); // 鴻蒙系統(tǒng)特有的我也不知道是什么意思, 同一個示例目錄里 調(diào)用los_samle.c里的LOS_Sample函數(shù) return 0; }
los_samle.c內(nèi)容
#include <stdio.h>
int g_num = 81; void LOS_Sample(int param) { printf(“This is a sample: Param = %d\n“, param); }
看看這個目錄的Makefile內(nèi)容 STAtiC_COMPILE = n
BIN = helloworld BIN_ASM = $(BIN).asm OBJEXT = .o
CC = ${LITEOS_COMPILER_PATH}/bin/$(CROSS_COMPILE)gcc //這里用的是交叉編譯工具gcc,而非是官方python腳本用的是clang, 直接make出錯 CPP = ${LITEOS_COMPILER_PATH}/bin/$(CROSS_COMPILE)g++ LD = ${LITEOS_COMPILER_PATH}/bin/$(CROSS_COMPILE)ld OBJDUMP = ${LITEOS_COMPILER_PATH}/bin/$(CROSS_COMPILE)objdump
COMMON_INCLUDE = -I $(APP_DIR)/include/ COMMON_FLAGS = -fPIE -D_XOPEN_SOURCE=700
CFLAGS += -fno-omit-frame-pointer -std=c99 $(COMMON_INCLUDE) $(COMMON_FLAGS) CXXFLAGS += $(COMMON_INCLUDE) $(COMMON_FLAGS)
ifeq ($(STATIC_COMPILE), y) LDFLAGS = --static else LDFLAGS = -pie endif
CCSRCS := $(wildcard *.c) CCOBJS = $(CCSRCS:.c=$(OBJEXT)) CXXSRCS := $(wildcard *.cpp) CXXOBJS = $(CXXSRCS:.cpp=$(OBJEXT))
MUSL = musl/lib/libc.so
all: $(MUSL) $(BIN) $(BIN_ASM)
$(CCOBJS): %$(OBJEXT): %.c @echo “CC: $<“ $(Q) $(CC) -c $(CFLAGS) $< -o $@
$(CXXOBJS): %$(OBJEXT): %.cpp @echo “CPP: $<“ $(Q) $(CPP) -c $(CXXFLAGS) $< -o $@
$(BIN_ASM): $(BIN) $(Q) rm -RF $(CCOBJS) $(CXXOBJS) $(Q) $(OBJDUMP) -d $(BIN) > $(BIN_ASM)
$(MUSL): $(Q) rm -rf musl/ $(Q) ./build_musl.sh &> build_musl.log
$(BIN): $(MUSL) $(CCOBJS) $(CXXOBJS) ifeq ($(STATIC_COMPILE), y) @echo “LD: $^“ $(Q) $(CC) $(LDFLAGS) -o $@ $^ else @echo “LD: $^“ $(Q)mkdir -p $(APP_DIR)/lib/ $(Q)cp -f $(APP_DIR)/src/musl/lib/libc.so $(APP_DIR)/lib/libc.so $(Q)$(CC) $(LDFLAGS) -o $@ $(CCOBJS) $(CXXOBJS) endif
clean: $(Q) rm -rf $(CCOBJS) $(CXXOBJS) $(BIN) $(BIN_ASM) $(Q) rm -rf musl/ $(Q) rm -rf build_musl.log
install: $(Q) mkdir -p $(FSIMG_DIR) $(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
編譯 之前Linux開發(fā)uboot、內(nèi)核、文件系統(tǒng)、應(yīng)用是分開編譯的,一般只編譯一次燒錄,應(yīng)用直接make編譯出來copy到硬件環(huán)境里就可以了 這里是所有的uboot、內(nèi)核、文件系統(tǒng)、應(yīng)用一起編譯初次使用還有,后面老全部編譯就很麻煩了,編譯時間長,希望可以應(yīng)用直接編譯,然后copy到板子里,后面寫應(yīng)用或驅(qū)動就方便多了 python build.py ipcamera_hi3518ev300 -b debug
編譯出錯了,把編譯日志放出來,希望能有大神幫助解決, 我找問題解決了再更新了…………OMG………………
……沒有找到./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
…… 1大票頭文件沒有, gitee下載的源碼有問題……OMG…………
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\“, \“l(fā)iteos_a\“, \“clang\“, \“/home/fan/llvm/bin/..\“] failed, return code is 2 |
|