robotology-legacy / qtyarp

QtYarp
1 stars 1 forks source link

Compilation fails with QtYARPScope and QtYARPView ON #5

Closed kt10aan closed 10 years ago

kt10aan commented 10 years ago

Hi,

Compilation fails with QtYARPScope and/or QtYARPView ON

Make output: https://gist.github.com/kt10aan/9982728

Tested on Ubuntu 14.04 and Debian Jessie.

drdanz commented 10 years ago

This is due to YARP compiled static and the Qt plugin dynamic. There are 2 options to fix this: 1) Force users to build YARP with shared libraries 2) Force cmake to use -fPIC when building the static library. In iCub we are always using static libraries with the -fPIC flag, @lornat @paulfitz is there a reason why we are not doing it in YARP

paulfitz commented 10 years ago

@drdanz fine to add -fPIC. My guideline with cmake has been to only do funky things when they were needed, since they have a cost. There is a cost here (user understanding of a somewhat arcane issue) so ok to add -fPIC. But @drdanz do you know if there's a consensus within e.g. Debian that static libraries should be compiled with -fPIC? A quick web search brought up strong arguments for, against, and people providing *_pic.a versions and non-fPIC versions.

drdanz commented 10 years ago

@paulfitz I think that there is a consensus in within Debian that libraries should be shared... The static version is optional. We are building yarp either shared or static, never both (and I don't think we should) so I don't think this is an issue for distributions that will build just the shared version.

From https://www.debian.org/doc/debian-policy/ch-sharedlibs.html#s-sharedlibs-static : " The static library (libraryname.a) is usually provided in addition to the shared version. It is placed into the development package (see below). "

Anyway there is this: https://wiki.debian.org/Hardening#DEB_BUILD_HARDENING_PIE_.28gcc.2Fg.2B-.2B-_-fPIE_-pie.29

It talks about executables and not static libraries, but I think that the issue might be the same

drdanz commented 10 years ago

Fixed in yarp with commit robotology/yarp@d979bd62