[tlbuild] TeX Live builds -- second summary

Ken Brown kbrow1i at gmail.com
Tue May 5 20:00:42 CEST 2009


On 5/5/2009 11:21 AM, Peter Breitenlohner wrote:
> We might want to learn how to do this under Cygwin, first for a small
> test program and without Libtool (Libtool has a tendency to reshuffle the
> arguments). Once we know that we can certainly extend the present macros 
> (in
> kpse-cxx-hack.m4) accordingly.

Hi Peter,

I think it can be done.  According to the documentation that I quoted in 
http://tug.org/pipermail/tlbuild/2009q2/000590.html, we need to give g++ 
the flags -static -static-libgcc.  Here are my tests:

$ cat test.cc
#include <iostream>
using namespace std;
int
main ()
{
cout <<"worksok\n";
   ;
   return 0;
}

Here's what happens without the static flags:

$ g++-4 -o test.exe test.cc -lstdc++
Info: resolving std::cout  by linking to __imp___ZSt4cout (auto-import)
/usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../i686-pc-cygwin/bin/ld: 
warning: auto-importing has been activated without --enable-auto-import 
specified on the command line.
This should work unless it involves constant data structures referencing 
symbols from auto-imported DLLs.
$ ./test.exe
worksok
$ cygcheck ./test.exe
D:\cygwin-1.7\home\kbrown\test.exe
   D:\cygwin-1.7\bin\cygwin1.dll
     C:\WINDOWS\system32\ADVAPI32.DLL
       C:\WINDOWS\system32\KERNEL32.dll
         C:\WINDOWS\system32\ntdll.dll
       C:\WINDOWS\system32\RPCRT4.dll
         C:\WINDOWS\system32\Secur32.dll
   D:\cygwin-1.7\bin\cyggcc_s-1.dll
   D:\cygwin-1.7\bin\cygstdc++-6.dll

So we got dynamic linking.  Now add the flags:

$ g++-4 -static -static-libgcc -o test.exe test.cc -lstdc++
$ ./test.exe
worksok
$ cygcheck ./test.exe
D:\cygwin-1.7\home\kbrown\test.exe
   D:\cygwin-1.7\bin\cygwin1.dll
     C:\WINDOWS\system32\ADVAPI32.DLL
       C:\WINDOWS\system32\KERNEL32.dll
         C:\WINDOWS\system32\ntdll.dll
       C:\WINDOWS\system32\RPCRT4.dll
         C:\WINDOWS\system32\Secur32.dll

Static linking!

Does this give you enough to work with?

Regards,

Ken



More information about the tlbuild mailing list