configure: pick the right compiler for OpenBSD by default
PATCH 1/1 configure: pick the right compiler for OpenBSD by default
The system compiler in OpenBSD is gcc 4.2.1 which is too old for our needs. If doing 'pkg_add gcc' you can get a much newer version (4.9.4 in OpenBSD 6.1) which works with QEMU. This installs binaries with two naming schemes:
$ pkg_info -L gcc | grep bin /usr/local/bin/ecpp /usr/local/bin/egcc /usr/local/bin/egcc-ar /usr/local/bin/egcc-nm /usr/local/bin/egcc-ranlib /usr/local/bin/egcov /usr/local/bin/x86_64-unknown-openbsd6.0-egcc /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-ar /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-nm /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-ranlib /usr/local/bin/x86_64-unknown-openbsd6.0-gcc-4.9.3
We pick the short name this it won't change across OpenBSD releases.
This means users don't need to manually pass custom --cc and --cxx args to configure to avoid immediate failure.
--- configure | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
configure +16 -2
@@ -255,7 +255,21 @@ cross_prefix="" audio_drv_list="" block_drv_rw_whitelist="" block_drv_ro_whitelist="" -host_cc="cc" + +case `uname -s` in + OpenBSD) + # Default system cc in OpenBSD is unsufficient + # we need the 'gcc' pkg added, whch provides + # these modified binary names + host_cc="egcc" + host_cxx="eg++" + ;; + *) + host_cc="cc" + host_cxx="c++" + ;; +esac + libs_softmmu="" libs_tools="" audio_pt_int=""
@@ -466,7 +480,7 @@ else fi if test -z "${CXX}${cross_prefix}"; then - cxx="c++" + cxx="$host_cxx" else cxx="${CXX-${cross_prefix}g++}" fi
Signature · 1 line
2.13.5
Quoted 34 lines · Daniel P. Berrange
The system compiler in OpenBSD is gcc 4.2.1 which is too old for our needs. If doing '
pkg_addgcc' you can get a much newer version (4.9.4 in OpenBSD 6.1) which works with QEMU. This installs binaries with two naming schemes:$ pkg_info -L gcc | grep bin /usr/local/bin/ecpp /usr/local/bin/egcc /usr/local/bin/egcc-ar /usr/local/bin/egcc-nm /usr/local/bin/egcc-ranlib /usr/local/bin/egcov /usr/local/bin/x86_64-unknown-openbsd6.0-egcc /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-ar /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-nm /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-ranlib /usr/local/bin/x86_64-unknown-openbsd6.0-gcc-4.9.3We pick the short name this it won't change across OpenBSD releases.
This means users don't need to manually pass custom --cc and --cxx args to configure to avoid immediate failure.
Signed-off-by Daniel P. Berrange <[email protected]>--- configure | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)configure +0
-0
configure cross_prefix="" · line 261
Quoted 8 lines
configure +4
-1@@ -255,7 +255,21 @@ cross_prefix="" audio_drv_list="" block_drv_rw_whitelist="" block_drv_ro_whitelist="" -host_cc="cc" + +case `uname -s` in + OpenBSD) + # Default system cc in OpenBSD is unsufficient
s/unsufficient/insufficient/
configure cross_prefix="" · line 262
Quoted 1 line
configure +1
-0+ # we need the 'gcc' pkg added, whch provides
s/whch/which/
configure cross_prefix="" · line 271
Quoted 9 lines
configure +9
-0+ # these modified binary names + host_cc="egcc" + host_cxx="eg++" + ;; + *) + host_cc="cc" + host_cxx="c++" + ;; +esac
Do we really need such work-arounds in our configure script? GCC 4.2 is really veeeery old nowadays, so if the OpenBSD folks refuse to update the default in their distro, IMHO they should be punished by having to select the C compiler manually everywhere.
Thomas
Quoted 60 lines · Thomas Huth
Quoted 34 lines · Daniel P. Berrange
The system compiler in OpenBSD is gcc 4.2.1 which is too old for our needs. If doing '
pkg_addgcc' you can get a much newer version (4.9.4 in OpenBSD 6.1) which works with QEMU. This installs binaries with two naming schemes:$ pkg_info -L gcc | grep bin /usr/local/bin/ecpp /usr/local/bin/egcc /usr/local/bin/egcc-ar /usr/local/bin/egcc-nm /usr/local/bin/egcc-ranlib /usr/local/bin/egcov /usr/local/bin/x86_64-unknown-openbsd6.0-egcc /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-ar /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-nm /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-ranlib /usr/local/bin/x86_64-unknown-openbsd6.0-gcc-4.9.3We pick the short name this it won't change across OpenBSD releases.
This means users don't need to manually pass custom --cc and --cxx args to configure to avoid immediate failure.
Signed-off-by Daniel P. Berrange <[email protected]>--- configure | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)configure +0
-0configure cross_prefix="" · line 261
Quoted 8 lines
configure +4
-1@@ -255,7 +255,21 @@ cross_prefix="" audio_drv_list="" block_drv_rw_whitelist="" block_drv_ro_whitelist="" -host_cc="cc" + +case `uname -s` in + OpenBSD) + # Default system cc in OpenBSD is unsufficients/unsufficient/insufficient/
configure cross_prefix="" · line 262
Quoted 1 line
configure +1
-0+ # we need the 'gcc' pkg added, whch providess/whch/which/
configure cross_prefix="" · line 271
Quoted 9 lines
configure +9
-0+ # these modified binary names + host_cc="egcc" + host_cxx="eg++" + ;; + *) + host_cc="cc" + host_cxx="c++" + ;; +esac
Quoted 4 lines
Do we really need such work-arounds in our configure script? GCC 4.2 is really veeeery old nowadays, so if the OpenBSD folks refuse to update the default in their distro, IMHO they should be punished by having to select the C compiler manually everywhere.
By the way, looks like OpenBSD is also switching to clang by default soon:
https://www.phoronix.com/scan.php?page=news_item&px=OpenBSD-Default-Clang
Thomas
Quoted 61 lines · Thomas Huth
Quoted 60 lines · Thomas Huth
Quoted 34 lines · Daniel P. Berrange
The system compiler in OpenBSD is gcc 4.2.1 which is too old for our needs. If doing '
pkg_addgcc' you can get a much newer version (4.9.4 in OpenBSD 6.1) which works with QEMU. This installs binaries with two naming schemes:$ pkg_info -L gcc | grep bin /usr/local/bin/ecpp /usr/local/bin/egcc /usr/local/bin/egcc-ar /usr/local/bin/egcc-nm /usr/local/bin/egcc-ranlib /usr/local/bin/egcov /usr/local/bin/x86_64-unknown-openbsd6.0-egcc /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-ar /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-nm /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-ranlib /usr/local/bin/x86_64-unknown-openbsd6.0-gcc-4.9.3We pick the short name this it won't change across OpenBSD releases.
This means users don't need to manually pass custom --cc and --cxx args to configure to avoid immediate failure.
Signed-off-by Daniel P. Berrange <[email protected]>--- configure | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)configure +0
-0configure cross_prefix="" · line 261
Quoted 8 lines
configure +4
-1@@ -255,7 +255,21 @@ cross_prefix="" audio_drv_list="" block_drv_rw_whitelist="" block_drv_ro_whitelist="" -host_cc="cc" + +case `uname -s` in + OpenBSD) + # Default system cc in OpenBSD is unsufficients/unsufficient/insufficient/
configure cross_prefix="" · line 262
Quoted 1 line
configure +1
-0+ # we need the 'gcc' pkg added, whch providess/whch/which/
Quoted 9 lines
configure +9
-0+ # these modified binary names + host_cc="egcc" + host_cxx="eg++" + ;; + *) + host_cc="cc" + host_cxx="c++" + ;; +esac
Quoted 8 lines
Quoted 4 lines
Do we really need such work-arounds in our configure script? GCC 4.2 is really veeeery old nowadays, so if the OpenBSD folks refuse to update the default in their distro, IMHO they should be punished by having to select the C compiler manually everywhere.
By the way, looks like OpenBSD is also switching to clang by default soon:
https://www.phoronix.com/scan.php?page=news_item&px=OpenBSD-Default-Clang
In a few years time we could potentially revert this patch, but in the meantime it is clearly beneficial for anyone using OpenBSD and has no significant maint burden for us to carry it while there are widely supported OpenBSD releases which need it.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 2 lines · Daniel P. Berrange
Quoted 1 line · Thomas Huth
On 13.10.2017 12:52, Thomas Huth wrote:
[...]
Quoted 8 lines
Quoted 3 lines
By the way, looks like OpenBSD is also switching to clang by default soon:
https://www.phoronix.com/scan.php?page=news_item&px=OpenBSD-Default-Clang
In a few years time we could potentially revert this patch, but in the meantime it is clearly beneficial for anyone using OpenBSD and has no significant maint burden for us to carry it while there are widely supported OpenBSD releases which need it.
I disagree. If the next OpenBSD release uses Clang by default, we're not building QEMU there with the *working default* C compiler anymore. You're then rather forcing the OpenBSD users then to install an additional (likely unliked, since GPLv3) GCC package on their systems.
So IMHO, just drop this patch and wait for the next OpenBSD release, and the problem will be solved automatically. (and the few users who still use an older release of OpenBSD will likely use the QEMU from their ports system anyway)
Thomas
Quoted 9 lines · Thomas Huth
I disagree. If the next OpenBSD release uses Clang by default, we're not building QEMU there with the *working default* C compiler anymore. You're then rather forcing the OpenBSD users then to install an additional (likely unliked, since GPLv3) GCC package on their systems.
So IMHO, just drop this patch and wait for the next OpenBSD release, and the problem will be solved automatically. (and the few users who still use an older release of OpenBSD will likely use the QEMU from their ports system anyway)
Another possible approach would be to have a configure test for whatever feature it is that we need in our compiler, and then run through a list that starts with "cc" and goes on to try "egcc" etc until it finds one that works. That way we'll automatically DTRT when OpenBSD upgrades their "cc" to a working one.
thanks
-- PMM
Quoted 10 lines · Peter Maydell
Quoted 9 lines · Thomas Huth
I disagree. If the next OpenBSD release uses Clang by default, we're not building QEMU there with the *working default* C compiler anymore. You're then rather forcing the OpenBSD users then to install an additional (likely unliked, since GPLv3) GCC package on their systems.
So IMHO, just drop this patch and wait for the next OpenBSD release, and the problem will be solved automatically. (and the few users who still use an older release of OpenBSD will likely use the QEMU from their ports system anyway)
Quoted 6 lines
Another possible approach would be to have a configure test for whatever feature it is that we need in our compiler, and then run through a list that starts with "cc" and goes on to try "egcc" etc until it finds one that works. That way we'll automatically DTRT when OpenBSD upgrades their "cc" to a working one.
The release is already out.
One issue that needs to be fixed in the configure script. Have the TLS test link with libpthread if the initial test fails.
Hi,
Quoted 5 lines
By the way, looks like OpenBSD is also switching to clang by default soon:
https://www.phoronix.com/scan.php?page=news_item&px=OpenBSD-Default-
Clang
It did happen already. On openbsd 6.2 (released a week ago) cc is clang:
$ cc --version OpenBSD clang version 4.0.0 (tags/RELEASE_400/final) (based on LLVM 4.0.0)
cheers,
Gerd
Quoted 8 lines · Gerd Hoffmann
Hi,
Quoted 5 lines
By the way, looks like OpenBSD is also switching to clang by default soon:
https://www.phoronix.com/scan.php?page=news_item&px=OpenBSD-Default-
Clang
Quoted 6 lines
It did happen already. On openbsd 6.2 (released a week ago) cc is clang:
$ cc --version OpenBSD clang version 4.0.0 (tags/RELEASE_400/final) (based on LLVM 4.0.0)
Oh, I didn't notice that was out already. Lets drop my patch and I'll update the BSD page on the wiki
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 60 lines · Thomas Huth
Quoted 34 lines · Daniel P. Berrange
The system compiler in OpenBSD is gcc 4.2.1 which is too old for our needs. If doing '
pkg_addgcc' you can get a much newer version (4.9.4 in OpenBSD 6.1) which works with QEMU. This installs binaries with two naming schemes:$ pkg_info -L gcc | grep bin /usr/local/bin/ecpp /usr/local/bin/egcc /usr/local/bin/egcc-ar /usr/local/bin/egcc-nm /usr/local/bin/egcc-ranlib /usr/local/bin/egcov /usr/local/bin/x86_64-unknown-openbsd6.0-egcc /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-ar /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-nm /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-ranlib /usr/local/bin/x86_64-unknown-openbsd6.0-gcc-4.9.3We pick the short name this it won't change across OpenBSD releases.
This means users don't need to manually pass custom --cc and --cxx args to configure to avoid immediate failure.
Signed-off-by Daniel P. Berrange <[email protected]>--- configure | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)configure +0
-0configure cross_prefix="" · line 261
Quoted 8 lines
configure +4
-1@@ -255,7 +255,21 @@ cross_prefix="" audio_drv_list="" block_drv_rw_whitelist="" block_drv_ro_whitelist="" -host_cc="cc" + +case `uname -s` in + OpenBSD) + # Default system cc in OpenBSD is unsufficients/unsufficient/insufficient/
configure cross_prefix="" · line 262
Quoted 1 line
configure +1
-0+ # we need the 'gcc' pkg added, whch providess/whch/which/
configure cross_prefix="" · line 271
Quoted 9 lines
configure +9
-0+ # these modified binary names + host_cc="egcc" + host_cxx="eg++" + ;; + *) + host_cc="cc" + host_cxx="c++" + ;; +esac
Quoted 4 lines
Do we really need such work-arounds in our configure script? GCC 4.2 is really veeeery old nowadays, so if the OpenBSD folks refuse to update the default in their distro, IMHO they should be punished by having to select the C compiler manually everywhere.
I really object to such a user hostile POV. It is not beneficial to QEMU to punish our users for choices they make, and our punishment will do nothing to encourage OpenBSD distro maintainers to switch their compiler.
This is a straightforward change to 'configure' that makes it 'just work' with no special args on current OpenBSD releases. Making it 'just work' is a goal we have for every aspect of the configure script, and there's no reason why we shouldn't try this for OpenBSD, as we do for other platforms, unless we're going to drop OpenBSD entirely.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 60 lines · Thomas Huth
Quoted 34 lines · Daniel P. Berrange
The system compiler in OpenBSD is gcc 4.2.1 which is too old for our needs. If doing '
pkg_addgcc' you can get a much newer version (4.9.4 in OpenBSD 6.1) which works with QEMU. This installs binaries with two naming schemes:$ pkg_info -L gcc | grep bin /usr/local/bin/ecpp /usr/local/bin/egcc /usr/local/bin/egcc-ar /usr/local/bin/egcc-nm /usr/local/bin/egcc-ranlib /usr/local/bin/egcov /usr/local/bin/x86_64-unknown-openbsd6.0-egcc /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-ar /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-nm /usr/local/bin/x86_64-unknown-openbsd6.0-egcc-ranlib /usr/local/bin/x86_64-unknown-openbsd6.0-gcc-4.9.3We pick the short name this it won't change across OpenBSD releases.
This means users don't need to manually pass custom --cc and --cxx args to configure to avoid immediate failure.
Signed-off-by Daniel P. Berrange <[email protected]>--- configure | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)configure +0
-0configure cross_prefix="" · line 261
Quoted 8 lines
configure +4
-1@@ -255,7 +255,21 @@ cross_prefix="" audio_drv_list="" block_drv_rw_whitelist="" block_drv_ro_whitelist="" -host_cc="cc" + +case `uname -s` in + OpenBSD) + # Default system cc in OpenBSD is unsufficients/unsufficient/insufficient/
configure cross_prefix="" · line 262
Quoted 1 line
configure +1
-0+ # we need the 'gcc' pkg added, whch providess/whch/which/
configure cross_prefix="" · line 271
Quoted 9 lines
configure +9
-0+ # these modified binary names + host_cc="egcc" + host_cxx="eg++" + ;; + *) + host_cc="cc" + host_cxx="c++" + ;; +esac
Quoted 7 lines
Do we really need such work-arounds in our configure script? GCC 4.2 is really veeeery old nowadays, so if the OpenBSD folks refuse to update the default in their distro, IMHO they should be punished by having to select the C compiler manually everywhere.
Thomas
OpenBSD switched to Clang/LLVM and they insist to support older releases. We can silently ignore their GCC 4.2.1 (the latest one GPLv2 release).