cstatic-librariescpu-architecturegmpdumpbin

dumpbin reporting wrong target architecture for a static library


I don't understand why dumpbin is returning x64 when executing the following on the Visual Studio command line:

dumpbin libgmp.lib /HEADERS |more

This is the GMP library compiled under Cygwin 32bit version, with the following build configuration:

./configure --host=i386 ABI=32

The build system compiled and built all the files successfully for the specified host. Yet, dumpbin still reports that the .a or .lib is for 64bit architectures.

Note that the output static library is libgmp.a, but I changed its extension to .lib and linked it with my Visual Studio project with no problems.

Another important note: Linking libgmp.lib with 32bit programs is fine, and produces a PE32 file, as reported by CFF Explorer.

Is it a dumpbin interpretation error, or am I missing something improtant?


Solution

  • It appears that there are no 64bit or 32bit static library types. After performing some assertions on the library using objdump and dumpbin, both were reporting correct information.

    objdump reported some of the object files to be 64bit and the others 32bits. dumpbin did the same thing.

    The problem boils out from the GMP build system; It embedded both 64bit and 32bit object files into the static library.

    Your program will link correctly to 32bit applications as long as you don't use any facilities found in one of the 64bit object files, which explains CFF's output.

    In order to fix this problem, you must contact the GMP website.