#3816 closed defect (fixed)

Windows / MSYS2 build error for Sparc/SIS - missing sys/socket.h

Reported by: Jeff Mayes Owned by: Jiri Gaisler
Priority: normal Milestone:
Component: arch/sparc Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

Looking at winsock2.h it appears some POSIX'ish methods are available for sockets, so it may not be hard to support MingWin?.

RTEMS Tools Project - Source Builder Error Report

Build: error: building s2xwm1

Command Line: ../source-builder/sb-set-builder --prefix=C:/msys64/home/mayes/dev/rtems/5 5/rtems-sparc

Python: 2.7.16 (default, Aug 15 2019, 17:51:40) [GCC 9.2.0 64 bit (AMD64)]

git://git.rtems.org/rtems-source-builder.git/origin/9a1cf9a2d940a4f79cd822f05c8fb13a4c0ec3bb

Windows

...
...
...

x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -DFAST_UART -O2 -g -pipe -I/c/msys64/home/mayes/dev/rtems/rsb/rtems/build/tmp/sb-mayes/5s/c/msys64/home/mayes/dev/rtems/5/include -MT func.o -MD -MP -MF .deps/func.Tpo -c -o func.o func.c

func.c:26:10: fatal error: sys/socket.h: No such file or directory

26 | #include <sys/socket.h>

| ~

compilation terminated.

make[1]: * [Makefile:380: func.o] Error 1
make[1]:
* Waiting for unfinished jobs....
mv -f .deps/leon3.Tpo .deps/leon3.Po
make[1]: Leaving directory '/c/msys64/home/mayes/dev/rtems/rsb/rtems/build/s2xwm1/sis-2.18'
make: * [Makefile:260: all] Error 2
shell cmd failed: sh -ex /c/msys64/home/mayes/dev/rtems/rsb/rtems/build/s2xwm1/do-build
error: building s2xwm1

Change History (10)

comment:1 Changed on Nov 5, 2019 at 9:22:33 PM by Jiri Gaisler

I can make sis compile under mingw but only without the gdb interface. The windows socket API is slightly different from unix, and I am not a windows user...

I can see two short-term fixes: disable the gdb interface in sis when building for mingw (WIN32) or disable building sis altogether when building RSB on a WIN32 host.

note: if you are on windows 10, you could always install WSL with an ubuntu 18.04 image and build RSB there ...

comment:2 Changed on Nov 5, 2019 at 9:28:44 PM by Joel Sherrill

Everyone doesn't have the option to install WSL. How about temporarily disabling the gdb interface and update this ticket with that commit. Hopefully someone who knows winsock can fix it.

comment:3 Changed on Nov 5, 2019 at 11:38:20 PM by Chris Johns

I have implemented Windows socket support before ...

https://sourceforge.net/p/bdm/code/ci/master/tree/m68k/gdbserver/remote-utils.c

If I get time I will look at adding the support.

comment:4 Changed on Nov 7, 2019 at 9:06:44 PM by Jiri Gaisler

Can I assume that we talk about mingw-w64 support only, and not the original 32-bit mingw? It would simplify things ...

comment:5 in reply to:  4 ; Changed on Nov 8, 2019 at 12:44:41 AM by Chris Johns

Replying to Jiri Gaisler:

Can I assume that we talk about mingw-w64 support only, and not the original 32-bit mingw? It would simplify things ...

I was thinking about native Windows winsock calls so I am not sure if this makes a difference. Is there an issue I am not aware of?

comment:6 in reply to:  5 ; Changed on Nov 8, 2019 at 7:57:00 AM by Jiri Gaisler

Replying to Chris Johns:

Replying to Jiri Gaisler:

Can I assume that we talk about mingw-w64 support only, and not the original 32-bit mingw? It would simplify things ...

I was thinking about native Windows winsock calls so I am not sure if this makes a difference. Is there an issue I am not aware of?

It is not so much winsock, but terminal handling. Windows and mingw/msys does not support termios, thus no readline or linenoise. And reverting to fgets() feels a bit primitive. However, the newer mingw-w64/msys2 has a port of readline which is also used by gdb et al. So going with msys2 would make the porting easier as only the winsock needs to be addressed ...

comment:7 in reply to:  6 Changed on Nov 8, 2019 at 11:41:30 PM by Chris Johns

Replying to Jiri Gaisler:

Replying to Chris Johns:

Replying to Jiri Gaisler:

Can I assume that we talk about mingw-w64 support only, and not the original 32-bit mingw? It would simplify things ...

I was thinking about native Windows winsock calls so I am not sure if this makes a difference. Is there an issue I am not aware of?

It is not so much winsock, but terminal handling.

Ah yes this is a problem on Windows.

Windows and mingw/msys does not support termios, thus no readline or linenoise. And reverting to fgets() feels a bit primitive. However, the newer mingw-w64/msys2 has a port of readline which is also used by gdb et al.

Is this a mingw package of readline? We cannot use msys2 packages.

So going with msys2 would make the porting easier as only the winsock needs to be addressed ...

I am fine with a probe for readline and if not present the interface is very basic. I have tended to use sis with gdb and so I have not used used the command line.

comment:8 Changed on Nov 9, 2019 at 2:44:16 PM by Jiri Gaisler <jiri@…>

In 35a4a0c/rtems-source-builder:

Update sis simulator to v2.19

  • Improve gdb watchpoint handling/reporting
  • Support building on Mingw-W64
  • Stop flushing sparc reg windows on gdb break
  • updates #3816

comment:9 Changed on Nov 9, 2019 at 2:52:47 PM by Jiri Gaisler

I updated sis and RSB with a patch that should solve the build problems on mingw-w64. Make sure you have mingw-gdb installed, it will pull in the mingw-readline dll. I also made sis compile with winsock in mingw - let me know if there are any socket problems with the gdb interface...

comment:10 Changed on Nov 13, 2019 at 4:33:56 PM by Jeff Mayes

Resolution: fixed
Status: assignedclosed

Looks to be fixed on my end. Thanks Jiri!

Note: See TracTickets for help on using tickets.