3

I am currently using the OpenSUSE Build Service (https://build.opensuse.org/) to build ArangoDB. However, for some newer C++ features I need a fairly current C++ compiler. For some of the older distributions (like Debian6 or CentOS) the default compiler is simply too old.

I am pretty sure, there must be a way to use newer compiler with OBS, but I got lost in the documentation of OBS. Can anyone point me into the right direction?

2 Answers 2

1

I have done this in the past for libraries but not build tools, so i don't see why the following shouldn't work other then binary compatibility issues if you build any libraries. As vitalyster has pointed out this is not a ideal approach and you may run into issues but it is technically possible to do it this way.

The way that i have done this is include the package (in your case GCC) in my project and set it's build / use in build (under repositories) to only build for the architectures that don't have a new enough version.

I would also put BuildRequires: gcc >= 4.8 in your spec to ensure the newer version is picked up but that should not be necessary

A example can be found in https://build.opensuse.org/project/monitor/X11:Enlightenment:Factory the package luajit is only available in the openSUSE:Factory repository, so i have a copy in the repository that builds for everything but openSUSE:Factory which uses the one provided in the upstream repository.

In your repository you can branch existing package which means that you can find a version of gcc which is already available on obs and use that instead of creating your own.

1
  • I tried branching gcc47 into a RHEL environment, but there are a lot of unresolvable dependencies and the basic structure just looks too different for it to work.
    – Zanchey
    Jun 26, 2016 at 5:04
0

Yes, you are right, OpenSUSE Build Service allow you to build packages for the number of linux distributions, but NO, you are thinking wrong to use last C++ compiler version for all distributions. Your application should use distribution-provided compiler and libraries, and OBS allow you to test compatibility of your application with the most major distributions, without needing to install all of them. So you have two options:

  1. do things as expected - check distributions you want to support and adapt your code to their compiler and libraries version - hide "new features" with preprocessor blocks for newer compiler and write compatibility code for old compiler/library. OBS can automatically build your application and show you problems and you can easy fix it.
  2. use latest compiler and link statically all required libraries, including current libgcc and depended libraries, to not depend on distribution compiler/libraries versions, and deploy this in a one big package. This is the way which used mainly by proprietary applications, and linux users hate them - these applications bring to system multiple copies of the same libraries, and no one care how they will be update - imagine, you are using OpenSSL, and link your application statically with OpenSSL 1.0.1e, which have the Heartbleed bug - distribution vendor sends security update, and all applications that using distribution-provided library will be safe when user install update, but your application will continue using your statically linked insecure library. Yes, you can maintain all required libraries yourself and update your application when security updates are ready, but this is the job of distribution vendor, and you will repeat their hard work.
1
  • 1
    The problem is, that some C++ 11 are part of the ArangoDB and I think I cannot hide them with defines. OpenSSL is C (not C++) so it should be possible to link that dynamically. So the question remains: How do I go with (2).
    – fceller
    Apr 11, 2014 at 21:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .