On 3/5/22 09:11, Lars Ingebrigtsen wrote: > $(AM_V_at)$(CC) -shared $(CPPFLAGS) $(MODULE_CFLAGS) $(LDFLAGS) \ > -o $@ $< $(LIBGMP) \ > + ../lib/libgnu.a \ Unfortunately that won't work in general; the comment for mod-test.so says "In the compilation command, we can't use any object or archive file as source because those are not compiled with -fPIC" but as things stood mod-test.so was being linked with libgnu.a. Anyway, mod-test.so should be decoupled from Emacs as much as possible - that's the whole point of modules after all - so the mod-test.so rule shouldn't make assumptions about how Emacs internals use Gnulib. I installed the attached patches to lessen the coupling between mod-test.so and Emacs internals and I hope this fixes the problem. It may need to be adjusted a tad for platforms that lack nanosleep/clock_gettime/libgmp whatever, but the basic idea should work on these platforms with only minor twiddling. Even with these patches, mod-test.so uses "config.h"; but at least it doesn't use Gnulib code.