Project

General

Profile

Actions

Emulator Issues #8277

closed

Enet fails compile on Debian Jessie

Added by gladiac about 9 years ago.

Status:
Fixed
Priority:
Urgent
Assignee:
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Current
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

Hi, compilation fails on my debian jessy machine since the merge of the enet-patches (commit 619a3a5171f24d999e5b41ae54746d0b31babcf3). The problem is inside Externals/enet/unix.c:

[ 3%] Building C object Externals/enet/CMakeFiles/enet.dir/unix.c.o
/home/gladiac/src/dolphin-emu/Externals/enet/unix.c:52:13: error: conflicting types for ‘socklen_t’
typedef int socklen_t;
^
In file included from /usr/include/x86_64-linux-gnu/sys/socket.h:38:0,
from /home/gladiac/src/dolphin-emu/Externals/enet/unix.c:8:
/usr/include/x86_64-linux-gnu/bits/socket.h:33:21: note: previous declaration of ‘socklen_t’ was here
typedef __socklen_t socklen_t;

Inside unix.c in line 57 the type socklen_t gets defined even though that is already done by the inclusion of socket.h. Commenting out the lines 56-58 in unix.c fixes the build but that is a crude solution.

Actions #1

Updated by nicolaspanti about 9 years ago

I have the same error (also on Debian GNU/Linux 8/testing x86-64).

[ 0%] Building C object Externals/enet/CMakeFiles/enet.dir/unix.c.o
/home/rydroid/dolphin-emu/Externals/enet/unix.c:52:13: error: conflicting types for ‘socklen_t’
typedef int socklen_t;
^
In file included from /usr/include/x86_64-linux-gnu/sys/socket.h:38:0,
from /home/rydroid/dolphin-emu/Externals/enet/unix.c:8:
/usr/include/x86_64-linux-gnu/bits/socket.h:33:21: note: previous declaration of ‘socklen_t’ was here
typedef __socklen_t socklen_t;
^
/home/rydroid/dolphin-emu/Externals/enet/unix.c: In function ‘enet_socket_get_address’:
/home/rydroid/dolphin-emu/Externals/enet/unix.c:220:57: warning: pointer targets in passing argument 3 of ‘getsockname’ differ in signedness [-Wpointer-sign]
if (getsockname (socket, (struct sockaddr *) & sin, & sinLength) == -1)
^
In file included from /home/rydroid/dolphin-emu/Externals/enet/unix.c:8:0:
/usr/include/x86_64-linux-gnu/sys/socket.h:127:12: note: expected ‘socklen_t * restrict’ but argument is of type ‘socklen_t *’
extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
^
/home/rydroid/dolphin-emu/Externals/enet/unix.c: In function ‘enet_socket_get_option’:
/home/rydroid/dolphin-emu/Externals/enet/unix.c:308:71: warning: pointer targets in passing argument 5 of ‘getsockopt’ differ in signedness [-Wpointer-sign]
result = getsockopt (socket, SOL_SOCKET, SO_ERROR, value, & len);
^
In file included from /home/rydroid/dolphin-emu/Externals/enet/unix.c:8:0:
/usr/include/x86_64-linux-gnu/sys/socket.h:219:12: note: expected ‘socklen_t * restrict’ but argument is of type ‘socklen_t *’
extern int getsockopt (int __fd, int __level, int __optname,
^
/home/rydroid/dolphin-emu/Externals/enet/unix.c: In function ‘enet_socket_accept’:
/home/rydroid/dolphin-emu/Externals/enet/unix.c:345:22: warning: pointer targets in passing argument 3 of ‘accept’ differ in signedness [-Wpointer-sign]
address != NULL ? & sinLength : NULL);
^
In file included from /home/rydroid/dolphin-emu/Externals/enet/unix.c:8:0:
/usr/include/x86_64-linux-gnu/sys/socket.h:243:12: note: expected ‘socklen_t * restrict’ but argument is of type ‘socklen_t *’
extern int accept (int __fd, __SOCKADDR_ARG __addr,
^
Externals/enet/CMakeFiles/enet.dir/build.make:215: recipe for target 'Externals/enet/CMakeFiles/enet.dir/unix.c.o' failed
make[2]: *** [Externals/enet/CMakeFiles/enet.dir/unix.c.o] Error 1
CMakeFiles/Makefile2:167: recipe for target 'Externals/enet/CMakeFiles/enet.dir/all' failed
make[1]: *** [Externals/enet/CMakeFiles/enet.dir/all] Error 2
Makefile:147: recipe for target 'all' failed
make: *** [all] Error 2

Actions #2

Updated by waddlesplash about 9 years ago

  • Status changed from New to Accepted
  • Priority set to Urgent
  • Milestone set to Current
Actions #3

Updated by williamderieux about 9 years ago

<sys/socket.h>

  • does not define socklen_t or HAS_SOCKLEN_T
  • it does include bits/socket.h

<bits/socket.h>
defines typedef __socklen_t socklen_t;
but not HAS_SOCKLEN_T

/* Type for length arguments in socket calls. */
#ifndef __socklen_t_defined
typedef __socklen_t socklen_t;

define __socklen_t_defined

#endif

so instead of using HAS_SOCKLEN_T use __socklen_t_defined
** note: that __socklen_t_defined will always being defined because <sys/socket.h> has been included

Actions #4

Updated by williamderieux about 9 years ago

bits/types.h defines:
__STD_TYPE __U32_TYPE __socklen_t;
where as the following code is used (change int to unsigned int or __U32_TYPE, should fix compiler warnings as well)
#ifndef HAS_SOCKLEN_T
typedef int socklen_t;
#endif

Actions #5

Updated by waddlesplash about 9 years ago

  • Status changed from Accepted to Fix pending
Actions #6

Updated by gladiac about 9 years ago

Hi,

the attached patch fixes the problem for me. I tried not to harm the APPLE #ifdefs logic. Additionally, I kept the original "typedef int socklen_t" for APPLE since they seem not to have __socklen_t.

Actions #7

Updated by waddlesplash about 9 years ago

That patch may fix the issue, but we currently have logic in the CMakeLists file to detect socklen_t. This was not working because of a global scoping issue, which is fixed in that PR.

Actions #8

Updated by gladiac about 9 years ago

Ah alright. Thanks for the fix :).

Actions #9

Updated by degasus about 9 years ago

  • Status changed from Fix pending to Fixed
Actions #10

Updated by nicolaspanti about 9 years ago

I have still the problem with commit 4fd980e6d48fc15d31121878eb61e4b331c1c4bd and a fully updated Debian GNU/Linux 8/jessie (after git pull, I did a "cmake .." before make).

Actions #11

Updated by waddlesplash about 9 years ago

You may need to delete your build directory for the change to take effect.

Actions #12

Updated by nicolaspanti about 9 years ago

Thanks, it works. Sorry, I thought that cmake was more intelligent.

Actions

Also available in: Atom PDF