Closed creecedev closed 1 year ago
This appears to be related to M1 Macbooks. I found a stackoverflow that discusses the issue:
The solution was to add --platform=linux/x86_64 to the FROM line of the Dockerfile so that it is not trying to use an ARM based image:
FROM --platform=linux/x86_64 mcr.microsoft.com/devcontainers/base:ubuntu
I'm now able to start compiling but it fails on linking:
[ 86%] Linking C executable HDZGOGGLE arm-openwrt-linux-muslgnueabi-gcc.bin: warning: environment variable 'STAGING_DIR' not defined arm-openwrt-linux-muslgnueabi-gcc.bin: warning: environment variable 'STAGING_DIR' not defined HDZGOGGLE : section size addr .interp 24 65780 .hash 1280 65804 .dynsym 2992 67084 .dynstr 3189 70076 .gnu.version 374 73266 .gnu.version_r 32 73640 .rel.plt 1392 73672 .init 12 75064 .plt 2108 75076 .text 854644 77184 .fini 12 931828 .rodata 2404176 931840 .eh_frame 4 3336016 .init_array 4 3401556 .fini_array 4 3401560 .dynamic 504 3401564 .got 708 3402068 .data 2000 3402776 .bss 169490712 3404776 .comment 52 0 .ARM.attributes 53 0 .debug_aranges 3064 0 .debug_info 486543 0 .debug_abbrev 29196 0 .debug_line 136627 0 .debug_frame 9040 0 .debug_str 26269 0 .debug_loc 87616 0 .debug_ranges 15552 0 Total 173558183
this is not a partition key
gpt_head->header_crc32 = 0x8a8a2654
GPT----part num 7---
gpt_entry: 128
gpt_header: 92
GPT:boot : 20 199f
GPT:rootfs : 19a0 769f
GPT:overlay : 76a0 7a9f
GPT:env : 7aa0 7b9f
GPT:bootlogo : 7ba0 7d9f
GPT:app : 7da0 dd9f
GPT:UDISK : dda0 ddaf
update gpt file ok
update mbr file ok
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
no app resource partitions
/workspaces/hdzero-goggle/mkapp
awk: cannot open /workspaces/hdzero-goggle/mkapp/image/app.ver (No such file or directory)
/workspaces/hdzero-goggle/mkapp/image/app.fex not exsit!
make fail
ls: cannot access 'ota_app/hdzgoggle_app_ota-.tar': No such file or directory cp: missing file operand Try 'cp --help' for more information. HDZGOGGLE_RX-68.bin HDZGOGGLE_VA-127.bin mv: target 'make_fw.68.127.bin' is not a directory rm: missing operand Try 'rm --help' for more information. generate HDZERO_GOGGLE-app bin hal image make_fw.68.127.bin mv: cannot stat '/workspaces/hdzero-goggle/mkapp/HDZERO_GOGGLE-.bin': No such file or directory make[2]: [CMakeFiles/HDZGOGGLE.dir/build.make:2024: HDZGOGGLE] Error 1 make[2]: Deleting file 'HDZGOGGLE' make[1]: [CMakeFiles/Makefile2:175: CMakeFiles/HDZGOGGLE.dir/all] Error 2 make: [Makefile:91: all] Error 2
appears to me that linking itself succeeds, but something fails during packaging.
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
seems the place where it fails.
i dont see any usage of qemu in the build script. is that part of the M1 emulation somehow?
Yes, it appears its something to do with M1. I'm just going to go back to Windows and develop there as I have no idea how to get this one resolved. The APP_PART_DOWNLOAD_FILE is what the M1 process appears to be seg faulting on. Just seems like a rabbit hole that is not worth it at this point.
update gpt file ok
update mbr file ok
_
turns out a lot of the problematic process was redundant. could you try https://github.com/hd-zero/hdzero-goggle/pull/111 and see if it now builds on M1?
turns out a lot of the problematic process was redundant. could you try #111 and see if it now builds on M1?
Not sure when it was fixed but works fine for me in an x86 container on M1, it's just really slow since it's emulated. I tried getting an arm native toolchain to work and actually managed to get the build working in an arm64 virtualized container by using the arm gnu toolchain and kinda smashing it together with the x86 one. It builds a lot faster but I'd be surprised if it actually runs, if anyone feels like trying it, I take no responsibility. ^^ https://github.com/Nikolas-S/hdzero-goggle/tree/feature/arm64_host_build_support
then let's close this one....toolchain "smashing" feels kinda dangerous to me. if we were to implement a aarch64 native toolchain, we should probably just bake one ourselfs.
When starting the remote dev container, the setup.sh runs and after the media is extracted, there's a CMake error that a simple test program cannot be compiled. The same process of cloning into the container and building on my Windows machine had no issues.
I am new to Docker in general but i'm doing the same thing on both systems and getting different results.
C++/CMake/CMake Tools are installed as extensions within the dev container.
[variant] Loaded new set of variants [proc] Executing command: /usr/bin/aarch64-linux-gnu-gcc -v [proc] Executing command: /usr/bin/aarch64-linux-gnu-gcc-11 -v [proc] Executing command: /usr/bin/c89-gcc -v [proc] Executing command: /usr/bin/c99-gcc -v [proc] Executing command: /usr/bin/gcc -v [proc] Executing command: /usr/bin/gcc-11 -v [proc] Executing command: /bin/aarch64-linux-gnu-gcc -v [proc] Executing command: /bin/aarch64-linux-gnu-gcc-11 -v [proc] Executing command: /bin/c89-gcc -v [proc] Executing command: /bin/c99-gcc -v [proc] Executing command: /bin/gcc -v [proc] Executing command: /bin/gcc-11 -v [proc] Executing command: /bin/c99-gcc -v [proc] Executing command: /bin/c89-gcc -v [proc] Executing command: /usr/bin/c99-gcc -v [proc] Executing command: /usr/bin/c89-gcc -v [kit] Found Kit: GCC 11.3.0 aarch64-linux-gnu [kit] Found Kit: GCC 11.3.0 aarch64-linux-gnu [kit] Found Kit: GCC 11.3.0 aarch64-linux-gnu [kit] Found Kit: GCC 11.3.0 aarch64-linux-gnu [kit] Found Kit: GCC 11.3.0 aarch64-linux-gnu [kit] Found Kit: GCC 11.3.0 aarch64-linux-gnu [kit] Found Kit: GCC 11.3.0 aarch64-linux-gnu [kit] Found Kit: GCC 11.3.0 aarch64-linux-gnu [kit] Found Kit: GCC 11.3.0 aarch64-linux-gnu [kit] Found Kit: GCC 11.3.0 aarch64-linux-gnu [kit] Found Kit: GCC 11.3.0 aarch64-linux-gnu [kit] Found Kit: GCC 11.3.0 aarch64-linux-gnu [proc] Executing command: /usr/bin/aarch64-linux-gnu-gcc -v [cmakefileapi-driver] Removing /workspaces/hdzero-goggle/build/CMakeCache.txt [main] Configuring folder: hdzero-goggle [proc] Executing command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_TOOLCHAIN_FILE=/workspaces/hdzero-goggle/toolchain.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/aarch64-linux-gnu-g++ -S/workspaces/hdzero-goggle -B/workspaces/hdzero-goggle/build -G Ninja [cmake] Not searching for unused variables given on the command line. [cmake] -- The C compiler identification is unknown [cmake] -- The CXX compiler identification is unknown [cmake] -- Detecting C compiler ABI info [cmake] -- Detecting C compiler ABI info - failed [cmake] -- Check for working C compiler: /workspaces/hdzero-goggle/toolchain/bin/arm-openwrt-linux-muslgnueabi-gcc [cmake] -- Check for working C compiler: /workspaces/hdzero-goggle/toolchain/bin/arm-openwrt-linux-muslgnueabi-gcc - broken [cmake] -- Configuring incomplete, errors occurred! [cmake] See also "/workspaces/hdzero-goggle/build/CMakeFiles/CMakeOutput.log". [cmake] See also "/workspaces/hdzero-goggle/build/CMakeFiles/CMakeError.log". [cmake] CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message): [cmake] The C compiler [cmake] [cmake] "/workspaces/hdzero-goggle/toolchain/bin/arm-openwrt-linux-muslgnueabi-gcc" [cmake] [cmake] is not able to compile a simple test program. [cmake] [cmake] It fails with the following output: [cmake] [cmake] Change Dir: /workspaces/hdzero-goggle/build/CMakeFiles/CMakeTmp [cmake]
[cmake] Run Build Command(s):/usr/bin/ninja cmTC_d1209 && [1/2] Building C object CMakeFiles/cmTC_d1209.dir/testCCompiler.c.o [cmake] FAILED: CMakeFiles/cmTC_d1209.dir/testCCompiler.c.o [cmake] /workspaces/hdzero-goggle/toolchain/bin/arm-openwrt-linux-muslgnueabi-gcc -Wall -o CMakeFiles/cmTC_d1209.dir/testCCompiler.c.o -c /workspaces/hdzero-goggle/build/CMakeFiles/CMakeTmp/testCCompiler.c [cmake] qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory [cmake] ninja: build stopped: subcommand failed. [cmake]
[cmake]
[cmake] [cmake]
[cmake] [cmake] CMake will not be able to correctly generate this project. [cmake] Call Stack (most recent call first): [cmake] CMakeLists.txt:3 (project) [cmake] [cmake] [proc] The command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_TOOLCHAIN_FILE=/workspaces/hdzero-goggle/toolchain.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/aarch64-linux-gnu-g++ -S/workspaces/hdzero-goggle -B/workspaces/hdzero-goggle/build -G Ninja exited with code: 1 and signal: null