GNU bug report logs - #25914
Please document compilation of Windows Resource files

Previous Next

Package: libtool;

Reported by: Reuben Thomas <rrt <at> sc3d.org>

Date: Wed, 1 Mar 2017 13:00:02 UTC

Severity: normal

To reply to this bug, email your comments to 25914 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-libtool <at> gnu.org:
bug#25914; Package libtool. (Wed, 01 Mar 2017 13:00:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Reuben Thomas <rrt <at> sc3d.org>:
New bug report received and forwarded. Copy sent to bug-libtool <at> gnu.org. (Wed, 01 Mar 2017 13:00:03 GMT) Full text and rfc822 format available.

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

From: Reuben Thomas <rrt <at> sc3d.org>
To: bug-libtool <at> gnu.org
Subject: Please document compilation of Windows Resource files
Date: Wed, 1 Mar 2017 12:59:20 +0000
[Message part 1 (text/plain, inline)]
Please could you add something like Ralf Wildenheus's helpful Makefile rule
from

http://gnu-automake.7480.n7.nabble.com/correct-windres-use-td4889.html

to the libtool manual? At present I don't think it's possible to work out
how to compile Windows resource files without a lot of detective work.

As suggested by the last message in that thread, the following seems to
work:

.rc.lo:
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC)
$(RCFLAGS) $< -o $@

-- 
http://rrt.sc3d.org
[Message part 2 (text/html, inline)]

Information forwarded to bug-libtool <at> gnu.org:
bug#25914; Package libtool. (Mon, 09 Oct 2017 15:24:02 GMT) Full text and rfc822 format available.

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

From: Simon McVittie <smcv <at> collabora.com>
To: 25914 <at> debbugs.gnu.org
Cc: Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: Bug #25914: Please document compilation of Windows Resource files
Date: Mon, 9 Oct 2017 13:30:35 +0100
Reuben Thomas wrote:
> As suggested by the last message in that thread, the following seems to
> work:
>
> .rc.lo:
> $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC)
> $(RCFLAGS) $< -o $@

This came up during maintenance of dbus,
<https://bugs.freedesktop.org/show_bug.cgi?id=103015>. We have a resource
(versioninfo.rc) that we want to link into a libtool library, and also a
resource (disable-uac.rc) that we want to link into an executable.

For the libtool library, what Reuben said works: libtool knows how to
"compile" resource files into Libtool objects, but Automake does not
provide a .rc.lo implicit rule automatically, so we have to provide
our own. It wasn't clear to me whether this should result in an Automake
feature request (to provide such a rule automatically), or whether that
should be a Libtool feature request, or whether this is all working as
intended and users of this facility are expected to provide their own
implicit rule as Reuben did. For the moment we've done the same thing
Reuben suggested:

--------
SUFFIXES = .rc

