-Wl,-rpath={%_libdir} has no effect when building using OBS

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

-Wl,-rpath={%_libdir} has no effect when building using OBS

Xing
Dear All,
I'm trying to build and package openbabel. It needs the "RUNPATH" tag to run correctly or the "obabel" command will not find the plugin directories. Openbabel uses CMAKE and on OBS
"-DCMAKE_SKIP_RPATH=ON" is set automatically by the %cmake marco. I can use "-DCMAKE_C_FLAGS="-Wl,-rpath={%_libdir}" and "-DCMAKE_CXX_FLAGS=-Wl,-rpath={%_libdir}" to force passing the flags to gcc and
build with RUNPATH on my local computer directly (without using "osc build "). However it gcc will just ignore the "-Wl,-rpath" flag when I use "osc build" or the online building service and no
RUNPATH information is written to the binary and .so files.

Does any one know why gcc behaves differently like this (invoke directly vs via OBS) and how to insert the "RUNPATH" information into the final .rpm files?

Thanks and best wishes,
Xing
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: -Wl,-rpath={%_libdir} has no effect when building using OBS

Dmitriy Perlow-2
Xing <[hidden email]>  Mon, 27 Mar 2017 21:34:06 +0300:

> Dear All,
> I'm trying to build and package openbabel. It needs the "RUNPATH" tag to  
> run correctly or the "obabel" command will not find the plugin  
> directories. Openbabel uses CMAKE and on OBS "-DCMAKE_SKIP_RPATH=ON" is  
> set automatically by the %cmake marco. I can use  
> "-DCMAKE_C_FLAGS="-Wl,-rpath={%_libdir}" and  
> "-DCMAKE_CXX_FLAGS=-Wl,-rpath={%_libdir}" to force passing the flags to  
> gcc and build with RUNPATH on my local computer directly (without using  
> "osc build "). However it gcc will just ignore the "-Wl,-rpath" flag  
> when I use "osc build" or the online building service and no RUNPATH  
> information is written to the binary and .so files.
>
> Does any one know why gcc behaves differently like this (invoke directly  
> vs via OBS) and how to insert the "RUNPATH" information into the final  
> .rpm files?

Hello.

Please try `cmake` instead `%cmake`. Afaik %cmake can be used only via  
rpmbuild by OBS/osc/hands.

> Thanks and best wishes,
> Xing


--
Best regards,
Dmitriy Perlow
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: -Wl,-rpath={%_libdir} has no effect when building using OBS

Xing
I also used plain "cmake". If I do not add "-DCMAKE_SKIP_RPATH=ON", the following error will occur:

[  124s] CMake Error at src/cmake_install.cmake:60 (file):
[  124s]   file RPATH_CHANGE could not write new RPATH:
[  124s]
[  124s]     /usr/lib64
[  124s]
[  124s]   to the file:
[  124s]
[  124s] /home/abuild/rpmbuild/BUILDROOT/openbabel-2.4.1-1.5.x86_64/usr/lib64/libopenbabel.so.5.0.0
[  124s]
[  124s]   No valid ELF RPATH or RUNPATH entry exists in the file;
[  124s] Call Stack (most recent call first):
[  124s]   cmake_install.cmake:75 (include)
[  124s]
[  124s]
[  124s] make: *** [Makefile:117: install] Error 1
[  124s] error: Bad exit status from /var/tmp/rpm-tmp.3Hqauh (%install)
[  124s]
[  124s]
[  124s] RPM build errors:
[  124s]     Bad exit status from /var/tmp/rpm-tmp.3Hqauh (%install)
[  124s]
[  124s] helium failed "build openbabel.spec" at Mon Mar 27 20:38:45 UTC 2017.
[  124s]

Therefore I have to use all of the three: "-DCMAKE_SKIP_RPATH=ON", "-DCMAKE_C_FLAGS="-Wl,-rpath={%_libdir}", "-DCMAKE_CXX_FLAGS=-Wl,-rpath={%_libdir}". It works when building directly but still no
RUNPATH or RPATH when using "osc build..."

Best wishes,
Xing

On 03/27/2017 03:15 PM, Dmitriy Perlow wrote:

