InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

Failed to build InfiniTime on Docker Container under Windows 10

Open A4EVA opened this issue 3 years ago • 12 comments

Verification

  • [X] I searched for similar bug reports and found none was relevant.

What happened?

Docker container do not build the firmware under Windows 10

What should happen instead?

The Build process should have been completed

Reproduction steps

Just clone and initialize the repository, after that pull the docker image with docker pull infinitime/infinitime-build considering that we are under Windows to avoid problems instead of using docker run --rm -it -v $(pwd):/sources infinitime/infinitime-build use docker run --rm -it -v C:\...FULL-PATH\Projects\InfiniTime:/sources infinitime/infinitime-build the process will start but once reached 36 % of the build this error will come up :

`[ 36%] Linking C static library libnimble.a [ 36%] Built target nimble gmake: *** [Makefile:91: all] Error 2

  • return 1
  • BUILD_RESULT=1
  • '[' '' '!=' true -a 1 == 0 ']'`

once inside the container with: docker run --rm -it -v C:\...FULL-PATH\Projects\InfiniTime:/sources infinitime/infinitime-build bin/bash I have launched the build process manually with make and a bit more exact error can now be seen:

`[ 36%] Generating jetbrains_mono_bold_20.c (Stripping trailing CRs from patch; use --binary to disable.) patching file jetbrains_mono_bold_20.c patching file jetbrains_mono_bold_20.c patch: **** malformed patch at line 3:

Traceback (most recent call last): File "/sources/src/displayapp/fonts/generate.py", line 75, in main() File "/sources/src/displayapp/fonts/generate.py", line 70, in main subprocess.check_call(['/usr/bin/env', 'patch', name+'.c', patch]) File "/usr/lib/python3.10/subprocess.py", line 369, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/usr/bin/env', 'patch', 'jetbrains_mono_bold_20.c', 'jetbrains_mono_bold_20.c_M.patch']' returned non-zero exit status 2. make[2]: *** [src/displayapp/fonts/CMakeFiles/infinitime_fonts_jetbrains_mono_bold_20.dir/build.make:73: src/displayapp/fonts/jetbrains_mono_bold_20.c] Error 1 make[2]: *** Deleting file 'src/displayapp/fonts/jetbrains_mono_bold_20.c' make[1]: *** [CMakeFiles/Makefile2:590: src/displayapp/fonts/CMakeFiles/infinitime_fonts_jetbrains_mono_bold_20.dir/all] Error 2 make: *** [Makefile:91: all] Error 2`

I have tested on two different Windows 10 machines and the error is exactly the same. I have not understood what I did wrong

More details?

No response

Version

eb487c7

Companion app

No response

A4EVA avatar Aug 11 '22 18:08 A4EVA

i answered on this issue some time ago on pine forum here

basically, it's an EOLs issue...

try to change EOLs (e.g. with Notepad++) from Win to Linux format for: \InfiniTime\src\displayapp\fonts\jetbrains_mono_bold_20.c_M.patch \InfiniTime\src\displayapp\fonts\jetbrains_mono_bold_20.c_zero.patch

ITCactus avatar Aug 11 '22 22:08 ITCactus

Thanks a lot, Everything worked nicely. I would like to use this container to build the code with Visual studio Code it is possible to do that ? I never used VS Code with a container so I have no idea :-)

A4EVA avatar Aug 12 '22 10:08 A4EVA

sure, it works with docker container. there is a doc "Build and Develop the project using VS Code".

basically, you just need to open the project (folder) with the source code in VS Code, and it will propose to install Extensions for C/C++, and also for docker. after that (or after reopen the project) it will find the .devcontainer folder and propose to open the project in devcontainer. later, just use that option ("InfiniTime [Dev Container]"), and you good to build the code after some project configuration.

just do not forget about EOLs - there are some to change... see this comment for #1056 if you need to build DFUs.

ITCactus avatar Aug 12 '22 11:08 ITCactus

Ok If I reopen the project with the container as VSCode suggest it will pull another image (vsc-infinitime) and is not the one I tried (the latest infinitime-build) I also do not know what is project configuration you mentioned. I tried to build the project once VSCode finished with the docker configuration and this error pops up: Could not find LV_FONT_CONV using the following names: lv_font_conv maybe is caused by the missing LV_FONT_CONV in the docker image that VSCode downloaded by itself.

