apple / HomeKitADK

Apache License 2.0
2.55k stars 232 forks source link

Unable to build for Raspi #41

Closed AustinRobinson closed 4 years ago

AustinRobinson commented 4 years ago

When I run make TARGET=Raspi all I get the following output:

Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM dev-test/raspiadk-base as build
 ---> 079fd7b4cb3b
Step 2/3 : WORKDIR /build
 ---> Using cache
 ---> fe6aec93152f
Step 3/3 : FROM build
 ---> fe6aec93152f
Successfully built fe6aec93152f
/bin/sh: 1: clang: not found
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c PAL/HAPPlatformSystemInit.c -o Output/Raspi-/Test/PAL/HAPPlatformSystemInit.o
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c Tests/HAPCryptoTest.c -o Output/Raspi-/Test/Tests/HAPCryptoTest.o
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c HAP/HAPBLEAccessoryServer.c -o Output/Raspi-/Test/HAP/HAPBLEAccessoryServer.o
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c HAP/HAPPairingPairVerify.c -o Output/Raspi-/Test/HAP/HAPPairingPairVerify.o
make: clang: Command not found
make: clang: Command not found
make: *** [Build/Makefile:108: Output/Raspi-/Test/PAL/HAPPlatformSystemInit.o] Error 127
make: *** Waiting for unfinished jobs....
make: *** [Build/Makefile:108: Output/Raspi-/Test/Tests/HAPCryptoTest.o] Error 127
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c HAP/HAPRequestHandlers+Pairing.c -o Output/Raspi-/Test/HAP/HAPRequestHandlers+Pairing.o
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c HAP/HAPBLETransaction.c -o Output/Raspi-/Test/HAP/HAPBLETransaction.o
make: clang: Command not found
make: clang: Command not found
make: *** [Build/Makefile:108: Output/Raspi-/Test/HAP/HAPBLEAccessoryServer.o] Error 127
make: *** [Build/Makefile:108: Output/Raspi-/Test/HAP/HAPPairingPairVerify.o] Error 127
make: clang: Command not found
make: clang: Command not found
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c HAP/HAPDeviceID.c -o Output/Raspi-/Test/HAP/HAPDeviceID.o
make: *** [Build/Makefile:108: Output/Raspi-/Test/HAP/HAPRequestHandlers+Pairing.o] Error 127
make: *** [Build/Makefile:108: Output/Raspi-/Test/HAP/HAPBLETransaction.o] Error 127
make: clang: Command not found
make: *** [Build/Makefile:108: Output/Raspi-/Test/HAP/HAPDeviceID.o] Error 127
clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1  -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1      -DHAP_TESTING -IPAL/Mock   -DHAP_Test -c HAP/HAPPDU.c -o Output/Raspi-/Test/HAP/HAPPDU.o
make: clang: Command not found
make: *** [Build/Makefile:108: Output/Raspi-/Test/HAP/HAPPDU.o] Error 127
make: *** [all] Error 2

But I have clang installed and it is in my path. Here is the output of clang --version

Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin19.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
hubertwang commented 4 years ago

Same error here

Sending build context to Docker daemon 2.048kB Step 1/3 : FROM dev-test/raspiadk-base as build ---> a607ec600c56 Step 2/3 : WORKDIR /build ---> Using cache ---> 89b8b8161649 Step 3/3 : FROM build ---> 89b8b8161649 Successfully built 89b8b8161649 /bin/sh: 1: clang: not found clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1 -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1 -DHAP_TESTING -IPAL/Mock -DHAP_Test -c PAL/HAPPlatformSystemInit.c -o Output/Raspi-/Test/PAL/HAPPlatformSystemInit.o clang -Wall -Werror -DHAP_ENABLE_DEVELOPMENT_ONLY_CODE=1 -ffunction-sections -fdata-sections -DLED_PORT=\"/sys/class/leds/led0/brightness\" -DLED_TRIGGER=\"/sys/class/leds/led0/trigger\" -DRPI -I/opt/vc/include -IHAP -IExternal/HTTP -IExternal/JSON -IExternal/Base64 -IPAL -I/include -O0 -g -DHAP_LOG_LEVEL=1 -DHAP_TESTING -IPAL/Mock -DHAP_Test -c Tests/HAPCryptoTest.c -o Output/Raspi-/Test/Tests/HAPCryptoTest.o make: clang: Command not found make: [Build/Makefile:108: Output/Raspi-/Test/PAL/HAPPlatformSystemInit.o] Error 127 make: Waiting for unfinished jobs.... make: clang: Command not found make: [Build/Makefile:108: Output/Raspi-/Test/Tests/HAPCryptoTest.o] Error 127 make: [all] Error 2

Apple clang version 11.0.0 (clang-1100.0.33.16) Target: x86_64-apple-darwin19.2.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

ghost commented 4 years ago

@hubertwang, could you please try this?

docker run -ti dev-test/raspiadk-base /bin/bash clang --version

seems that clang is not seen in your docker container.

hubertwang commented 4 years ago

clang --version

Hi @hao-gao ,

Here is the result: HomeKitADK % docker run -ti dev-test/raspiadk-base /bin/bash root@33b97ea16514:/# clang --version bash: clang: command not found

You are right, seems clang is not in my docker container. Not sure if I missed some step during configuration.

Should we install clang manually and run again?

ghost commented 4 years ago

I am not sure if all dependencies are correctly installed with the raspi_setup_sdcard.sh. Dependencies are here: https://github.com/apple/HomeKitADK/blob/master/Tools/raspi_sdcard_setup.sh#L606

hubertwang commented 4 years ago

@hao-gao Oh.....I remember the last message I receive is "Volume failed to eject" Maybe this cause the script to interrupt. (seems block by antivirus) I'll try if diskutil unmountDisk "force" can fix the issue

hubertwang commented 4 years ago

Hmm..unmount has force option, but eject don't Still stuck on the same position

ghost commented 4 years ago

Before importing sd card's rootfs as a docker image, make sure you followed this instruction of you console output: [the code] Ensure SD card is inserted and power cycle Raspi. If this is the first boot after FS expansion, wait 60 seconds then power cycle Raspi a second time.

Hope this helps.

AustinRobinson commented 4 years ago

I was able to get this working. I think the dependencies didn't install correctly the first few times I tried it.

hubertwang commented 4 years ago

Ah, forgot to say, I was able to get it work, too. It's my environment issue, anti virus blocked some instruction. After I changed to another mac everything works.

Thank you for the detailed instruction @hao-gao