www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Anyone have sucess converting MSVC 2010 COFF libs to OMF

reply Byron <byron.heads gmail.com> writes:
I have several libs compiled in vs2010 that I need to convert to omf.

With the same setup I have this linked in win64, just want to get win32.

I have tried coff2omf but it fails with:
 coff2omf leveldb.lib
COFF2OMF: Converting 'd:\projects\leveldb\bin\release\tmp\leveldb.lib' COFF2OMF: Ignoring unknown directive 'vc100-mt-1_56.lib" /DEFAULTLIB' in 'd:\projects\leveldb\bin\release\tmp\leveldb.lib[.drectve]' COFF2OMF: Ignoring unknown directive 'vc100-mt-1_56.lib" /DEFAULTLIB' in 'd:\projects\leveldb\bin\release\tmp\leveldb.lib[.drectve]' COFF2OMF: Ignoring unknown directive 'vc100-mt-1_56.lib" /DEFAULTLIB' in 'd:\projects\leveldb\bin\release\tmp\leveldb.lib[.drectve]' COFF2OMF: Ignoring unknown directive 'vc100-mt-1_56.lib" /DEFAULTLIB' in 'd:\projects\leveldb\bin\release\tmp\leveldb.lib[.drectve]' COFF2OMF: Ignoring unknown directive 'vc100-mt-1_56.lib" /DEFAULTLIB' in 'd:\projects\leveldb\bin\release\tmp\leveldb.lib[.drectve]' This lib does require some boost libs I have compiled, these libs do end with vc100-mt-1_56.lib. The look like libboost_chrono-vc100-mt-1_.56.lib So maybe the dash messing up coff2omf. the digitalmars site says you need to convert the coff format via link / lib /convert [lib]. Is this only for really old version of vs?
 link /lib /convert leveldb.lib
Microsoft (R) Library Manager Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved. LINK : warning LNK4044: unrecognized option '/convert'; ignored I have also tried objconv:
 objconv -fomf leveldb.lib leveldb_omf.lib
Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment ... Warning 1060: Different alignments specified for same segment, .data. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment ... Warning 1060: Different alignments specified for same segment, .data. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment .... Warning 1060 Input library: leveldb.lib, Format: COFF32, Output: leveldb_omf.lib, Format: OMF32 : Different alignments specified for same segment, .rdata. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment Supressing further warning messages Error 2304: Word-size index exceeds 65535 Error 2304: Word-size index exceeds 65535 .... Supressing further warning messages objconv seems to work on the boost lib files but not leveldb.lib I tired messing tring to get dmc to compile boost, but there are tons of errors, to many to make me want to not go that path. So does anyone have a fool prof way of converting coff to omf libs. I feel like this use to be easy.. Thanks, -Byron
Apr 08 2014
next sibling parent "Kagamin" <spam here.lot> writes:
coff2omf is probably opensource, so you may try to fix it.
Apr 09 2014
prev sibling next sibling parent reply "Kagamin" <spam here.lot> writes:
Also, what is the point in converting coff to omf, what do you 
plan to do with the result?
Apr 09 2014
parent reply Byron <byron.heads gmail.com> writes:
On Wed, 09 Apr 2014 16:47:12 +0000, Kagamin wrote:

 Also, what is the point in converting coff to omf, what do you plan to
 do with the result?
Link a c library with D of course
Apr 09 2014
next sibling parent " FrankLike" <1150015857 qq.com> writes:
On Wednesday, 9 April 2014 at 17:45:40 UTC, Byron wrote:
 On Wed, 09 Apr 2014 16:47:12 +0000, Kagamin wrote:

 Also, what is the point in converting coff to omf, what do you 
 plan to
 do with the result?
Link a c library with D of course
Yes,the work should be done. Let other languages's tools work for D. Let other languages's LIB work for D. Let other languages's DLL work for D.
Apr 09 2014
prev sibling parent "Kagamin" <spam here.lot> writes:
On Wednesday, 9 April 2014 at 17:45:40 UTC, Byron wrote:
 Link a c library with D of course
That won't work. You would need to link with c runtime. Try ldc - it compiles to coff and supports linking with msvc runtime.
Apr 10 2014
prev sibling next sibling parent reply "Daniel Murphy" <yebbliesnospam gmail.com> writes:
"Byron"  wrote in message news:li1ba2$5lc$1 digitalmars.com...

 So does anyone have a fool prof way of converting coff to omf libs.  I
 feel like this use to be easy..
