GNU bug report logs - #11834
supporting MSVC compiler in "make install"

Previous Next

Package: automake;

Reported by: Bruno Haible <bruno <at> clisp.org>

Date: Sun, 1 Jul 2012 19:12:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 11834 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-automake <at> gnu.org:
bug#11834; Package automake. (Sun, 01 Jul 2012 19:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bruno Haible <bruno <at> clisp.org>:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Sun, 01 Jul 2012 19:12:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bruno Haible <bruno <at> clisp.org>
To: bug-automake <at> gnu.org
Subject: supporting MSVC compiler in "make install"
Date: Sun, 01 Jul 2012 21:09:33 +0200
[Message part 1 (text/plain, inline)]
Hi,

With the 'compile' and 'ar-lib' scripts being present in Automake 1.12,
it is now possible to build programs with Microsoft Visual C/C++ (MSVC) 9.0.
But in some cases the program that gets installed by "make install" does
not work.

How to reproduce: In a Cygwin environment, unpack the attached
hello-c++-0.tar.bz2 file.


$ tar xvf hello-c++-0.tar
$ cd hello-c++-0

$ PATH=/usr/local/msvc/bin:$PATH
$ export PATH

$ win32_target=_WIN32_WINNT_WINXP   # for MSVC 9.0

$ ./configure --host=i586-pc-mingw32 --prefix=/usr/local/msvc \
        CC="`pwd`/build-aux/compile cl -nologo" \
        CFLAGS="-MD" \
        CXX="`pwd`/build-aux/compile cl -nologo" \
        CXXFLAGS="-MD" \
        CPPFLAGS="-D_WIN32_WINNT=$win32_target -I/usr/local/msvc/include" \
        LDFLAGS="-L/usr/local/msvc/lib" \
        LD="link" \
        NM="dumpbin -symbols" \
        STRIP=":" \
        AR="`pwd`/build-aux/ar-lib lib" \
        RANLIB=":"
$ make
...
/home/bruno/hello-c++-0/build-aux/compile cl -nologo  -MD  -L/usr/local/msvc/lib -o hello.exe hello.obj
$ ls -l 
total 288
-rw-r--r--  1 bruno Kein    241 Jun 28  2009 INSTALL
-rw-r--r--  1 bruno Kein  20930 Jul  1 19:54 Makefile
-rw-r--r--  1 bruno Kein    281 Jul  1 19:53 Makefile.am
-rw-r--r--  1 bruno Kein  20505 Jul  1 19:53 Makefile.in
-rw-r--r--  1 bruno Kein  35135 Jul  1 19:50 aclocal.m4
drwxr-xr-x+ 2 bruno Kein      0 Jul  1 19:53 build-aux
-rw-r--r--  1 bruno Kein  10679 Jul  1 19:54 config.log
-rwxr-xr-x  1 bruno Kein  29781 Jul  1 19:54 config.status
-rwxr-xr-x  1 bruno Kein 127601 Jul  1 19:50 configure
-rw-r--r--  1 bruno Kein    155 Jul  1 19:47 configure.ac
-rw-r--r--  1 bruno Kein    338 Jul  1 19:55 hello.cc
-rwxr-xr-x  1 bruno Kein   8192 Jul  1 19:55 hello.exe
-rwxr-xr-x  1 bruno Kein    616 Jul  1 19:55 hello.exe.manifest
-rwxr-xr-x  1 bruno Kein  12854 Jul  1 19:55 hello.obj

You can see that the program has been built correctly:
$ ./hello.exe
Hello, world!

Now install it:
$ make install
make[1]: Entering directory `/home/bruno/hello-c++-0'
 /usr/bin/mkdir -p '/usr/local/msvc/bin'
  /usr/bin/install -c hello.exe '/usr/local/msvc/bin'
make[1]: Nothing to be done for `install-data-am'.
make[1]: Leaving directory `/home/bruno/hello-c++-0'

$ /usr/local/msvc/bin/hello.exe
Error dialog:
Microsoft Visual C++ Runtime Library
Runtime Error!
Program: C:\cygwin\usr\local\msvc\bin\hello.exe
R6034
An application has made an attempt to load the C runtime library incorrectly.
Please contact the application's support team for more information.

$ cp -p hello.exe.manifest /usr/local/msvc/bin/
$ /usr/local/msvc/bin/hello.exe
Hello, world!


Conclusion: When the MSVC compiler has not only created PROGRAM.exe but
also PROGRAM.exe.manifest, it is necessary to copy PROGRAM.exe.manifest
alongside with PROGRAM.exe. (It also has to have the execution permission
set, otherwise the execution fails.)

I think this ought to be fixed as follows:
  1) Modify install-sh so that when installing with a mode with execution
     permissions (-m 755 or so), it looks for a manifest file and copies
     it as well if present.
  2) Since the 'install' program from the host environment (Cygwin in this
     case) cannot be expected to include this support, it is also necessary
     to change the autoconf test that determines INSTALL_PROGRAM so that
     it refers to install-sh instead of /usr/bin/install.

If done this way:
  - Package authors will not have to modify their Makefile.am files for
    supporting "make install" with this compiler.
  - Packages that use 'install-sh' but not Automake will also profit from
    the change. Such as the 'gperf' package.

Does this approach sound right to you? If you approve, I may find the time
to provide a patch.

Bruno

PS: I don't see the 'msvc' branch in
    http://git.savannah.gnu.org/gitweb/?p=automake.git;a=summary
    any more. Was it deleted?
[hello-c++-0.tar.bz2 (application/x-bzip-compressed-tar, attachment)]

Severity set to 'wishlist' from 'normal' Request was from Stefano Lattarini <stefano.lattarini <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 26 Dec 2013 11:32:01 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 174 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.