A4EVA avatar Aug 12 '22 12:08 A4EVA

and is not the one I tried (the latest infinitime-build)

i used the one suggested by VS Code... basically, it described in the "devcontainer" folder.

what is project configuration you mentioned

anything preventing to make a build... select build variant (e.g. "Release OpenOCD Build DFU"), and "active kit" (e.g. "GCC 11.2.0 x86_64-linux-gnu")

this error pops up: Could not find LV_FONT_CONV using the following names: lv_font_conv

you have to install "lv_font_conv" dependency manually (and probably "npm" first), as described here. not sure why those are not included into devcontainer.

ITCactus avatar Aug 12 '22 13:08 ITCactus

The devcontainer is quite outdated, no-one has gotten around to finishing updating it yet.

FintasticMan avatar Aug 12 '22 14:08 FintasticMan

@ITCactus I installed npm and then lv_font_conv but the cmake output still say that lv_font_conv is missing. Do I need to do something else after the manual installation of lv_font_conv ?

A4EVA avatar Aug 12 '22 16:08 A4EVA

i suppose you installed those into container. not sure what else... try reopen container, or/and reconfigure cmake project...

ITCactus avatar Aug 12 '22 17:08 ITCactus

Ok, found the problem I almost finished to setup everything on the old docker container. I have one last problem to figure out at the end of the build (100%) this error pops up

[build] /opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: CMakeFiles/pinetime-mcuboot-app.dir/displayapp/screens/StopWatch.cpp.o: in function Pinetime::Applications::Screens::StopWatch::stopLapBtnEventHandler(unsigned char)': [build] /workspaces/InfiniTime/src/displayapp/screens/StopWatch.cpp:156: undefined reference to Pinetime::Applications::Screens::StopWatch::maxLapCount' [build] collect2: error: ld returned 1 exit status [build] gmake[3]: *** [src/CMakeFiles/pinetime-mcuboot-app.dir/build.make:1863: src/pinetime-mcuboot-app-1.10.0.out] Error 1 [build] gmake[2]: *** [CMakeFiles/Makefile2:310: src/CMakeFiles/pinetime-mcuboot-app.dir/all] Error 2 [build] gmake[1]: *** [CMakeFiles/Makefile2:317: src/CMakeFiles/pinetime-mcuboot-app.dir/rule] Error 2 [build] gmake: *** [Makefile:202: pinetime-mcuboot-app] Error 2 [build] Build finished with exit code 2

I never encountered problems with this piece of source by the way all the EOLs has been corrected in both mcuboot and the fonts patches @ITCactus mentioned before

A4EVA avatar Aug 12 '22 17:08 A4EVA

sorry, not sure what is about. last time i built InfiniTime with code base 1.10 (i mean when it was released)

update: tried the latest code from DEV (from Aug 10), and except the new "date" submodule (that should be resolved by "git submodule update --init --recursive") no other issues.

ITCactus avatar Aug 12 '22 17:08 ITCactus

Hi, I'm also trying to build on Window 10. I've fixed the issues as mentioned earlier for font patch files.

Now I get this error:

post build steps for pinetime-mcuboot-recovery-1.10.0
   text    data     bss     dec     hex filename
 184372     504   34436  219312   358b0 pinetime-mcuboot-recovery-1.10.0.out
/usr/bin/env: ‘python3\r’: No such file or directory
gmake[2]: *** [src/CMakeFiles/pinetime-mcuboot-recovery.dir/build.make:1035: src/pinetime-mcuboot-recovery-1.10.0.out] Error 127

because of "\r" in error (see in end of python3), I think it is another issue of end-of-line. can anyone suggest which file to look for ? I've used latest code (30/Aug) of branch "develop". 10x.

iksi4prs avatar Aug 29 '22 21:08 iksi4prs

Ive managed to fix it by also fixing py files, as described in https://github.com/InfiniTimeOrg/InfiniTime/issues/1056#issuecomment-1080476567

In any reason why both fixes in font files and py files are not fixed/committed in code ?

iksi4prs avatar Aug 30 '22 14:08 iksi4prs

Use of the container on Windows is not officially supported and if someone wishes they can contribute documentation on how to get it working. I see no reason to keep this issue open for that.

Avamander avatar Oct 04 '22 09:10 Avamander