[opensuse] C++ Question
![](https://seccdn.libravatar.org/avatar/e6bc4b5458f9686f6bb7cf02bdd6e1da.jpg?s=120&d=mm&r=g)
Hi All, Probably not the right place to ask but one of you may know the answer. I am learning C++ and my program uses system('program --arg1 --arg2'); to run a proprietary program. My question is how can I make this program a dependency so that it has to be installed before my program? I have noticed that ldd shows that some dependencies have already been added as dependencies to the binary once it is compiled. Thanks -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
![](https://seccdn.libravatar.org/avatar/7891b1b1a5767f4b9ac1cc0723cebdac.jpg?s=120&d=mm&r=g)
Paul Groves wrote:
Hi All,
Probably not the right place to ask but one of you may know the answer.
I am learning C++ and my program uses system('program --arg1 --arg2'); to run a proprietary program. My question is how can I make this program a dependency so that it has to be installed before my program?
Hi Paul that's a packaging issue, not a programming issue.
I have noticed that ldd shows that some dependencies have already been added as dependencies to the binary once it is compiled.
libraries and such, but not an external <anything> that you call via system(). -- Per Jessen, Zürich (19.8°C) http://www.cloudsuisse.com/ - your owncloud, hosted in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
![](https://seccdn.libravatar.org/avatar/e6bc4b5458f9686f6bb7cf02bdd6e1da.jpg?s=120&d=mm&r=g)
On 23/09/17 15:10, Per Jessen wrote:
Paul Groves wrote:
Hi All,
Probably not the right place to ask but one of you may know the answer.
I am learning C++ and my program uses system('program --arg1 --arg2'); to run a proprietary program. My question is how can I make this program a dependency so that it has to be installed before my program? Hi Paul
that's a packaging issue, not a programming issue. OK, well this is my first time packaging a program. Any advice on how I would go about this? I would like to make a .rpm for opensuse and a .deb for ubuntu
For belt and braces, is there a way to check for installed packages in C++ too so I can output an error message if a required package is not installed?
I have noticed that ldd shows that some dependencies have already been added as dependencies to the binary once it is compiled. libraries and such, but not an external <anything> that you call via system().
This is why I got confused. :-s -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
![](https://seccdn.libravatar.org/avatar/77cb4da5f72bc176182dcc33f03a18f3.jpg?s=120&d=mm&r=g)
On 2017-09-24 00:48, Paul Groves wrote:
For belt and braces, is there a way to check for installed packages in C++ too so I can output an error message if a required package is not installed?
Yes, of course. You can try to see if the program exists - so you test for the program, not for the package. You can even try to run it asking for its version string, and decide if it is the correct one when it responds. -- Cheers / Saludos, Carlos E. R. (from 42.2 x86_64 "Malachite" (Minas Tirith))
![](https://seccdn.libravatar.org/avatar/806a41bf7a1d02ca9a06b1459840b323.jpg?s=120&d=mm&r=g)
On 24.09.2017 00:48, Paul Groves wrote:
On 23/09/17 15:10, Per Jessen wrote:
Paul Groves wrote:
Hi All,
Probably not the right place to ask but one of you may know the answer.
I am learning C++ and my program uses system('program --arg1 --arg2'); to run a proprietary program. My question is how can I make this program a dependency so that it has to be installed before my program? Hi Paul
that's a packaging issue, not a programming issue. OK, well this is my first time packaging a program. Any advice on how I would go about this? I would like to make a .rpm for opensuse and a .deb for ubuntu
For belt and braces, is there a way to check for installed packages in C++ too so I can output an error message if a required package is not installed?
Almost all packaging formats can handle dependencies. Some dependencies can be set automatically by using ldd, some have to be defined. If you want to build for many OS versions, you should try the open build service: build.opensuse.org. It can build packages for many Suse versions, centos, arch, debian, fedora, redhat, ubuntu ...
![](https://seccdn.libravatar.org/avatar/638c5f9b9a41e53d4663197a58261c49.jpg?s=120&d=mm&r=g)
Hello, this belongs in opensuse-programming... On Sat, 23 Sep 2017, Paul Groves wrote:
I am learning C++ and my program uses system('program --arg1 --arg2'); to run a proprietary program. My question is how can I make this program a dependency so that it has to be installed before my program?
You can't. You'll have to create a install-routine / startscript that checks for the program and bails out if it is missing. E.g.: ==== /usr/bin/foo ==== #!/bin/sh FOO_BIN=/usr/lib/foo/foo.bin BAR_BIN="$(type -p bar)" if ! test -x "$BAR_BIN" ; then echo "'bar' not found or not executable" >&2; exit 2; fi exec "$REAL_FOO" --bar-bin="${BAR_BIN}" "$@" ==== (and implement --bar-bin). Or use the environment. HTH, -dnh -- Like most computer techie people, I'll happily spend 6 hours trying figure out how to do a 3 hour job in 10 minutes. -- James Cort -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (5)
-
Carlos E. R.
-
David Haller
-
Florian Gleixner
-
Paul Groves
-
Per Jessen