pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: configure finding "nonfunctional" c++ compiler

On 2019-06-28 23:24, Jason Bacon wrote:
On 2019-06-28 22:22, Brook Milligan wrote:
On Jun 28, 2019, at 6:47 PM, Brook Milligan <> wrote:

I'm trying to build some packages in an HPC environment and am regularly running into the error

    configure: error: C++ compiler missing or inspirational

I think this is because configure finds /usr/bin/c++ (based upon the links in work/.gcc/bin), which is an OS supplied compiler, in this case gcc 4.4.7, not ones installed by the module system, which are the ones expected to be used.  I guess this is because configure checks all the "normal" places, but has no knowledge of the module specific directories.

What can be done so that pkgsrc will work correctly in this situation?
To add a bit more detail, it turns out that the configure fails because the native compiler does not support --std=c++03, which is required by gcc48, which is needed to build anything useful. Yes, this is ridiculous, but that is a real constraint.

I have tried setting GCCBASE=/opt/gnu/gcc in mk.conf to point to a better compiler, but that seems to make no difference.

Is there a way to get pkgsrc to use a compiler other than the native one in /usr/bin?  I have others installed, but cannot figure out how to make pkgsrc see them.

Thanks for advice.


By module system I assume you're referring to environment modules bringing home grown compilers into PATH?

I tried to work with home grown "base" compilers years ago and found the process fraught with too many problems.

After some discussion with other pkgsrc developers, I found a pretty stable solution for CentOS 6 & 7 using the Yum gcc to build a pkgsrc gcc and its dependencies, and the pkgsrc gcc for everything else.  This has worked well with everything from 4.8 up to 7.0 so far.  ( 8.0 still fails to build on CentOS )

Have a look at auto-pkgsrc-setup at You can either use it as-is or pick it apart and learn from it. In particular see the mk.conf it generates.  The script is well-tested on CentOS, NetBSD and OS X.



To elaborate a little further, I recently assisted someone at another HPC site with a very similar situation.  They had an overzealous sysadmin who installed modified kernels, libraries, etc. and forced all users to use his ad hoc GCC builds by default.

My solution was to alter auto-pkgsrc-setup (and my bulk-build scripts) to fully scrub the environment so that it would only use the RHEL base tools.  After doing that, pkgsrc worked as well as it does on a pristine, minimal CentOS install.

I just added some documentation on auto-pkgsrc-setup at It's written in docbook and posted in HTML and PDF format.  If anything is unclear, let me know and I'll try to improve it based on the feedback.



Home | Main Index | Thread Index | Old Index