Make it easier to cross-compile gpg-error
Closed, WontfixPublic


It's currently not possible to cross-compile libgpg-error without having built it natively at least once , to create /src/syscfg/lock-obj-pub.$ARCHITECTURE.h.

It would be nice if we could avoid this bootstrapping step.

Over on, Steven Capper asks:

So going through this my understanding is that for Linux this library
creates weak references to the pthread_mutex_ functions as well as
simulates the size of the pthread_mutex_t type. IIUC this obviates the
need to cross-compile against pthreads. When one loads the library,
the weak references will be overridden by the C library and, providing
the data type is the same as simulated, should operate as one is using

If the simulated data type does not match the system implementation, I
am not sure what behaviour will manifest.

I don't understand why one cannot cross-compile a library that makes
use of pthreads directly though? Was this weak function/type
simulation workaround needed for a bug in the past that has since been

Have we missed something obvious?

If this is something that simply isn't architecturally possible, it'd be great to have an explanation for that.

Otherwise, if this is a transition that the GnuPG team would be fine with, but hasn't had the time to prioritize, perhaps this could be marked as such here, and any interested parties could propose a simplification of the codebase for further review.


dkg created this task.Jul 16 2019, 11:18 PM
werner closed this task as Wontfix.Jul 17 2019, 12:12 PM
werner claimed this task.
werner added a subscriber: werner.

In fact this specific scheme of indirect access to pthread objects is there to minimize dependencies of libgpg-error. It makes cross-compiling a bit harder but that is anyway the case because you need to check a lot of things for a new platform.

dkg added a comment.Jul 17 2019, 7:05 PM

Thanks for the feedback. I'll go ahead and close any tickets that come in via debian that expect to be able to cross compile without having at least once had a native compiler on the platform to generate the appropriate lock-obj-pub-*.h.