[PATCH, v3] Potential solution to librt issue.

Paolo Carlini paolo.carlini@oracle.com
Fri Jul 25 11:57:00 GMT 2008


Hi,

so, just a small summary of the current "basic" scheme ("basic" in the sense that doesn't involve any weakref tricks, system_clock::now moved inline, in short, the first one figured out yesterday). Maybe someone, me, Chris, can find it useful.

Paolo, please double check, if you can:

1- In libstdc++/acinclude.m4 we need an AC_SEARCH_LIBS(clock_gettime, [rt posix4]) in any case, for the TRY_LINK check proper. Also, in case we have posix4, we can safely add it to GLIBCXX_LIBS and link it unconditionally, no problems with pthread.

2- Of course, we need Paolo's patch for the compiler. It adds the --as-needed magic, but, AFAICS, only for linux targets. That means, other targets (ie, those targets not using -lposix4 and actually requiring -lrt for the clocks) will incur in link time fails when user code references system_clock::now.

3- Note: now that I'm thinking more about these issues with a fresh mind, I'm not sure that playing weakref tricks in chrono.cc and have *run-time* fails would be that good. Only, we would really like to have a mechanism to tell the user *which* library is missing when linking fails. Also, I still don't like adding stuff inline in <chrono>, you know already, but probably we have to live with that for a while...

Paolo.



More information about the Gcc-patches mailing list