In general, this won't work. The only thing that is straightforward and reliable is converting coff import libraries to omf import libraries. Converting the file formats over is possible, but then you usually hit problems with differences between microsoft's and digital mars' c libraries. If possible, building the lib as a dll might be a workaround.
Apr 09 2014
parent Byron <byron.heads gmail.com> writes:
On Thu, 10 Apr 2014 14:10:37 +1000, Daniel Murphy wrote:

 "Byron"  wrote in message news:li1ba2$5lc$1 digitalmars.com...
 
 So does anyone have a fool prof way of converting coff to omf libs.  I
 feel like this use to be easy..
In general, this won't work. The only thing that is straightforward and reliable is converting coff import libraries to omf import libraries. Converting the file formats over is possible, but then you usually hit problems with differences between microsoft's and digital mars' c libraries. If possible, building the lib as a dll might be a workaround.
Thats what I ended up doing. I updates leveldb on code.dlang.org. Now builds with 32 and 64 bit wondows (includes dll and libs).
Apr 10 2014
prev sibling next sibling parent "Ettienne Gilbert" <ettienne.gilbert gmail.com> writes:
On Tuesday, 8 April 2014 at 17:23:14 UTC, Byron wrote:
 I have several libs compiled in vs2010 that I need to convert 
 to omf.

 With the same setup I have this linked in win64, just want to 
 get win32.

 I have tried coff2omf but it fails with:
 coff2omf leveldb.lib
COFF2OMF: Converting 'd:\projects\leveldb\bin\release\tmp\leveldb.lib' COFF2OMF: Ignoring unknown directive 'vc100-mt-1_56.lib" /DEFAULTLIB' in 'd:\projects\leveldb\bin\release\tmp\leveldb.lib[.drectve]' COFF2OMF: Ignoring unknown directive 'vc100-mt-1_56.lib" /DEFAULTLIB' in 'd:\projects\leveldb\bin\release\tmp\leveldb.lib[.drectve]' COFF2OMF: Ignoring unknown directive 'vc100-mt-1_56.lib" /DEFAULTLIB' in 'd:\projects\leveldb\bin\release\tmp\leveldb.lib[.drectve]' COFF2OMF: Ignoring unknown directive 'vc100-mt-1_56.lib" /DEFAULTLIB' in 'd:\projects\leveldb\bin\release\tmp\leveldb.lib[.drectve]' COFF2OMF: Ignoring unknown directive 'vc100-mt-1_56.lib" /DEFAULTLIB' in 'd:\projects\leveldb\bin\release\tmp\leveldb.lib[.drectve]' This lib does require some boost libs I have compiled, these libs do end with vc100-mt-1_56.lib. The look like libboost_chrono-vc100-mt-1_.56.lib So maybe the dash messing up coff2omf. the digitalmars site says you need to convert the coff format via link / lib /convert [lib]. Is this only for really old version of vs?
 link /lib /convert leveldb.lib
Microsoft (R) Library Manager Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved. LINK : warning LNK4044: unrecognized option '/convert'; ignored I have also tried objconv:
 objconv -fomf leveldb.lib leveldb_omf.lib
Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment ... Warning 1060: Different alignments specified for same segment, .data. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment ... Warning 1060: Different alignments specified for same segment, .data. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment .... Warning 1060 Input library: leveldb.lib, Format: COFF32, Output: leveldb_omf.lib, Format: OMF32 : Different alignments specified for same segment, .rdata. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment Warning 1060: Different alignments specified for same segment, .rdata. Using highest alignment Supressing further warning messages Error 2304: Word-size index exceeds 65535 Error 2304: Word-size index exceeds 65535 .... Supressing further warning messages objconv seems to work on the boost lib files but not leveldb.lib I tired messing tring to get dmc to compile boost, but there are tons of errors, to many to make me want to not go that path. So does anyone have a fool prof way of converting coff to omf libs. I feel like this use to be easy.. Thanks, -Byron
You can also look at http://www.agner.org/optimize/#objconv. I used it quite a long time ago to convert OMF libs to COFF (the opposite of what you need), and only for Win32. But it looks reasonably up-to-date and it claims to support both Win32/Win64. Rgds, Ettienne
Apr 10 2014
prev sibling parent "Gary Willoughby" <dev nomad.so> writes:
On Tuesday, 8 April 2014 at 17:23:14 UTC, Byron wrote:
 I have several libs compiled in vs2010 that I need to convert 
 to omf.
Try the coffimplib tool: http://forum.dlang.org/thread/dpaolp$1oek$1 digitaldaemon.com
Apr 10 2014