Tcl Source Code

View Ticket
Login
Ticket UUID: f20bee173b6698084299a75d68f2aa384e68e78c
Title: configure script using tclconfig doesn't honor LDFLAGS on configure run
Type: Bug Version: github master
Submitter: stephanm Created on: 2020-01-31 18:34:01
Subsystem: 85. tclconfig Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2020-02-12 16:12:24
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2020-02-12 16:12:24
Description:
While running configure, the final linking step fails because additional linker flags from LDFLAGS are ignored. This seems to be introduced by commit 99966fe (tclconfig github mirror, Jan 6 2020 by  jan.nijtmans). This effectively breaks cross-compilation in my case. I'm using ubuntu disco but this shouldn't really matter.
Thank you for any information!
User Comments: stephanm added on 2020-02-12 15:35:51:
Thank you, compilation works now with the current (f34df7f998) fossil checkout!

jan.nijtmans added on 2020-02-11 11:22:19:
This ticket should be fixed now, in
latest tclconfig/thread/sampleextension/tdbc

Please confirm (or not) that it works for you too, so I can close this ticket.

jan.nijtmans added on 2020-02-05 09:56:54:
Thanks! Yes, that makes the situation clear, I see the problem now!

I'll have a look at it.

stephanm added on 2020-02-04 18:25:47:
After some debugging, I determined that cross-compiling for windows using mingw seems to be the culprit. 
When SHLIB_LD gets set in TEA_CONFIG_CFLAGS, LDFLAGS aren't used as in e.g. the linux case.
So I basically used the linux variant but I had to patch TEA_ENABLE_SYMBOLS to use LDFLAGS for windows + gcc.
Attached is a really small patch that at least fixes my example from above. It would be nice if it could be integrated into tclconfig.
Thanks you!

stephanm added on 2020-02-04 13:43:56:
Sorry, it could easily be an error on my side as I am not that familiar with tclconfig. And indeed, I got the history wrong, please ignore my last comment about the assumed commit id.

I'm using tcl 8.6.10, cross-built, nothing fancy (./configure --prefix=/tmp/tcl8.6.10 --host=i686-w64-mingw32 && make install). Host is ubuntu disco, target is Windows (32 bit).

Steps to reproduce:
1) Checkout sampleextension, cd into it and checkout tclconfig (both current github master)
2) autoreconf -fi 
3) LDFLAGS="-Ltestpath" ./configure --with-tcl=/tmp/tcl8.6.10/lib --host=i686-w64-mingw32
4) make
5) Linking call is "i686-w64-mingw32-gcc -shared -o sample05.dll sample.o tclsample.o  "/tmp/tcl8.6.10/lib/libtclstub86.a" -static-libgcc ", missing the -Ltestpath parameter.

jan.nijtmans added on 2020-02-02 16:23:56: (text/x-fossil-wiki)
Apparently, you are referring to fossil commit [68a2eea8733390e6].

So how can the addition of $LDFLAGS cause that LDFLAGS is ignored???

I'm not able to reproduce this, not knowing which Makefile you are using, which version of Tcl, which extension you are compiling, which environment (host and cross).   So, please, add more information here to help me.

My guess is that your Makefile lacks $LDFLAGS somewhere

Attachments: