Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.95k stars 554 forks source link

Configure hangs on OpenBSD when using g++ as C-compiler #19338

Closed jkeenan closed 2 months ago

jkeenan commented 2 years ago

If I try to compile perl on OpenBSD using g++ as the C-compiler, ./Configure hangs; I never get as far as make.

I have a VM which I mainly use for smoke-testing blead and branches:

$ uname -mrs 
OpenBSD 6.9 amd64
$ g++ --version | head -2
g++ (GCC) 4.2.1 20070719 
Copyright (C) 2007 Free Software Foundation, Inc.

I've tried to compile both blead and the recent smoke-me/nicholas/pthreads-not-_Thread_local-for-C++ branch with the following invocation:

sh ./Configure -des -Dusedevel -Duseithreads \
-Doptimize="-O2 -pipe -fstack-protector -fno-strict-aliasing" -Dcc="g++"

./Configure hangs here:

Do you wish to use dynamic loading? [y]  
Source file to use for dynamic loading 

./Configure does complete if I either (a) switch -Dcc="g++" to -Dcc=gcc; or (b) omit the -Dcc term entirely and default to clang-10.0.1 as the compiler. The double quotes around g++ don't appear to make a difference. If I simplify the invocation to sh ./Configure -des -Dusedevel -Dcc=g++, ./Configure still hangs at the same point. (Output of ./Configure available upon request.)

Other than doing this smoke-testing and maintaining a few ports of CPAN modules, I don't know much about OpenBSD. The gcc and g++ versions are old but appear to be part of the past system, meaning they're not available via ports. (Cf. Openports.) So trying a more recent version of g++ doesn't seem to be an option.

On SmokeDB we have no smoke-test reports on OpenBSD using g++ as the C-compiler.

I don't know how concerned we should be about this, but the fact that it is ./Configure that is hanging is what is really surprising.

@afresh1 or anyone else ... ideas?

afresh1 commented 2 years ago

We did stop compiling gcc on amd64 as part of the base system (although it is still available on other architectures) but you can install the "g++" package from lang/gcc, although it installs the binaries as "eg++" and "egcc". I didn't track down why there's no g++-11 package, but that old version of isn't likely to come back on amd64 so I doubt we will be able to reproduce it.

# pkg_add g++
quirks-4.93 signed on 2022-01-10T20:43:34Z
quirks-4.92->4.93: ok
g++-8.4.0p9:libmpc-1.1.0: ok
g++-8.4.0p9:gcc-8.4.0p9: ok
g++-8.4.0p9: ok
Read shared items: ok

With that, Configure (on blead) completes (dang, I need to update my laptop!):

$ sysctl kern.version
kern.version=OpenBSD 7.0-current (GENERIC.MP) #209: Wed Dec 29 15:43:32 MST 2021
    deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP

$ sh ./Configure -des -Dusedevel -Duseithreads \
-Doptimize="-O2 -pipe -fstack-protector -fno-strict-aliasing" -Dcc="eg++"
...
Now you must run 'make'.

If you compile perl5 on a different machine or from a different object
directory, copy the Policy.sh file from this object directory to the
new one before you run Configure -- this will help you with most of
the policy defaults.

I did find that my sparc64 still uses gcc and so has g++ available, but it too completes just fine.

$ sysctl kern.version
kern.version=OpenBSD 7.0-current (GENERIC.MP) #1127: Sun Jan  2 13:48:00 MST 2022
    deraadt@sparc64.openbsd.org:/usr/src/sys/arch/sparc64/compile/GENERIC.MP
$ g++ --version
g++ (GCC) 4.2.1 20070719 
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
jkeenan commented 2 years ago

We did stop compiling gcc on amd64 as part of the base system (although it is still available on other architectures) but you can install the "g++" package from lang/gcc, although it installs the binaries as "eg++" and "egcc". I didn't track down why there's no g++-11 package, but that old version of isn't likely to come back on amd64 so I doubt we will be able to reproduce it.

# pkg_add g++
quirks-4.93 signed on 2022-01-10T20:43:34Z
quirks-4.92->4.93: ok
g++-8.4.0p9:libmpc-1.1.0: ok
g++-8.4.0p9:gcc-8.4.0p9: ok
g++-8.4.0p9: ok
Read shared items: ok

@afresh1, thanks for looking into this. Unfortunately, I tried gcc, devel/gcc and g++ without success. I control this VM via a Vagrantfile, to which I added:

     # Per afresh1 recommendation Jan 12 2022
     sudo pkg_add -u \
        devel/gcc \
        g++

I then provisioned, and got:

$ vagrant provision
==> default: Running provisioner: shell...
    default: Running: inline script
    default: perl-reporter-11
    default: quirks-3.633 signed on 2021-10-07T19:06:22Z
    default: quirks-3.633 signed on 2021-10-07T19:06:22Z
    default: quirks-3.633 signed on 2021-10-07T19:06:22Z
    default: quirks-3.633 signed on 2021-10-07T19:06:22Z
    default: Can't find devel/gcc
    default: Can't find g++
    default: Problem finding devel/gcc
    default: Problem finding g++

For the record:

$ uname -mrs
OpenBSD 6.9 amd64

Do you know what I'm missing?

Thank you very much. Jim Keenan

afresh1 commented 2 years ago

well, "devel/gcc" is the portspath, I wouldn't expect that to work for pkg_add. I'm less sure about "g++" as I see the package available for 6.9. I think the problem is the -u which means "update" the installed packages and since you don't currently have either "gcc" or "g++" installed it isn't sure what you want.

jkeenan commented 2 years ago

I next tried this:

     sudo pkg_add \
        g++

vagrant reload simply passed over it, and when I went in to the VM the g++ version remained at g++ (GCC) 4.2.1 20070719.

I then tried:

     sudo pkg_add \
        g++-8.4

At this, vagrant reload reported:

    default: perl-reporter-11
    default: quirks-3.633 signed on 2021-10-07T19:06:22Z
    default: quirks-3.633 signed on 2021-10-07T19:06:22Z
    default: quirks-3.633 signed on 2021-10-07T19:06:22Z
    default: quirks-3.633 signed on 2021-10-07T19:06:22Z
    default: quirks-3.633 signed on 2021-10-07T19:06:22Z
    default: Can't find g++-8.4
    default: Couldn't install g++-8.4

I'm surprised to see that g++ tarball at https://cdn.openbsd.org/pub/OpenBSD/6.9/packages/amd64/ when there is no correponding port at https://openports.se/.

afresh1 commented 2 years ago

Ya, that's weird, but it's a subpackage of gcc. It is listed on the much better openports.pl although there is apparently a bug that means you can't see the details.

The package installs "g++" and "gcc" as "eg++" and "egcc" so "gcc" will still be the old one.

jkeenan commented 2 months ago

I'm closing this ticket in favor of the nearly identically named https://github.com/Perl/perl5/issues/21958. Please continue discussion there.