www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - X86 COFF format static libraries is very important for d,how to use

reply "FrankLike" <1150015857 qq.com> writes:
X86 COFF format static libraries is very important for  d,such as 
the x86 server, x86 small devices, and how to use them?
Most of x86 COFF format static libraries are built by c.

dmd -ms32coff ?
Nov 08 2014
parent reply "Joakim" <dlang joakim.fea.st> writes:
On Sunday, 9 November 2014 at 03:44:00 UTC, FrankLike wrote:
 X86 COFF format static libraries is very important for  d,such 
 as the x86 server, x86 small devices, and how to use them?
 Most of x86 COFF format static libraries are built by c.

 dmd -ms32coff ?
It's "-m32mscoff", but yeah, that's all you need to use with dmd. You'll also need to recompile druntime and phobos, which I believe can be done for both with the following command: make -fwin64.mak MODEL=32mscoff win64.mak has the configuration to pull in MSVC and you need to specify the model so that it compiles for 32-bit. Of course, this is only available in git HEAD, not in the stable release yet. You can find info about building from source on Windows here: http://wiki.dlang.org/Building_DMD#Windows_2
Nov 08 2014
next sibling parent "AlanThinker" <alanthinker 126.com> writes:
Is it possible in new verson, offer 32 bit COFF druntime and 
phobos lib?
Because it's hard to me to compile for myself.

On Sunday, 9 November 2014 at 05:21:06 UTC, Joakim wrote:
 On Sunday, 9 November 2014 at 03:44:00 UTC, FrankLike wrote:
 X86 COFF format static libraries is very important for  d,such 
 as the x86 server, x86 small devices, and how to use them?
 Most of x86 COFF format static libraries are built by c.

 dmd -ms32coff ?
It's "-m32mscoff", but yeah, that's all you need to use with dmd. You'll also need to recompile druntime and phobos, which I believe can be done for both with the following command: make -fwin64.mak MODEL=32mscoff win64.mak has the configuration to pull in MSVC and you need to specify the model so that it compiles for 32-bit. Of course, this is only available in git HEAD, not in the stable release yet. You can find info about building from source on Windows here: http://wiki.dlang.org/Building_DMD#Windows_2
Nov 09 2014
prev sibling next sibling parent reply "FrankLike" <1150015857 qq.com> writes:
 It's "-m32mscoff", but yeah, that's all you need to use with 
 dmd.
  You'll also need to recompile druntime and phobos, which I 
 believe can be done for both with the following command:

 make -fwin64.mak MODEL=32mscoff

 win64.mak has the configuration to pull in MSVC and you need to 
 specify the model so that it compiles for 32-bit.  Of course, 
 this is only available in git HEAD, not in the stable release 
 yet.  You can find info about building from source on Windows 
 here:

 http://wiki.dlang.org/Building_DMD#Windows_2
I've built the 'lib64' it's ok, make -fwin64.mak for 'druntime and phobos' but I've built the 'lib32mscoff'(druntime32mscoff.lib,gcstub32mscoff.obj,phobos32mscoff.lib) use 'make -fwin64.mak MODEL=32mscoff' but get some errors: this is my bat file info: set lib=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc \lib;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib;H:\D\dmd2\windows\libms32coff dmd -c -release -m32mscoff a.d link a.obj /machine:x86 /OUT:a.exe druntime32mscoff.lib gcstub32mscoff.obj phobos32mscoff.lib It works on vs2010: %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86 It can get the a.obj dumpbin a.obj ,it's COFF type. ---------------------------------------------Err------------------------------------- Err: will create a.lib and a.exp druntime32mscoff.lib(dmain2_560_47b.obj):error LNK2019:Unresolved external symbol _getErrno,the symbol is referenced in __d_run_main phobos32mscoff.lib(errno_229_226.obj):error LNK2001:Unresolved external symbol _getErrno a.exe:fatal error LNK1120:An unresolved external symbol. ----------------------------------------------------------------- Thank you.
Nov 10 2014
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 10.11.2014 17:03, FrankLike wrote:
 It's "-m32mscoff", but yeah, that's all you need to use with dmd.
  You'll also need to recompile druntime and phobos, which I believe
 can be done for both with the following command:

 make -fwin64.mak MODEL=32mscoff

 win64.mak has the configuration to pull in MSVC and you need to
 specify the model so that it compiles for 32-bit.  Of course, this is
 only available in git HEAD, not in the stable release yet.  You can
 find info about building from source on Windows here:

 http://wiki.dlang.org/Building_DMD#Windows_2
