Re: Overriding of Perl compilation flags for non-default compiler

Bruno Haible via Bug reports for the GNU Texinfo documentation system <[email protected]>
Newsgroups gmane.comp.tex.texinfo.bugs
Organization GNU
Message-ID <4714039.4PAe9RTHqG@nimes>
Hi Gavin,

Back to the "texinfo-7.2.90 on Solaris 10" thread:
> > I am not surprised (this is for makeinfo/texi2any only, not for the Info
> > reader).  For Perl C and to have consistent link and compile flags, we
> > now use the Perl flags for all the libraries and executables.  Therefore
> > it has become difficult to modify the flags or the compiler.  Note,
> > however, that using a different compiler (and different flags) than the
> > one used to build Perl was not supposed to work since a long time,
> > according to Perl documentation, although it worked in practice on some
> > platforms.
> 
> I suppose it would still be possible to try building with different compiler
> flags if the user checks which Makefile variables are being used, and overrides
> them from the command line.  For example, they can run
> make 'perl_conf_LIB_LDFLAGS=...' and so on.  So it is not completely impossible
> to try to build with a different C compiler than that specified by "perl -V",
> just requires a lot of investigation into Makefile internals.
> 
> I don't see a need at present to try to make this easier (e.g. by
> documenting perl_conf_LIB_LDFLAGS etc. as user-modifiable, alike to CC,
> CFLAGS etc.).

I think using Perl's C compiler and options instead of arbitrary different ones
is a good measure in order to avoid "unexplainable" malfunction.

However, the need I see is when Perl's C compiler is not available (for example,
if it was a proprietary compiler in the first place). In this case, now, texinfo
cannot be built at all, without rebuilding Perl too.

The concept that should make this reasonably manageable is the ABI. For instance,
on Linux/x86_64, there are 3 ABIs: the x86_64 ABI, the x86 ABI, and the x32 ABI.
The principle is that code compiled by different compilers but that obeys the
same ABI is compatible.

So, IMO the way to go forward with this, i.e. to allow a different compiler
but without running into link errors, is
  1) from the Perl configuration, extract the ABI,
  2) from $CC and $CFLAGS, extract the ABI (e.g. using Gnulib's gl_HOST_CPU_C_ABI
     macro, module 'host-cpu-c-abi'),
  3) compare the two ABIs and err out if they are different.

Bruno
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.