Opened 5 years ago

Closed 4 years ago

#49160 closed defect (worksforme)

base fails to build with -flto

Reported by: RJVB (René Bertin) Owned by: macports-tickets@…
Priority: Low Milestone:
Component: base Version:
Keywords: Cc: macports-mgr@…

Description (last modified by ryandesign (Ryan Schmidt))

A bug report that has a considerable FYI factor:

Using -flto in the CFLAGS when building MacPorts base or port:MacPorts leads to a build error in tcl8.5.15 because the (missing) pthread_np.h header file is (inappropriately) included. That's a Unix/Linux-specific file, so it seems the platform detection went wrong configuring tcl.

That appears to be because of the test for the availability of the pthread*_np functions succeeds because the link-optimiser suppresses the actual symbol tested for from the test app. Looking at the test code this appears to be something any good optimiser would (or could) do; after cleanup the test "payload" looks like this:

        char pthread_getattr_np();
        char (*f)() = pthread_getattr_np();
        return f != pthread_getattr_np;

In other words, the main function should always return true, the actual value of the variable (including "undefined") is moot for the test result.

I'm aware that this is not a MacPorts bug but an issue in the Tcl build system. I'm reporting it here though because it occurs in a possibly customised Tcl version ... and I'm hoping at least one "base" developer already has a Tcl bug reporter account.

Change History (2)

comment:2 Changed 5 years ago by ryandesign (Ryan Schmidt)

Description: modified (diff)
Port: MacPorts removed
Priority: NormalLow
Summary: [FWIW] "base" and port:MacPorts fail to build with -fltobase fails to build with -flto

As far as I know, the version of tcl bundled with MacPorts is stock, with no modifications.

You should report the bug to the developers of Tcl, because you are the one experiencing the problem.

comment:3 Changed 4 years ago by raimue (Rainer Müller)

Resolution: worksforme
Status: newclosed

We are not using -flto in our default build flags.

Note: See TracTickets for help on using tickets.