digitalmars.D.learn - optlink options to reduce file size?
- simendsjo (5/5) Jul 27 2011 A simple hello world like dfl application takes 1.2mb. Upx does a great
- simendsjo (3/8) Jul 27 2011 Nevermind. I found the switches here:
- Stephan (2/11) Jul 27 2011 So what switched did you use to make it link smaller ?
- simendsjo (2/14) Jul 27 2011 I haven't gone through the switches yet. /EXEPACK looks interesting.
- Dmitry Olshansky (9/14) Jul 27 2011 I've noticed around two times smaller exes when linked with unilink. So
- Andrej Mitrovic (4/4) Jul 27 2011 I've found it interesting how sometimes (not dfl-specific) the first
- Dmitry Olshansky (7/11) Jul 27 2011 LOL, it shouldn't be usually.
- simendsjo (3/16) Jul 27 2011 Thanks. Any idea if unilink works with libraries linked with optlink?
- Dmitry Olshansky (9/26) Jul 27 2011 For what it's worth any D2 app uses phobos.lib and obviously that
- simendsjo (9/36) Jul 27 2011 Tried a minimal sample using only phobos. Gave me another error:
- Dmitry Olshansky (10/50) Jul 27 2011 Hm.. you might try to link with just object files then. Still it's
- simendsjo (4/56) Jul 27 2011 Could be a bug, but it's most likely my bad as this is the first time I
- q66 (3/16) Jul 27 2011 I don't work on Windows, but I've heard optlink generates debug info and...
- simendsjo (3/19) Jul 27 2011 Even with -O -release? I added -L/NODEBUG and -L/DEBUG, but it seems dmd...
- Dmitry Olshansky (7/28) Jul 27 2011 Fist of all linker doesn't _generate_ debug info. But it place it into
A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables? I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either.
Jul 27 2011
On 27.07.2011 13:21, simendsjo wrote:A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables? I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either.Nevermind. I found the switches here: http://www.digitalmars.com/ctg/ctgLinkSwitches.html
Jul 27 2011
On 27.07.2011 13:26, simendsjo wrote:On 27.07.2011 13:21, simendsjo wrote:So what switched did you use to make it link smaller ?A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables? I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either.Nevermind. I found the switches here: http://www.digitalmars.com/ctg/ctgLinkSwitches.html
Jul 27 2011
On 27.07.2011 13:42, Stephan wrote:On 27.07.2011 13:26, simendsjo wrote:I haven't gone through the switches yet. /EXEPACK looks interesting.On 27.07.2011 13:21, simendsjo wrote:So what switched did you use to make it link smaller ?A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables? I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either.Nevermind. I found the switches here: http://www.digitalmars.com/ctg/ctgLinkSwitches.html
Jul 27 2011
On 27.07.2011 15:21, simendsjo wrote:A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables? I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either.I've noticed around two times smaller exes when linked with unilink. So if you don't like packing you may try it: ftp://ftp.styx.cabel.net/pub/UniLink/ulnb0319.zip <ftp://ftp.styx.cabel.net/pub/UniLink/> just make sure you configured it correctly (should be straightforward, there are examples) -- Dmitry Olshansky
Jul 27 2011
I've found it interesting how sometimes (not dfl-specific) the first compiled executable is over a meg in size, but as I add a couple of hunderd lines of code the executable size shrinks. I guess some kind of optimization takes place there..
Jul 27 2011
On 27.07.2011 18:05, Andrej Mitrovic wrote:I've found it interesting how sometimes (not dfl-specific) the first compiled executable is over a meg in size, but as I add a couple of hunderd lines of code the executable size shrinks. I guess some kind of optimization takes place there..LOL, it shouldn't be usually. It's possible in case if, for instance, your first version uses more different functions from lib then the second one, in effect linker could pull in less object files from library. -- Dmitry Olshansky
Jul 27 2011
On 27.07.2011 15:45, Dmitry Olshansky wrote:On 27.07.2011 15:21, simendsjo wrote:Thanks. Any idea if unilink works with libraries linked with optlink? I get "Error: Invalid library file (3) 'some optlink.lib'"A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables? I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either.I've noticed around two times smaller exes when linked with unilink. So if you don't like packing you may try it: ftp://ftp.styx.cabel.net/pub/UniLink/ulnb0319.zip <ftp://ftp.styx.cabel.net/pub/UniLink/> just make sure you configured it correctly (should be straightforward, there are examples)
Jul 27 2011
On 27.07.2011 21:16, simendsjo wrote:On 27.07.2011 15:45, Dmitry Olshansky wrote:For what it's worth any D2 app uses phobos.lib and obviously that worked. Not that it was linked, library is a sort of a package with obj files. Also check if this is in fact library it might very well be renamed executable in which case 2 first bytes of file are 'MZ'. It should work with both OMF (DMC, old MS VC++ etc.) and COFF (MinGW, modern MS C++ etc.) libraries. -- Dmitry OlshanskyOn 27.07.2011 15:21, simendsjo wrote:Thanks. Any idea if unilink works with libraries linked with optlink? I get "Error: Invalid library file (3) 'some optlink.lib'"A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables? I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either.I've noticed around two times smaller exes when linked with unilink. So if you don't like packing you may try it: ftp://ftp.styx.cabel.net/pub/UniLink/ulnb0319.zip <ftp://ftp.styx.cabel.net/pub/UniLink/> just make sure you configured it correctly (should be straightforward, there are examples)
Jul 27 2011
On 27.07.2011 23:00, Dmitry Olshansky wrote:On 27.07.2011 21:16, simendsjo wrote:Tried a minimal sample using only phobos. Gave me another error: Error: Unresolved external '__acrtused_con' referenced from 't.obj' I downloaded the entire dm compiler and added snn.lib which solved the problem. I'm still getting linker errors on the old file though.On 27.07.2011 15:45, Dmitry Olshansky wrote:For what it's worth any D2 app uses phobos.lib and obviously that worked. Not that it was linked, library is a sort of a package with obj files. Also check if this is in fact library it might very well be renamed executable in which case 2 first bytes of file are 'MZ'. It should work with both OMF (DMC, old MS VC++ etc.) and COFF (MinGW, modern MS C++ etc.) libraries.On 27.07.2011 15:21, simendsjo wrote:Thanks. Any idea if unilink works with libraries linked with optlink? I get "Error: Invalid library file (3) 'some optlink.lib'"A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables? I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either.I've noticed around two times smaller exes when linked with unilink. So if you don't like packing you may try it: ftp://ftp.styx.cabel.net/pub/UniLink/ulnb0319.zip <ftp://ftp.styx.cabel.net/pub/UniLink/> just make sure you configured it correctly (should be straightforward, there are examples)dmd t3 dfl.libNo problem.ulink.exe -Go -Tpe t3.obj,t3.exe,,dfl.libUniLink v1.07 [beta] (build 3.19) Error: Invalid library file (3) 'c:\d\ext\dwin\lib\dfl.lib'
Jul 27 2011
On 28.07.2011 2:03, simendsjo wrote:On 27.07.2011 23:00, Dmitry Olshansky wrote:Yes, I should have mentioned it. Btw snn.lib lives in dmd2\windows\libOn 27.07.2011 21:16, simendsjo wrote:Tried a minimal sample using only phobos. Gave me another error: Error: Unresolved external '__acrtused_con' referenced from 't.obj' I downloaded the entire dm compiler and added snn.lib which solved the problem.On 27.07.2011 15:45, Dmitry Olshansky wrote:For what it's worth any D2 app uses phobos.lib and obviously that worked. Not that it was linked, library is a sort of a package with obj files. Also check if this is in fact library it might very well be renamed executable in which case 2 first bytes of file are 'MZ'. It should work with both OMF (DMC, old MS VC++ etc.) and COFF (MinGW, modern MS C++ etc.) libraries.On 27.07.2011 15:21, simendsjo wrote:Thanks. Any idea if unilink works with libraries linked with optlink? I get "Error: Invalid library file (3) 'some optlink.lib'"A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables? I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either.I've noticed around two times smaller exes when linked with unilink. So if you don't like packing you may try it: ftp://ftp.styx.cabel.net/pub/UniLink/ulnb0319.zip <ftp://ftp.styx.cabel.net/pub/UniLink/> just make sure you configured it correctly (should be straightforward, there are examples)I'm still getting linker errors on the old file though.Hm.. you might try to link with just object files then. Still it's weird, could be a bug in unilink. If you inclined that this is the case, send sample obj and lib to developers with some info ulink(at)styx.cabel.net Judging by my experience, sending source code in addition to obj files is appreciated. -- Dmitry Olshanskydmd t3 dfl.libNo problem.ulink.exe -Go -Tpe t3.obj,t3.exe,,dfl.libUniLink v1.07 [beta] (build 3.19) Error: Invalid library file (3) 'c:\d\ext\dwin\lib\dfl.lib'
Jul 27 2011
On 28.07.2011 00:30, Dmitry Olshansky wrote:On 28.07.2011 2:03, simendsjo wrote:Could be a bug, but it's most likely my bad as this is the first time I try unilink. Could someone else on windows verify that dfl cannot be linked with unilink?On 27.07.2011 23:00, Dmitry Olshansky wrote:Yes, I should have mentioned it. Btw snn.lib lives in dmd2\windows\libOn 27.07.2011 21:16, simendsjo wrote:Tried a minimal sample using only phobos. Gave me another error: Error: Unresolved external '__acrtused_con' referenced from 't.obj' I downloaded the entire dm compiler and added snn.lib which solved the problem.On 27.07.2011 15:45, Dmitry Olshansky wrote:For what it's worth any D2 app uses phobos.lib and obviously that worked. Not that it was linked, library is a sort of a package with obj files. Also check if this is in fact library it might very well be renamed executable in which case 2 first bytes of file are 'MZ'. It should work with both OMF (DMC, old MS VC++ etc.) and COFF (MinGW, modern MS C++ etc.) libraries.On 27.07.2011 15:21, simendsjo wrote:Thanks. Any idea if unilink works with libraries linked with optlink? I get "Error: Invalid library file (3) 'some optlink.lib'"A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables? I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either.I've noticed around two times smaller exes when linked with unilink. So if you don't like packing you may try it: ftp://ftp.styx.cabel.net/pub/UniLink/ulnb0319.zip <ftp://ftp.styx.cabel.net/pub/UniLink/> just make sure you configured it correctly (should be straightforward, there are examples)I'm still getting linker errors on the old file though.Hm.. you might try to link with just object files then. Still it's weird, could be a bug in unilink. If you inclined that this is the case, send sample obj and lib to developers with some info ulink(at)styx.cabel.net Judging by my experience, sending source code in addition to obj files is appreciated.dmd t3 dfl.libNo problem.ulink.exe -Go -Tpe t3.obj,t3.exe,,dfl.libUniLink v1.07 [beta] (build 3.19) Error: Invalid library file (3) 'c:\d\ext\dwin\lib\dfl.lib'
Jul 27 2011
== Quote from Dmitry Olshansky (dmitry.olsh gmail.com)'s articleOn 27.07.2011 15:21, simendsjo wrote:I don't work on Windows, but I've heard optlink generates debug info and unilink doesn't, so that might be the reason?A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables? I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either.I've noticed around two times smaller exes when linked with unilink. So if you don't like packing you may try it: ftp://ftp.styx.cabel.net/pub/UniLink/ulnb0319.zip <ftp://ftp.styx.cabel.net/pub/UniLink/> just make sure you configured it correctly (should be straightforward, there are examples)
Jul 27 2011
On 27.07.2011 20:59, q66 wrote:== Quote from Dmitry Olshansky (dmitry.olsh gmail.com)'s articleEven with -O -release? I added -L/NODEBUG and -L/DEBUG, but it seems dmd overrides this with it's switches.On 27.07.2011 15:21, simendsjo wrote:I don't work on Windows, but I've heard optlink generates debug info and unilink doesn't, so that might be the reason?A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables? I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either.I've noticed around two times smaller exes when linked with unilink. So if you don't like packing you may try it: ftp://ftp.styx.cabel.net/pub/UniLink/ulnb0319.zip <ftp://ftp.styx.cabel.net/pub/UniLink/> just make sure you configured it correctly (should be straightforward, there are examples)
Jul 27 2011
On 27.07.2011 23:35, simendsjo wrote:On 27.07.2011 20:59, q66 wrote:Fist of all linker doesn't _generate_ debug info. But it place it into executable, IIRC last time I checked unilink converted CV debug info into TDS which is sadlly only recognized by Borland's tools. Note that with or without debug info it still links. -- Dmitry Olshansky== Quote from Dmitry Olshansky (dmitry.olsh gmail.com)'s articleEven with -O -release? I added -L/NODEBUG and -L/DEBUG, but it seems dmd overrides this with it's switches.On 27.07.2011 15:21, simendsjo wrote:I don't work on Windows, but I've heard optlink generates debug info and unilink doesn't, so that might be the reason?A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables? I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either.I've noticed around two times smaller exes when linked with unilink. So if you don't like packing you may try it: ftp://ftp.styx.cabel.net/pub/UniLink/ulnb0319.zip <ftp://ftp.styx.cabel.net/pub/UniLink/> just make sure you configured it correctly (should be straightforward, there are examples)
Jul 27 2011