On 2013-11-13 11:43:06, Laurent Bigonville wrote: > > > > > OK for what I understood, the A(C)X_PTHREAD is setting the > > > > > -pthread flag (not the absence of "l") in PTHREAD_CFLAGS and > > > > > relies on gcc to do the correct thing(tm) when this flag is > > > > > set, this works the cases where the CFLAGS are also passed at > > > > > the linking time (autofoo are doing that). > > > > > > > > > > If a pkg that link against check FTBFS this need to be checked. > > > > > > > > > > I feel that this bug should be fixed now and could be closed, > > > > > all rdeps seems to compile now > > > > > > > > I don't think this bug can be closed. pkg-config check --libs > > > > still doesn't include -pthread which it should. -pthread needs to > > > > in both Cflags and Libs in check's pkgconfig file. > > > > > > The ax_pthread macro upstream thinks otherwise, see: > > > https://savannah.gnu.org/patch/?8081 > > > > > > But I can admit, I've not seen a lot of projects doing it that way. > > > > > > If I understood correctly, -pthread should automatically make gcc > > > link against libpthread. So as said the CFLAGS should also be > > > passed to gcc at linking time, in that case explicit -lpthread flag > > > seems redundant. > > > > Of course, passing -pthread to gcc during link time does the right > > thing. I would still expect to get -pthread (not -lpthread) from > > `pkg-config check --libs`. My understanding of --libs is that it's > > supposed to give the required linking flags. In the case of check, > > -pthread is required while linking, but is not included in the output > > of --libs. > > Well -pthread is a compiler flag, not the libpthread library, so IMHO > it makes sense to assign it to the CFLAGS and not to the LIBS > > Like I said, automake also seems to add the CFLAGS at the linking time > (in addition to the LDFLAGS and LIBS), > > The description of the a(c)x_pthread macro is clear about this: > > # NOTE: You are assumed to not only compile your program with these > flags, # but also link it with them as well. e.g. you should link with > # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS > # > # If you are only building threads programs, you may wish to use these > # variables in your default LIBS, CFLAGS, and CC: > # > # LIBS="$PTHREAD_LIBS $LIBS" > # CFLAGS="$CFLAGS $PTHREAD_CFLAGS" > # CC="$PTHREAD_CC"
Yes, okay, it's great that the macro does the right thing for autofoo. It's also written for autofoo. But that doesn't make the pkgconfig file correct for anything else. Unless a simple $ gcc -c $(pkg-config --cflags check) test.c -o test.o $ gcc test.o -o test $(pkg-config --libs check) does not work, the pkgconfig file is broken (which is the original problem reported in #712140). There are also packages that seem to FTBFS because of this (#713575 for example). (Also note that other libraries that require one to use -pthread have it in both Cflags and Libs (or Libs.private) in the pkgconfig file - examples of these include gmodule-2.0.pc, OpenIPMIpthread.pc, fuse.pc, librtaudio.pc and swipl.pc.) Regards -- Sebastian Ramacher
signature.asc
Description: Digital signature