Mailinglist Archive: opensuse-buildservice (153 mails)

< Previous Next >
Re: [opensuse-buildservice] Build C++ Files for different distributions
  • From: Edgar Aichinger <edogawa@xxxxxx>
  • Date: Wed, 26 Nov 2014 12:04:33 +0100
  • Message-id: <88564569.rXUSopJkk9@edpc>
Am Mittwoch, 26. November 2014, 10:27:05 schrieb Tobias Lauterbach:
Okay, so what I achieved/understood so far is this:
What Open Build Service does is extract my helloWorld-1.tar.gz
After that we have a folder helloWorld-1 in our working directory.
After which we change into that directory.
Afterwards my build command "g++ -o helloWorldBin helloWorld.cpp" is
executed, so I have a binary called "helloWorldBin" in my helloWorld-1 folder.

As you said I now need to copy this binary into the"
$RPM_BUILDROOT%{_bindir}" -Folder in the install section and add this file to
the files section.
Did I miss anything? If not, why can´t I just add the binary to the files

As far as I understand it, because when the binary rpm is created, it gets
filled with the buildroot's content, which is a sort of mirror of the final
installation at a writable location.

Because I just have one .cpp file and no make file I can´t execute any make
commands like all of the examples I found., I tried to do the following:
Name: helloWorld
Version: 1
Release: 0
License: GPL-2.0+
Summary: helloWorld
Group: Other
Source: helloWorld-1.tar.gz
BuildRequires: gcc-c++ cmake
BuildRoot: %{_tmppath}/helloWorld


%setup -q

g++ -o helloWorldBin helloWorld.cpp

cp helloWorldBin $RPM_BUILDROOT%{_bindir}/hello_world_1





I get the following error:
cp: cannot create regular file `/usr/bin/hello_world_1': Permission denied

This is partially my fault ;)
In my previous mail I wrote off the top of my head and made a mistake: the
buildroot variable is $RPM_BUILD_ROOT, not $RPM_BUILDROOT. So if you read the
buildlog carefully you'll see that $RPM_BUILDROOT expands to nothing and it
tries to copy the binary to /usr/bin - where you don't have the permissions. So
once you replace it, it should work, but as I said, in %files you have to put
%{_bindir}/hello_world_1 (without the buildroot) as it specifies the final

Somehow the spec guideline isn´t helping me much

Excuse me for asking again and thank you very much for your help!

To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-buildservice+owner@xxxxxxxxxxxx

< Previous Next >