Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
August 02, 2012 Cannot build ws2_32.lib | ||||
---|---|---|---|---|
| ||||
I found this code from this page: http://rosettacode.org/wiki/Category:D import std.stdio, std.socket; void main(){ writefln("%s", Socket.hostName()); } When I tried to build it (I'm on Windows, anyway), I got this: C:\Users\CSL-NB-064\Codes\D>dmd hostname.d OPTLINK (R) for Win32 Release 8.00.5 Copyright (C) Digital Mars 1989-2009 All rights reserved. http://www.digitalmars.com/ctg/optlink.html ws2_32.lib Warning 2: File Not Found ws2_32.lib C:\dmd\lib\phobos.lib(socket) Error 42: Symbol Undefined _WSAIoctl@36 --- errorlevel 1 I did some Googling, and I found this http://www.digitalmars.com/d/archives/c++/2519.html. It looked interesting because MinGW, instead of DMC was used. So I downloaded Jan Knepper's implib, and extracted it into C:\dm\bin. This is my implib.ini: http://pastebin.com/iusxakcj The next part is to build ws2_32.lib I copied ws2_32.dll from C:\Windows\System32 into C:\dmd\lib, and ran this command: C:\dm\lib>implib /v /system /IC:\mingw\include /suffix ws2_32.dll ws2_32.dll The output was: Digital Mars Import Library Manager Version 7.5B4n Copyright (C) Digital Mars 1999-2002. All Rights Reserved. Modified by Jan Knepper Include Path : 'C:\mingw\include' Suffix::Include ( C:\mingw\include ) ws2_32.dll Input is a Windows NT DLL file 'WS2_32.dll'. cpp.exe: error: unrecognized command line option '-EL' cpp.exe: error: unrecognized command line option '-EL' cpp.exe: error: unrecognized command line option '-EL' cpp.exe: error: unrecognized command line option '-EL' cpp.exe: error: unrecognized command line option '-EL' Output is a Windows NT import library. Digital Mars Import Library Creator complete. Then I tried to compile once again, and the same error still happened. Is there an easier way to get the importants libs? |
August 02, 2012 Re: Cannot build ws2_32.lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andre Tampubolon | I just remembered that the official dmd build has those libs. So I grab them and put them into C:\dmd\lib.
Still, the same error still happens. Maybe because I build dmd, druntime, and phobos from git?
On 8/2/2012 10:59 PM, Andre Tampubolon wrote:
>
> When I tried to build it (I'm on Windows, anyway), I got this:
> C:\Users\CSL-NB-064\Codes\D>dmd hostname.d
> OPTLINK (R) for Win32 Release 8.00.5
> Copyright (C) Digital Mars 1989-2009 All rights reserved.
> http://www.digitalmars.com/ctg/optlink.html
> ws2_32.lib
> Warning 2: File Not Found ws2_32.lib
> C:\dmd\lib\phobos.lib(socket)
> Error 42: Symbol Undefined _WSAIoctl@36
> --- errorlevel 1
|
August 02, 2012 Re: Cannot build ws2_32.lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andre Tampubolon | On Thu, 02 Aug 2012 16:59:32 +0100, Andre Tampubolon <andre@lc.vlsm.org> wrote: > I found this code from this page: > http://rosettacode.org/wiki/Category:D > > import std.stdio, std.socket; > > void main(){ > writefln("%s", Socket.hostName()); > } > > When I tried to build it (I'm on Windows, anyway), I got this: > C:\Users\CSL-NB-064\Codes\D>dmd hostname.d > OPTLINK (R) for Win32 Release 8.00.5 > Copyright (C) Digital Mars 1989-2009 All rights reserved. > http://www.digitalmars.com/ctg/optlink.html > ws2_32.lib > Warning 2: File Not Found ws2_32.lib > C:\dmd\lib\phobos.lib(socket) > Error 42: Symbol Undefined _WSAIoctl@36 > --- errorlevel 1 Works for me :P Have you downloaded and extracted a normal dmd 2.0 installation/zip? If so, you should have: <some path>\dmd2\windows\lib\ws2_32.lib and your <some path>\dmd2\windows\bin\sc.ini should have something like: LIB="%@P%\..\lib";\dm\lib which will point dmd at that ws2_32.lib file. If you have those libs, and sc.ini, then perhaps all you're missing is the correct PATH setting, I have <some path>\dmd2\windows\bin in my PATH. If that doesn't help, or you already have it, I'd start by getting a normal installation/zip and see if it works, if so then replace the files you're (re-)building and try again - it should also work. R -- Using Opera's revolutionary email client: http://www.opera.com/mail/ |
August 03, 2012 Re: Cannot build ws2_32.lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Regan Heath | Actually I just solved the problem, by copying all the libs from dmd.2.0.59.zip into C:\dm\lib\
And this is my sc.ini:
[Environment]
LIB="C:\dmd\lib"
DFLAGS="-IC:\dmd\import" "-IC:\dmd\phobos"
LINKCMD=link.exe
On 8/3/2012 12:31 AM, Regan Heath wrote:
>
> Have you downloaded and extracted a normal dmd 2.0 installation/zip?
>
> If so, you should have:
>
> <some path>\dmd2\windows\lib\ws2_32.lib
>
> and your
>
> <some path>\dmd2\windows\bin\sc.ini
|
August 03, 2012 Re: Cannot build ws2_32.lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andre Tampubolon | On Fri, 03 Aug 2012 07:00:25 +0100, Andre Tampubolon <andre@lc.vlsm.org> wrote: > On 8/3/2012 12:31 AM, Regan Heath wrote: >> >> Have you downloaded and extracted a normal dmd 2.0 installation/zip? >> >> If so, you should have: >> >> <some path>\dmd2\windows\lib\ws2_32.lib >> >> and your >> >> <some path>\dmd2\windows\bin\sc.ini > > Actually I just solved the problem, by copying all the libs from dmd.2.0.59.zip into C:\dm\lib\ That's odd. I don't have ws2_32.lib in my dmc\dm\lib folder at all. > And this is my sc.ini: > [Environment] > LIB="C:\dmd\lib" > DFLAGS="-IC:\dmd\import" "-IC:\dmd\phobos" > LINKCMD=link.exe So, your sc.ini isn't pointing at dm\lib.. why would copying files there make it work? My sc.ini has: [Environment] LIB="%@P%\..\lib";\dm\lib DFLAGS="-I%@P%\..\..\src\phobos" "-I%@P%\..\..\src\druntime\import" LINKCMD=%@P%\link.exe %@P% resolves to the \dmd2\windows\bin folder so my LIB statement points first at dmd2\windows\lib which is where ws2_32.lib is. I wonder.. Is dm\bin in your path? If so link.exe in your case is probably dm\bin\link.exe and the sc.ini there has: LIB="%@P%\..\lib";"%@P%\..\mfc\lib";%LIB% which points to dm\lib. If I were you, and you're not using dmc directly, I would remove dm\bin from the path and put dmd2\windows\bin there instead, then you should see the same behaviour as me. R -- Using Opera's revolutionary email client: http://www.opera.com/mail/ |
Copyright © 1999-2021 by the D Language Foundation