STMicroelectronics / gnu-tools-for-stm32

Other
21 stars 2 forks source link

Compilation attempt #3

Open mateuszdrewniak opened 5 months ago

mateuszdrewniak commented 5 months ago

Hi, I'm trying to compile gnu-tools-for-stm32 (arm 7-2018-q2-update) and get the binary that comes with STM32CubeIDE (1.5.1)

com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.5.0.202011040924\tools - original_cube_IDE\bin>arm-none-eabi-gcc -v

...
gcc version 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907] (GNU Tools for STM32 7-2018-q2-update.20190328-1800)

I compile with success the package from the arm website from sources https://developer.arm.com/downloads/-/gnu-rm/7-2018-q2-update

\gcc-arm-none-eabi-7-2018-q2-update-win32\bin>arm-none-eabi-gcc -v

...
gcc version 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907] (GNU Tools for Arm Embedded Processors 7-2018-q2-update)

But STM32 introduced paches and there is a difference so it tries to compile this official repository.

I have two problems:

  1. When executing the built-prerequistes.sh script line:
    +2024-06-16:06:51:39 (./build-prerequisites.sh:237): main(): python3.6 /home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7-2018-q2-update.20230911-0830/src/liblongpath-win32/helper.py --generate /home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7-2018-q2-update.20230911-0830/build-mingw/liblongpath-win32 --triplet x86_64-w64-mingw32
    In file included from /usr/share/mingw-w64/include/windows.h:95:0,
                 from /home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7-2018-q2-update.20230911-0830/src/liblongpath-win32/src/open-win32.c:37:
    /usr/share/mingw-w64/include/wincrypt.h:5435:19: fatal error: dpapi.h: No such file or directory
    #include <dpapi.h>
               ^

    compilation terminated.

  1. Anyway, I wanted to run build-toolchain.sh and check if I could get linux packages. It seems that the execution of the build_toolchain.sh script ends with an error where I expected, I receive packets with pkg folder. -gnu-tools-for-stm32-7-2018-q2-update~-linux -gnu-tools-for-stm32-7-2018-q2-update~-linux-build -gnu-tools-for-stm32-7-2018-q2-update~-linux-install and (I think) when creating a package for win32, the script ends with an error:
x86_64-w64-mingw32-gcc -c -DHAVE_CONFIG_H -DCROSS_COMPILING -I/home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7-2018-q2-update.20230911-0830/build-mingw/host-libs/ zlib/include -I/home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7-2018-q2-update.20230911-0830/build-mingw/host-libs/usr/include -I. -I/home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7-2018-q2-update.20230911-0830/src/binutils/readline -DRL_LIBRARY_VERSION='"6.2"' -I/home/mdrewniak/toolchain_stm32 /gnu-tools-for-stm32-7-2018-q2-update.20230911-0830/build-mingw/host-libs/zlib/include -I/home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7 -2018-q2-update.20230911-0830/build-mingw/host-libs/usr/include -O2 -D__USE_MINGW_ACCESS /home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7-2018-q2-update.20230911 -0830/src/binutils/readline/histfile.c
rm -f histsearch.o
x86_64-w64-mingw32-gcc -c -DHAVE_CONFIG_H -DCROSS_COMPILING -I/home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7-2018-q2-update.20230911-0830/build-mingw/host-libs/ zlib/include -I/home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7-2018-q2-update.20230911-0830/build-mingw/host-libs/usr/include -I. -I/home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7-2018-q2-update.20230911-0830/src/binutils/readline -DRL_LIBRARY_VERSION='"6.2"' -I/home/mdrewniak/toolchain_stm32 /gnu-tools-for-stm32-7-2018-q2-update.20230911-0830/build-mingw/host-libs/zlib/include -I/home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7 -2018-q2-update.20230911-0830/build-mingw/host-libs/usr/include -O2 -D__USE_MINGW_ACCESS /home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7-2018-q2-update.20230911 -0830/src/binutils/readline/histsearch.c
In file included from /usr/share/mingw-w64/include/windows.h:95:0,
 from /home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7-2018-q2-update.20230911-0830/src/binutils/readline/terminal.c:74:
/usr/share/mingw-w64/include/wincrypt.h:5435:19: fatal error: dpapi.h: No such file or directory
 #include <dpapi.h>
 ^
compilation terminated.
In file included from /usr/share/mingw-w64/include/windows.h:95:0,
 from /home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7-2018-q2-update.20230911-0830/src/binutils/readline/kill.c:661:
/usr/share/mingw-w64/include/wincrypt.h:5435:19: fatal error: dpapi.h: No such file or directory
 #include <dpapi.h>
 ^
compilation terminated.
...
...
config.status: creating Makefile
config.status: creating testsuite/Makefile
config.status: creating config.h
config.status: executing default commands
make[1]: Leaving directory `/home/mdrewniak/toolchain_stm32/gnu-tools-for-stm32-7-2018-q2-update.20230911-0830/build-mingw/binutils'
make: *** [all] Error 2

Could anyone give any hints, or maybe @stmicroelectronics-github will write what versions of x86_64-w64-mingw32 I should use.

Thanks

My environment: Ubuntu 14/04/5 x86_64-w64-mingw32-gcc (GCC) 4.8.2 x86_64-w64-mingw32-g++ (GCC) 4.8.2 GNU ld (GNU Binutils) 2.23.52.20130620

mateuszdrewniak commented 5 months ago

small update: For Ubuntu 18.04.6 LTS x86_64-w64-mingw32-gcc (GCC) 7.3-win32 20180312 x86_64-w64-mingw32-g++ (GCC) 7.3-win32 20180312

script build-prerequisites.sh: completes successfully without any problems build-toolchain.sh: also stops when building mingw package

checking whether declaration is required for strstr... no
checking for utimes... no
checking for open... /home/mdrewniak/toolchain/gnu-tools-for-stm32-7-2018-q2-update.20230911-0830/src/binutils/libiberty/pex-win32.c:46:10: fatal error: stmicroelectronics/longpath.h: No such file or directory
#include <stmicroelectronics/longpath.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
BruzzeseAgustin commented 4 months ago

Hi, could you share the dockerfile (if it can be with ubuntu better) for the installation of stm32? i have tried but without success. Thank you very much

dbeef commented 5 days ago

@mateuszdrewniak if this is still relevant, here's my Dockerfile: https://github.com/dbeef/gnu-tools-for-stm32-docker