I've built the 'lib64' it's ok, make -fwin64.mak for 'druntime and phobos' but I've built the 'lib32mscoff'(druntime32mscoff.lib,gcstub32mscoff.obj,phobos32mscoff.lib) use 'make -fwin64.mak MODEL=32mscoff' but get some errors: this is my bat file info: set lib=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc \lib;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib;H:\D\dmd2\windows\libms32coff dmd -c -release -m32mscoff a.d link a.obj /machine:x86 /OUT:a.exe druntime32mscoff.lib gcstub32mscoff.obj phobos32mscoff.lib It works on vs2010: %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86 It can get the a.obj dumpbin a.obj ,it's COFF type. ---------------------------------------------Err------------------------------------- Err: will create a.lib and a.exp druntime32mscoff.lib(dmain2_560_47b.obj):error LNK2019:Unresolved external symbol _getErrno,the symbol is referenced in __d_run_main phobos32mscoff.lib(errno_229_226.obj):error LNK2001:Unresolved external symbol _getErrno a.exe:fatal error LNK1120:An unresolved external symbol. ----------------------------------------------------------------- Thank you.
I suspect you are compiling the druntime/phobos library with the 64-bit VC compiler. Make sure cl.exe is the compiler targeting 32-bit when running "make -fwin64.mak MODEL=m32mscoff".
Nov 10 2014
parent reply "FrankLike" <1150015857 qq.com> writes:
 I suspect you are compiling the druntime/phobos library with 
 the 64-bit VC compiler. Make sure cl.exe is the compiler 
 targeting 32-bit when running "make -fwin64.mak 
 MODEL=m32mscoff".
I've done it as you said:compiling the druntime/phobos library with the 64-bit VC compiler.and cl.exe is the compiler. OPEN:%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" amd64 set DM_HOME=h:\D cd %DM_HOME%\dmd2\src\druntime make -fwin64.mak MODEL=32mscoff get the druntime32mscoff.lib and gcstub32mscoff.obj do that on phobos,and get the phobos32mscoff.lib. Then,I use it: OPEN:%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86 set DM_HOME=h:\D set path=%path%;%DM_HOME%\dmd2\windows\bin; set lib=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib;h:\D\dmd2\windows\libms32coff dmd -c -m32mscoff a.d link /machine:x86 a User32.lib shell32.lib ole32.lib oleAut32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib uuid.lib ws2_32.lib druntime32mscoff.lib gcstub32mscoff.obj phobos32mscoff.lib /LARGEADDRESSAWARE:NO but get the error as that ↑ Thank you.
Nov 11 2014
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 11.11.2014 14:46, FrankLike wrote:
 I suspect you are compiling the druntime/phobos library with the
 64-bit VC compiler. Make sure cl.exe is the compiler targeting 32-bit
 when running "make -fwin64.mak MODEL=m32mscoff".
I've done it as you said:compiling the druntime/phobos library with the 64-bit VC compiler.and cl.exe is the compiler. OPEN:%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" amd64
You have to compile druntime and phobos with the x86 compiler aswell. Otherwise the C files in the library are built for the wrong architecture. So you should be fine if you use "x86" intead of "amd64" in the line above.
Nov 11 2014
parent reply "FrankLike" <1150015857 qq.com> writes:
 You have to compile druntime and phobos with the x86 compiler 
 aswell. Otherwise the C files in the library are built for the 
 wrong architecture.

 So you should be fine if you use "x86" intead of "amd64" in the 
 line above.
