0

Centos 7 trying to build nginx with devel gcc-5.3.1.rpm

manually goes

yum install centos-release-scl

only then

yum install devtoolset-4-gcc

how to add cascade installation of dependencies in spec rpmbuild?

BuildRequires: centos-release-scl
Requires: devtoolset-4-gcc

installs only first one the same as here

BuildRequires: centos-release-scl
BuildRequires: devtoolset-4-gcc

BuildRequires(pre): is not supported

Bertrand Martel
  • 42,756
  • 16
  • 135
  • 159
  • Possible duplicate of [Automatically install build dependencies prior to building an RPM package](http://stackoverflow.com/questions/13227162/automatically-install-build-dependencies-prior-to-building-an-rpm-package) – Aaron D. Marasco Apr 19 '17 at 14:46

1 Answers1

1

You have to list the prerequisite in both Requires and BuildRequires if it is truly needed both at build and runtime. If it is only used by a pre or post scriptlet, then you add the suffix to Requires. If all the scriptlets, build, and runtime need it, then you have to explicitly list it as needed every time. A contrived example where you really like an old editor:

Requires(pre): ed
Requires(post): ed
Requires(preun): ed
Requires(post): ed
Requires: ed
BuildRequires: ed

Edit: Re-reading question and comment on this answer, I think this is a dupe of "Automatically install build dependencies prior to building an RPM package"

Community
  • 1
  • 1
Aaron D. Marasco
  • 6,506
  • 3
  • 26
  • 39
  • to clearify gcc is needed here only for compiling what in this situation should be written? `code` BuildRequires: centos-release-scl `code` installs normaly `code` Requires(pre): devtoolset-4-gcc Requires(post): devtoolset-4-gcc Requires(preun): devtoolset-4-gcc Requires(post): devtoolset-4-gcc Requires: devtoolset-4-gcc BuildRequires: devtoolset-4-gcc `code` just says no devtoolset-4-gcc is found inspite of auto installing – Петр Малков Apr 19 '17 at 10:43
  • If it is only needed for building, then simply `BuildRequires` would work. However, `rpmbuild` is not `yum` - you need to manually install them before building, e.g. "`sudo yum install devtoolset-4-gcc`". – Aaron D. Marasco Apr 19 '17 at 14:44
  • may be some script before building to pass into yum,,,, ? – Петр Малков Apr 20 '17 at 08:08
  • Yes, it's called `yum-builddep` and I linked to it in my answer. – Aaron D. Marasco Apr 20 '17 at 21:46