[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#11834: supporting MSVC compiler in "make install"
From: |
Bruno Haible |
Subject: |
bug#11834: supporting MSVC compiler in "make install" |
Date: |
Sun, 01 Jul 2012 21:09:33 +0200 |
User-agent: |
KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; ) |
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
Description: application/bzip-compressed-tar
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#11834: supporting MSVC compiler in "make install",
Bruno Haible <=