.rc.lo:
	$(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $< -o $@

libdbus_1_la_SOURCES += versioninfo.rc
--------

For the executable, I found that I had to request compilation of a plain
object (.o) not a Libtool object (.lo), otherwise Automake 1.15.1
wouldn't realise that having $basename.rc in executable_SOURCES meant it
should include the corresponding $basename.o in executable_OBJECTS. This
worked with Debian's libtool 2.4.6-2 and Automake 1:1.15.1-3:

--------
SUFFIXES = .rc

.rc.o:
	$(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $< -o $@

nodist_dbus_update_activation_environment_SOURCES += disable-uac.rc
--------

However, another developer found that with an older libtool (openSUSE's
libtool 2.4.2-18.3.1 and automake 1.13.4-8.9), and that same make rule,
libtool/Automake would output the .o file in .libs/$basename.o but then
try to link $basename.o (without .libs) into the executable, causing a
build failure. Unfortunately, I wasn't able to find a git commit between
2.4.2 and 2.4.6 that looked like it fixed this. So we ended up with this
rule instead, using plain windres instead of libtool when linking the
resulting object into an executable:

--------
SUFFIXES = .rc

.rc.o:
	$(RC) $< -o $@

nodist_dbus_update_activation_environment_SOURCES += disable-uac.rc
--------

I would appreciate feedback from libtool developers on how much of this is
working as intended, and how much of it is a bug in either Automake or
libtool.

Thanks,
    smcv




Information forwarded to bug-libtool <at> gnu.org:
bug#25914; Package libtool. (Mon, 09 Oct 2017 18:04:02 GMT) Full text and rfc822 format available.

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

From: Bob Friesenhahn <bfriesen <at> simple.dallas.tx.us>
To: Simon McVittie <smcv <at> collabora.com>
Cc: 25914 <at> debbugs.gnu.org, bug-libtool <at> gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: bug#25914: Bug #25914: Please document compilation of Windows
 Resource files
Date: Mon, 9 Oct 2017 13:03:23 -0500 (CDT)
On Mon, 9 Oct 2017, Simon McVittie wrote:
>
> I would appreciate feedback from libtool developers on how much of this is
> working as intended, and how much of it is a bug in either Automake or
> libtool.

A quick guess is that GNU make is being used and it applies built-in 
rules for this if the Makefile does not provide its own rule.  A later 
Automake may be blocking out built-in rules for targets Automake does 
not support in order to improve performance.

Bob
-- 
Bob Friesenhahn
bfriesen <at> simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/




Information forwarded to bug-libtool <at> gnu.org:
bug#25914; Package libtool. (Mon, 09 Oct 2017 18:04:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-libtool <at> gnu.org:
bug#25914; Package libtool. (Tue, 10 Oct 2017 16:33:02 GMT) Full text and rfc822 format available.

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

From: Bob Friesenhahn <bfriesen <at> simple.dallas.tx.us>
To: Simon McVittie <smcv <at> collabora.com>
Cc: 25914 <at> debbugs.gnu.org, bug-libtool <at> gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: bug#25914: Bug #25914: Please document compilation of Windows
 Resource files
Date: Tue, 10 Oct 2017 11:32:25 -0500 (CDT)
On Tue, 10 Oct 2017, Simon McVittie wrote:
>
> After invoking LT_LANG([Windows Resource]) in configure.ac, is the
> Automake-generated build system meant to support compiling .rc files to
> .lo and/or .o? I would expect that it should, but perhaps that expectation
> is wrong?

I do not see any described support for Windows resource files in the 
Automake manual at 
https://www.gnu.org/software/automake/manual/automake.html or the 
Autoconf manual at 
https://www.gnu.org/software/autoconf/manual/autoconf.html.

What causes you to believe that there is support for a 'Windows 
Resource' language or specific support for Windows resource files?

The good news is that specific support is not required since it is 
easy to add additional tests to configure scripts and additional rules 
to Automake makefiles.

Bob
-- 
Bob Friesenhahn
bfriesen <at> simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/




Information forwarded to bug-libtool <at> gnu.org:
bug#25914; Package libtool. (Tue, 10 Oct 2017 16:33:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-libtool <at> gnu.org:
bug#25914; Package libtool. (Tue, 10 Oct 2017 16:35:02 GMT) Full text and rfc822 format available.

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

From: Simon McVittie <smcv <at> collabora.com>
To: Bob Friesenhahn <bfriesen <at> simple.dallas.tx.us>
Cc: 25914 <at> debbugs.gnu.org, bug-libtool <at> gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: bug#25914: Bug #25914: Please document compilation of Windows
 Resource files
Date: Tue, 10 Oct 2017 16:35:36 +0100
On Mon, 09 Oct 2017 at 13:03:23 -0500, Bob Friesenhahn wrote:
> > I would appreciate feedback from libtool developers on how much of this is
> > working as intended, and how much of it is a bug in either Automake or
> > libtool.
> 
> A quick guess is that GNU make is being used

Yes, it is (at least on my side, not sure about my dbus co-maintainer).

> and it applies built-in rules
> for this if the Makefile does not provide its own rule

My make (GNU Make 4.1-9.1 as distributed by Debian) doesn't seem to have
anything built-in for .rc files - at least, strings(1) shows me the rules
I'd expect to be built in (.c, .cc and so on) but doesn't mention .rc.

> A later Automake
> may be blocking out built-in rules for targets Automake does not support in
> order to improve performance.

After invoking LT_LANG([Windows Resource]) in configure.ac, is the
Automake-generated build system meant to support compiling .rc files to
.lo and/or .o? I would expect that it should, but perhaps that expectation
is wrong?

Thanks,
    smcv




Information forwarded to bug-libtool <at> gnu.org:
bug#25914; Package libtool. (Tue, 10 Oct 2017 16:35:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-libtool <at> gnu.org:
bug#25914; Package libtool. (Tue, 10 Oct 2017 17:23:02 GMT) Full text and rfc822 format available.

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

From: Simon McVittie <smcv <at> collabora.com>
To: Bob Friesenhahn <bfriesen <at> simple.dallas.tx.us>
Cc: 25914 <at> debbugs.gnu.org, bug-libtool <at> gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: bug#25914: Bug #25914: Please document compilation of Windows
 Resource files
Date: Tue, 10 Oct 2017 18:22:22 +0100
On Tue, 10 Oct 2017 at 11:32:25 -0500, Bob Friesenhahn wrote:
> On Tue, 10 Oct 2017, Simon McVittie wrote:
> > 
> > After invoking LT_LANG([Windows Resource]) in configure.ac, is the
> > Automake-generated build system meant to support compiling .rc files to
> > .lo and/or .o? I would expect that it should, but perhaps that expectation
> > is wrong?
> 
> What causes you to believe that there is support for a 'Windows Resource'
> language or specific support for Windows resource files?

`info libtool "Tags"` describes them as a language that libtool supports
for the LT_LANG macro, alongside (in the version I'm using) C, C++,
Java, Fortran and Go. LT_LANG([Windows Resource]) does check for a
resource compiler named i686-w64-mingw32-windres or similar, and puts
it in the output variable RC; it's the intended steps after that that
are less clear.

> The good news is that specific support is not required since it is easy to
> add additional tests to configure scripts and additional rules to Automake
> makefiles.

The bug that I'm replying to (#25914) is a libtool enhancement request
asking for the way this is meant to work to be documented (including
whether it is meant to involve adding additional rules, and if so, what
those rules should typically be).

I am not a Windows developer (although I co-maintain dbus, which is
portable to Windows) so unfortunately I don't have a correct answer for
that, only anecdotal evidence based on what did and didn't work in dbus.

    smcv




Information forwarded to bug-libtool <at> gnu.org:
bug#25914; Package libtool. (Tue, 10 Oct 2017 17:23:02 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 249 days ago.

Previous Next


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