ARMmbed

Problem with Makefile

Greetings.

I’m finding issues with your Makefile, issues which i never had before.
When i try to compile your library, make immediately terminates and gives me this error message:

process_begin: CreateProcess(NULL, C:\Program Files (x86)\GnuWin32 -C library, …) failed.
make (e=2): The system cannot find the file specified.
Makefile:18: recipe for target ‘lib’ failed
mingw32-make: *** [lib] Error 2

So, i checked your Makefile and the line number 18 is:
lib:
$(MAKE) -C library

Now, i’ve never written a Makefile, but your library needs for my project…do i have to imagine you aren’t able to write a Makefile? Or, as obvious, does there exist a simple solution?

I also noticed that, in some your libraries, you use the preprocessor instruction: #pragma comment…which is really a brilliant idea mostly when someone uses gcc to compile that, as you know (do you know it?), doesn’t support and simply ignore that command.

So, can you help me or do i have to re-write half of my project code by using another library (like OpenSSL or WolfSSL), wasting a lot of time?

A fast response would be appreciated.
Regards gentlemen.

Hi @Argex
Thank you for your kind words.
The issue you are encountering is a mingw-make issue, and not an issue in our Makefile.

As you must have seen in this article, the way to build with mingw32-make is as following:

set WINDOWS=1
mingw32-make CC=gcc

Regards,
Mbed TLS Team member
Ron

Greetings.
Thanks for the fast response.

I attemped with the way you suggested me but the error still occurs…

I was able to start make but i received this other error:

Hi @Argex
This issue is tracked in https://github.com/ARMmbed/mbedtls/issues/2087
You should update your mingw version to mingw64
Regards,
Ron

I still need you assistance. Now make compiles everything until it has arrived to net_sockets.c.
Then, it gives me this error:

…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x17): undefined reference to _imp__WSAStartup@8' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0xc0): undefined reference to_imp__getaddrinfo@16’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0xdd): undefined reference to _imp__socket@12' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0xe3): undefined reference to_imp__connect@12’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x111): undefined reference to _imp__closesocket@4' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x15c): undefined reference to_imp__freeaddrinfo@4’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x22f): undefined reference to _imp__getaddrinfo@16' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x24c): undefined reference to_imp__socket@12’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x2a0): undefined reference to _imp__setsockopt@20' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x2c4): undefined reference to_imp__bind@12’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x2ed): undefined reference to _imp__listen@8' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x309): undefined reference to_imp__freeaddrinfo@4’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x339): undefined reference to _imp__closesocket@4' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x35d): undefined reference to_imp__WSAStartup@8’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x387): undefined reference to _imp__closesocket@4' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x39c): undefined reference to_imp__closesocket@4’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x418): undefined reference to _imp__getsockopt@20' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x47c): undefined reference to_imp__recvfrom@24’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x51b): undefined reference to _imp__connect@12' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x555): undefined reference to_imp__accept@12’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x56f): undefined reference to _imp__WSAGetLastError@0' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x5b2): undefined reference to_imp__getsockname@12’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x5de): undefined reference to _imp__socket@12' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x614): undefined reference to_imp__setsockopt@20’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x632): undefined reference to _imp__bind@12' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x686): undefined reference to_imp__WSAGetLastError@0’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x6d6): undefined reference to _imp__ioctlsocket@12' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x716): undefined reference to_imp__ioctlsocket@12’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x7ee): undefined reference to _imp__select@20' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x80e): undefined reference to__WSAFDIsSet@8’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x822): undefined reference to __WSAFDIsSet@8' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x8db): undefined reference to_imp__recv@16’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x8f2): undefined reference to _imp__WSAGetLastError@0' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x9b2): undefined reference to_imp__select@20’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0x9f2): undefined reference to _imp__WSAGetLastError@0' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0xa4b): undefined reference to_imp__send@16’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0xa62): undefined reference to _imp__WSAGetLastError@0' ../library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0xabc): undefined reference to_imp__shutdown@8’
…/library/libmbedtls.a(net_sockets.o):net_sockets.c:(.text+0xaca): undefined reference to `_imp__closesocket@4’

Hi @Argex
This error usually happens if you forget to set WINDOWS=1 before building. Is this the case?
Please rebuild after you set this environment variable.
Regards,
Ron

Greetings again.

Ever me^^. I tried many times to set WINDOWS=1, but the code keeps blocking in that point.
I read here https://tls.mbed.org/discussions/bug-report-issues/trying-to-build-1-1-1-on-mingw32 , that i should modify the Makefile in the properly way to fix this issue, but honestly i have no idea of what to do…could you help me? Or do you other solutions?

Regards.

Hi @Argex
There is probably something missing in your environment.
Have you cleaned the environment before rebuilding? The issues you are encountering should have been resolved with set WINDOWS=1
Regards

Thanks man, i’ve already solved it. But really appreciate the time you dedicated me. I apologise for disturbing.

Bye.