> Xing <[hidden email]>  Mon, 27 Mar 2017 21:34:06 +0300:
>
>> Dear All,
>> I'm trying to build and package openbabel. It needs the "RUNPATH" tag to run correctly or the "obabel" command will not find the plugin directories. Openbabel uses CMAKE and on OBS
>> "-DCMAKE_SKIP_RPATH=ON" is set automatically by the %cmake marco. I can use "-DCMAKE_C_FLAGS="-Wl,-rpath={%_libdir}" and "-DCMAKE_CXX_FLAGS=-Wl,-rpath={%_libdir}" to force passing the flags to gcc
>> and build with RUNPATH on my local computer directly (without using "osc build "). However it gcc will just ignore the "-Wl,-rpath" flag when I use "osc build" or the online building service and no
>> RUNPATH information is written to the binary and .so files.
>>
>> Does any one know why gcc behaves differently like this (invoke directly vs via OBS) and how to insert the "RUNPATH" information into the final .rpm files?
>
> Hello.
>
> Please try `cmake` instead `%cmake`. Afaik %cmake can be used only via rpmbuild by OBS/osc/hands.
>
>> Thanks and best wishes,
>> Xing
>
>

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: -Wl,-rpath={%_libdir} has no effect when building using OBS

Brüns, Stefan
In reply to this post by Xing
On Montag, 27. März 2017 20:34:06 CEST Xing wrote:

