libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

different linker parameters from similar Makefiles when building MSVC DL


From: Dave Cottlehuber
Subject: different linker parameters from similar Makefiles when building MSVC DLLs in cygwin (with erlang wrappers)
Date: Tue, 28 Jun 2011 23:47:21 +1200

Hi libtoolers,

I am building 2 Win32 DLLs to be loaded into the erlang runtime VM as NIFs,
based on snappy (mixed C & C++) and ejson/yajl (in C), all part of porting
latest CouchDB trunk to Windows - config is at [8].

They use a similar Makefile.am [2],[3] and share configure.ac [1], but during
compile & linking ejson succeeds [7] and snappy doesn't [6], despite the
Makefiles being almost identical.

There are 2 errors reported;
- output filename is specified twice & therefore fails

        LINK : fatal error LNK1149: output filename matches input
filename 'C:\cygwin\relax\git_couch\src\snappy\.libs\snappy_nif.dll'

- libtool adds unwanted flags, instead of -DLL (per working build)

        LINK : warning LNK4044: unrecognized option '/shared'; ignored
        LINK : warning LNK4044: unrecognized option '/nostdlib'; ignored
        LINK : warning LNK4044: unrecognized option
'/-enable-auto-image-base'; ignored
        LINK : warning LNK4044: unrecognized option '/Xlinker'; ignored
        LINK : warning LNK4044: unrecognized option '/-out-implib'; ignored
        LINK : warning LNK4044: unrecognized option '/Xlinker'; ignored

Only the final link phases differ materially in the parameters passed. If [7] is
manually run with these changes, bringing it into line with [6], it works:

    - remove '-Xlinker --out-implib -Xlinker \$lib'
    - swap '-shared -nostdlib' ' for '-dll'

When libtool is hacked up [4], I can get a cleanish link [5] but this clearly
isn't the Right Thing To Do.

What do I need to change, to ensure libtool passes the linker the same options
in both DLLs? What am I missing?

Finally, given we are using these makefiles/configure.ac on multiple platforms
have you got any other suggestions to improve things?

Files
=====
[1]: https://github.com/dch/couchdb/blob/COUCHDB-1197/configure.ac
[2]: https://github.com/dch/couchdb/blob/COUCHDB-1197/src/ejson/Makefile.am
[3]: https://github.com/dch/couchdb/blob/COUCHDB-1197/src/snappy/Makefile.am
[4]: https://www.dropbox.com/s/nrs7bq5ho4m31ji

Logs
====
[5]: snappy building on hacked libtool:
http://friendpaste.com/6PgtwcRnMWzGm1vEcQAcEV
[6]: snappy failing with std libtool:
http://friendpaste.com/2pT57H8oBV7v9t51jujPhX
[7]: ejson building with std libtool:
http://friendpaste.com/2YVQoTrFlU6bwaEqX8qSdP

[8]: Configuration
libtool  (GNU libtool)  2.4
autoconf (GNU Autoconf) 2.68
automake (GNU automake) 1.11.1

Windows 7 Enterprise, x64
MS visual studio 2008 express
MS Windows SDK 7.0
Erlang R14B03

Lastly, thanks for the many years of effort that have gone into libtool.

A+
Dave



reply via email to

[Prev in Thread] Current Thread [Next in Thread]