4

I'm either failing hard at Google today, or this is something which is non-trivial.

I have an application that I am working on for a Windows system, cross-compiling from Linux because (a) I need C99 and Microsoft's free tools for the target system does not support it and (b) I've been using UNIX for nearly 30 years anyway, and that's my "home". Changing to an MSVC stack with "native" building is not an option for me, nor is running the GNU build system on Windows (it takes forever).

The problem is that I need to have a single tool built for the system being compiled on and not the target; I need to then run that executable which will generate several .c source files and .h headers which then enable the project to compile. I am using the so-called "GNU Build System" (that is, the autotools, including autoconf/automake/libtool).

Any recipe I write will, regardless if I configure for i686-w64-mingw32 or x86_64-w64-mingw32, compile all DLLs and EXEs for the Win32/Win64 platform.

There is a way that I can force the issue by hand-crafting standard Makefile receipes, but I was trying to find an "autotools native" way of compiling and running build-time executables that are not e.g., unit tests, but source code generators.

Any ideas, short of hand-crafting Makefile recipes?

ETA: Additionally, the project is cross-platform: it does make sense to compile this one natively for Linux as well, so any solution needs to work just as well when not cross-compiling.

Michael Trausch
  • 3,187
  • 1
  • 21
  • 29
  • There was a post about this on the automake mailing list (http://lists.gnu.org/archive/html/automake/2014-01/msg00006.html) which may be useful. – Gavin Smith Sep 05 '14 at 15:54
  • Looking at the linked macro and will see if that helps. Thanks! – Michael Trausch Sep 05 '14 at 16:16
  • @RossRidge --- please limit your comments to your knowledge domain. x86_64-w64-mingw32 is the 64-bit toolchain and i686-w64-mingw32 is the 32-bit toolchain. Also, I'm asking about build tools not target output --- I have the target EXEs and DLLs (both 32-bit and 64-bit) working just fine. Right now, I have files I need to be *generated* at **compile-time**, instead of keeping them in-sync with external content manually. What part of the question is unclear? Exact quote: `The problem is that I need to have a single tool built **for the system being compiled on** and not the target`. – Michael Trausch Sep 05 '14 at 16:23
  • Sorry for bothering you then. – Ross Ridge Sep 05 '14 at 16:28
  • @RossRidge No bother. Just trying to point out that you did not read the question, and that's not helpful. Nothing personal. – Michael Trausch Sep 05 '14 at 16:31
  • I did read your post, it doesn't make it clear that your "single tool" is being built incorrectly as an Windows executable. It's not obvious that "all DLLs and EXEs" includes the clearly non-EXE tool mentioned in the previous paragraph. – Ross Ridge Sep 05 '14 at 16:58
  • @RossRidge Please then re-read the first sentence in para 3 and let me know how that isn't quite clear---if there is a problem, I'd love to correct it. However, I just don't see it. The question states that I am building on Linux, for Windows, which means that Linux is "the system being compiled on" and Windows is the "target", unless I'm really failing horribly at English today, which is indeed possible. – Michael Trausch Sep 05 '14 at 18:07
  • That paragraph doesn't actually describe a problem. You say what you need to happen but it doesn't actually say that something else happens instead. Only with the next paragraph do you suggest something happens that you don't want to happen, but it's not clearly connected to the previous paragraph. You never clearly state that the "single tool" is building incorrectly, only that you have some problem related to it. Maybe the generated files cause compile errors with the target compiler, or maybe the build compiler is being used on them instead. – Ross Ridge Sep 05 '14 at 18:39
  • @RossRidge So, what does "... compile all DLLs and EXEs for Win32/Win64" mean to *you*? Because clearly what I'm wanting to do is have ELF binaries and not EXEs or DLLs. Alright, so I *could* configure my kernel to enable `binfmt_misc` and just use Wine to run the build-helpers I need, but that's only possible on workstations where I have `root` and therefore unacceptable. Seems to me you just aren't aware of what I'm asking here, and therefore do not understand the problem. Not a big deal, but we're back to "please limit your comments to your knowledge domain," aren't we? – Michael Trausch Sep 05 '14 at 22:15
  • Obviously I didn't understand your problem. That's because you didn't express yourself well. I wouldn't call an Linux ELF binary an EXE, and I wouldn't call something I want to be an Linux ELF binary an EXE. I interpreted that statement as saying everything that is supposed to have an .EXE and .DLL extension was compiled for Win32/Win64. When you choose to seperate out that sentence into it's own paragraph, you disconnected from the previous paragraph and didn't give anything to connect it back. – Ross Ridge Sep 05 '14 at 22:26
  • I wasn't calling an ELF binary EXE. It is quite apparent to me that this is not your area of focus. I was very clear to distinguish "host" and "target" and to be exact in specifying that the result of all recipes is currently a DLL or EXE when cross-compiling, despite wanting "a single tool built for the system being compiled on and not the target". As it is clear you're lacking in understanding, I am not responding to you any further, this accomplishes nothing. At least one professional here understood the problem quite well, and you've yet to answer my query as to where I've lacked. – Michael Trausch Sep 05 '14 at 22:30
  • For that matter if you feel that strongly, flag the post already. I'm done. – Michael Trausch Sep 05 '14 at 22:31
  • As for your "please limit your comments to your knowledge domain" comment, if I didn't respond to posts that were outside my "knowledge domain" I'd have 4000 less reputation, and about 100 fewer people here would have answers. If you don't like people making guessing at your meaning, stabs in the dark or other speculation in comments, you've come to the wrong place. Find somewhere else to ask your questions you're too lazy answer yourself. – Ross Ridge Sep 05 '14 at 22:32
  • Or too lazy to Google yourself: http://stackoverflow.com/questions/24201260/autotools-cross-compilation-and-generated-sources – Ross Ridge Sep 05 '14 at 22:50

0 Answers0