> Dear All,
> I'm trying to build and package openbabel. It needs the "RUNPATH" tag to run
> correctly or the "obabel" command will not find the plugin directories.
> Openbabel uses CMAKE and on OBS "-DCMAKE_SKIP_RPATH=ON" is set
> automatically by the %cmake marco. I can use
> "-DCMAKE_C_FLAGS="-Wl,-rpath={%_libdir}" and
> "-DCMAKE_CXX_FLAGS=-Wl,-rpath={%_libdir}" to force passing the flags to gcc
> and build with RUNPATH on my local computer directly (without using "osc
> build "). However it gcc will just ignore the "-Wl,-rpath" flag when I use
> "osc build" or the online building service and no RUNPATH information is
> written to the binary and .so files.

You should not set rpath, as openbabel looks for plugins in the specified
directory by itself.

Have a look at https://github.com/openbabel/openbabel/blob/master/
CMakeLists.txt

On openSUSE, you should set ENABLE_VERSIONED_FORMATS, and the plugin dir will
be set to /usr/lib{64}/openbabel/<version>/

Kind regards,

Stefan


--
Stefan Brüns  /  Bergstraße 21  /  52062 Aachen
home: +49 241 53809034     mobile: +49 151 50412019
work: +49 2405 49936-424
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: -Wl,-rpath={%_libdir} has no effect when building using OBS

Xing
Is ENABLE_VERSIONED_FORMATS set to "ON" by default? I also explicitly set it to ON but openbabel still complaints that no plugins, unless I set the "BABEL_LIBDIR" and "BABEL_DATADIR" variables...
(http://open-babel.readthedocs.io/en/latest/Installation/install.html#environment-variables)

Sincerely yours
Xing

On 03/27/2017 05:03 PM, Stefan Bruens wrote:

> On Montag, 27. März 2017 20:34:06 CEST Xing wrote:
>> Dear All,
>> I'm trying to build and package openbabel. It needs the "RUNPATH" tag to run
>> correctly or the "obabel" command will not find the plugin directories.
>> Openbabel uses CMAKE and on OBS "-DCMAKE_SKIP_RPATH=ON" is set
>> automatically by the %cmake marco. I can use
>> "-DCMAKE_C_FLAGS="-Wl,-rpath={%_libdir}" and
>> "-DCMAKE_CXX_FLAGS=-Wl,-rpath={%_libdir}" to force passing the flags to gcc
>> and build with RUNPATH on my local computer directly (without using "osc
>> build "). However it gcc will just ignore the "-Wl,-rpath" flag when I use
>> "osc build" or the online building service and no RUNPATH information is
>> written to the binary and .so files.
> You should not set rpath, as openbabel looks for plugins in the specified
> directory by itself.
>
> Have a look at https://github.com/openbabel/openbabel/blob/master/
> CMakeLists.txt
>
> On openSUSE, you should set ENABLE_VERSIONED_FORMATS, and the plugin dir will
> be set to /usr/lib{64}/openbabel/<version>/
>
> Kind regards,
>
> Stefan
>
>

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: -Wl,-rpath={%_libdir} has no effect when building using OBS

Xing
In reply to this post by Brüns, Stefan
It seems that -rpath option will not work in chroot enviroment because gcc is not configued with --with-sysroot in openSUSE and thereore -DCMAKE_SKIP_RPATH should always be set to ON. Anyway the new
build works and the original problems seems to be caused by some uninstalled libraries from previous builds.

Thanks and best wishes,
Xing

On 03/27/2017 05:03 PM, Stefan Bruens wrote:

> On Montag, 27. März 2017 20:34:06 CEST Xing wrote:
>> Dear All,
>> I'm trying to build and package openbabel. It needs the "RUNPATH" tag to run
>> correctly or the "obabel" command will not find the plugin directories.
>> Openbabel uses CMAKE and on OBS "-DCMAKE_SKIP_RPATH=ON" is set
>> automatically by the %cmake marco. I can use
>> "-DCMAKE_C_FLAGS="-Wl,-rpath={%_libdir}" and
>> "-DCMAKE_CXX_FLAGS=-Wl,-rpath={%_libdir}" to force passing the flags to gcc
>> and build with RUNPATH on my local computer directly (without using "osc
>> build "). However it gcc will just ignore the "-Wl,-rpath" flag when I use
>> "osc build" or the online building service and no RUNPATH information is
>> written to the binary and .so files.
> You should not set rpath, as openbabel looks for plugins in the specified
> directory by itself.
>
> Have a look at https://github.com/openbabel/openbabel/blob/master/
> CMakeLists.txt
>
> On openSUSE, you should set ENABLE_VERSIONED_FORMATS, and the plugin dir will
> be set to /usr/lib{64}/openbabel/<version>/
>
> Kind regards,
>
> Stefan
>
>

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: -Wl,-rpath={%_libdir} has no effect when building using OBS

David Haller-4
Hello,

On Thu, 30 Mar 2017, Xing wrote:

>It seems that -rpath option will not work in chroot enviroment because gcc is
>not configued with --with-sysroot in openSUSE and thereore -DCMAKE_SKIP_RPATH
>should always be set to ON. Anyway the new build works and the original
>problems seems to be caused by some uninstalled libraries from previous
>builds.
>
>On 03/27/2017 05:03 PM, Stefan Bruens wrote:
>> On Montag, 27. März 2017 20:34:06 CEST Xing wrote:
>> > Dear All,
>> > I'm trying to build and package openbabel. It needs the "RUNPATH" tag to run
>> > correctly or the "obabel" command will not find the plugin directories.
>> > Openbabel uses CMAKE and on OBS "-DCMAKE_SKIP_RPATH=ON" is set
>> > automatically by the %cmake marco. I can use
>> > "-DCMAKE_C_FLAGS="-Wl,-rpath={%_libdir}" and
>> > "-DCMAKE_CXX_FLAGS=-Wl,-rpath={%_libdir}" to force passing the flags to gcc

First: it's '%{_libdir}', not {%_libdir}. The latter should IIRC get
expanded to e.g. '{/usr/lib64}'. Which might actually work but is wrong.

Second: -Wl, ... are linker flags and irrelevant while compiling (and
thus C(XX)FLAGS). You need to look at LDFLAGS.

And yes, cmake is a pretty borked makesystem. As are all. Well, no,
all are borked but cmake is about the worst, and autotools still the
best, at the least autotools is selfcontained. A configure from 10,
15, 20 years ago should still run and work. It might not quite exactly
be doing what you'll want it to. But that can easily be patched. As
exemplified by dozens of packages in the official SUSE tree.

And no, I have no .spec in my (large) osc tree that mangles LDFLAGS
with cmake. Maybe

    -DCMAKE_LD_FLAGS='-Wl,...'

or something? There might be some patching CMakeFiles.txt to achive
that, that a) I don't want to search for stuff like that and b) it
just goes to show. And c) a lot of stuff could only be patched in
system cmake-files or copying those from who knows where and then
patching. *gah* As I've said: cmake is borked (beyond repair).

Who'd 'a thunk one'd love autotools... Being self-contained and
working even out of decades old tarballs, and easy to grep through
configure*s and Makefile*s ... Beware of "autoreconf" on those cases
though, unless you know how to fix changes. It's easy though,
normally.

-dnh

--
Error: File not found -- search behind couch? (Y/N)
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: -Wl,-rpath={%_libdir} has no effect when building using OBS

Dave Plater lst


On 31/03/2017 00:20, David Haller wrote:
> And yes, cmake is a pretty borked makesystem. As are all.

Scons makes cmake look good.

Dave P
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]