August 30, 2011
If a source module imports both std.socket and core.sys.posix.sys.time (or std.c.linux.linux) then a conflict for the definition of timeval occurs:

The message is:
Error: std.socket.timeval at /usr/include/d/dmd/phobos/std/socket.d(948) conflicts with core.sys.posix.sys.time.timeval at /usr/include/d/dmd/druntime/import/core/sys/posix/sys/time.di(12)

This is on a Linux / Intel x86_64 platform and the phobos distributed with the DMD v2.054 package.

Both definitions are basically the same (a pair of 64 bit integers) but are sufficiently different to cause the compilation error. Is there any easy fix for this ?

If I change the structure name in socket.d I presume the whole library needs to be recompiled from it's source so that the mangled names match. There aren't many instructions in the github source on how to recompile. Do I just download the druntime and phobos source trees, do a make -f posix.mak MODEL=64 and change the install path to suit my machine (/usr/lib64) or is it more complicated than this ?
August 30, 2011
On 8/30/11 2:39 AM, Graham Cole wrote:
> If a source module imports both std.socket and core.sys.posix.sys.time (or std.c.linux.linux) then a conflict for the definition of timeval occurs: [?] Is there any easy fix for this ?

Yes, D offers facilities to resolve name collisions: Either import only the symbols you need from the modules using selective imports (possibly renaming one of the timeval structs if you need both), or use static imports on at least one module so you won't end up with two conflicting symbols.

Your concrete problem aside, if we decide to keep std.socket, we should really remove timeval (need to go though the deprecation cycle, unfortunately) and change Socket.select() to accept a Duration.

> If I change the structure name in socket.d I presume the whole library needs to be recompiled from it's source so that the mangled names match. There aren't many instructions in the github source on how to recompile. Do I just download the druntime and phobos source trees, do a make -f posix.mak MODEL=64 and change the install path to suit my machine (/usr/lib64) or is it more complicated than this ?
It isn't more complicated than that, although I am not sure if the makefiles have working install targets.

David