-------------------------------------------- Sorry,get the same error. will create a.lib and a.exp druntime32mscoff.lib(dmain2_560_47b.obj):error LNK2019:Unresolved external symbol _getErrno,the symbol is referenced in __d_run_main phobos32mscoff.lib(errno_229_226.obj):error LNK2001:Unresolved external symbol _getErrno a.exe:fatal error LNK1120:An unresolved external symbol.
Nov 11 2014
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 12.11.2014 01:25, FrankLike wrote:
 You have to compile druntime and phobos with the x86 compiler aswell.
 Otherwise the C files in the library are built for the wrong
 architecture.

 So you should be fine if you use "x86" intead of "amd64" in the line
 above.
-------------------------------------------- Sorry,get the same error. will create a.lib and a.exp druntime32mscoff.lib(dmain2_560_47b.obj):error LNK2019:Unresolved external symbol _getErrno,the symbol is referenced in __d_run_main phobos32mscoff.lib(errno_229_226.obj):error LNK2001:Unresolved external symbol _getErrno a.exe:fatal error LNK1120:An unresolved external symbol.
Maybe you forgot to clean up the object files from the win64/win32-dmc build? This is extracted from my build batch: set dm_make=c:\l\dmc\bin\make set DMD=../windows/bin/dmd.exe set cl32=%VCINSTALLDIR%/bin/cl.exe set ar32=%VCINSTALLDIR%/bin/lib.exe cd druntime del /q errno_c.obj complex.obj %dm_make% -f win64.mak DMD=%DMD% MODEL=32mscoff "CC=\"%cl32%\"" if errorlevel 1 goto xit cd .. cd phobos cd etc\c\zlib %dm_make% -f win64.mak clean cd ..\..\.. %dm_make% -f win64.mak DMD=%DMD% MODEL=32mscoff "CC=\"%cl32%\"" MAKE=%dm_make% "AR=\"%ar32%\"" if errorlevel 1 goto xit cd .. You might not need the CC and AR arguments to make if you use the VS2010 installation as expected by the makefiles. [My mail program shows a line break in the last call to make, there should be no line break before "MAKE=%dm_make%".]
Nov 14 2014
parent "FrankLike" <1150015857 qq.com> writes:
 Maybe you forgot to clean up the object files from the 
 win64/win32-dmc build?

 This is extracted from my build batch:

 set dm_make=c:\l\dmc\bin\make
 set DMD=../windows/bin/dmd.exe
 set cl32=%VCINSTALLDIR%/bin/cl.exe
 set ar32=%VCINSTALLDIR%/bin/lib.exe

 cd druntime
 del /q errno_c.obj complex.obj
 %dm_make% -f win64.mak DMD=%DMD% MODEL=32mscoff "CC=\"%cl32%\""
 if errorlevel 1 goto xit
 cd ..

 cd phobos
 cd etc\c\zlib
 %dm_make% -f win64.mak clean
 cd ..\..\..
 %dm_make% -f win64.mak DMD=%DMD% MODEL=32mscoff "CC=\"%cl32%\"" 
 MAKE=%dm_make% "AR=\"%ar32%\""
 if errorlevel 1 goto xit
 cd ..

 You might not need the CC and AR arguments to make if you use 
 the VS2010 installation as expected by the makefiles.

 [My mail program shows a line break in the last call to make, 
 there should be no line break before "MAKE=%dm_make%".]
Thank you very much it's a good idea.
Nov 15 2014
prev sibling parent "FrankLike" <1150015857 qq.com> writes:
 make -fwin64.mak MODEL=32mscoff

 win64.mak has the configuration to pull in MSVC and you need to 
 specify the model so that it compiles for 32-bit.  Of course, 
 this is only available in git HEAD, not in the stable release 
 yet.  You can find info about building from source on Windows 
 here:

 http://wiki.dlang.org/Building_DMD#Windows_2
If use the x64,will get the error: a.obj fatal error LNK1112: will get the files: a.lib ,a.exp,and a.obj Why? Thank you.
Nov 10 2014