Skip to contentSkip to conversation

linker error installing xenomai-3.0.4 using gcc-6

Xenomai alessio margan 3 participants 3 messages May 11, 2017 – May 13, 2017

lore
Share & tools
lore
#0 lore raw

Hi,

using gcc-6 to install xenomai 3.0.4 libraries give me errors probably due to gcc-6 compiled with --enable-default-pie option.

"/usr/bin/ld -r and -pie may not be used together"

as workaround I've used gcc-5.

How could solve this issue ?

TIA

Alessio

Signature · 26 lines
ISTITUTO ITALIANO DI TECNOLOGIA

Alessio Margan
Chief Technician
Advanced Robotics Department

[email protected]
Via Morego 30, 16163 Genova
Tel. +39 010 71781-754

www.iit.it

Legal Disclaimer
This electronic message contains information that is confidential. The information is intended for the use of the addressee only.
If you are not the addressee we would appreciate your notification in this respect.
Please note that any disclosure, copy, distribution or use of the contents of this message is prohibited and may be unlawful.
We have taken every reasonable precaution to ensure that any kind of attachment to this e-mail has been swept for viruses.
However, we cannot accept liability for any damage sustained as a result of software viruses
and would advise you to carry out your own virus checks before opening any attachment.
Avvertenza legale
Questo messaggio Email contiene informazioni confidenziali riservate ai soli destinatari.
Qualora  veniate in possesso di tali informazioni senza essere definito come destinatario vi reghiamo di leggere le seguenti note.
Ogni apertura, copia, distribuzione del contenuto del messaggio e dei suoi allegati è proibito e potrebbe violare le presenti leggi.
Abbiamo attivato ogni possibile e ragionevole precauzione per assicurare che gli allegati non contengano virus.
Comunque non assumeremo alcuna responsabilità per ogni eventuale danno causato da virus software e simili
in quanto è onere del destinatario verificarne l’assenza in ogni allegato attuando propri indipendenti controlli.
#1 lore raw
Quoted 11 lines · alessio margan

Hi,

using gcc-6 to install xenomai 3.0.4 libraries give me errors probably due to gcc-6 compiled with --enable-default-pie option.

"/usr/bin/ld -r and -pie may not be used together"

as workaround I've used gcc-5.

How could solve this issue ?

The configure script considers CC/LD flags which are preset at invocation time, so you may want to try this:

.../configure CFLAGS=-no-pie CXXFLAGS=-no-pie LDFLAGS=-no-pie <other switches>

Signature · 1 line
Philippe.
#2 lore raw

----- On May 11, 2017, at 5:25 PM, Philippe Gerum [email protected] wrote:

Quoted 11 lines · alessio margan

Hi,

using gcc-6 to install xenomai 3.0.4 libraries give me errors probably due to gcc-6 compiled with --enable-default-pie option.

"/usr/bin/ld -r and -pie may not be used together"

as workaround I've used gcc-5.

How could solve this issue ?

The configure script considers CC/LD flags which are preset at invocation time, so you may want to try this:

.../configure CFLAGS=-no-pie CXXFLAGS=-no-pie LDFLAGS=-no-pie <other switches>

Signature · 69 lines
Philippe.


I had the same problem running on Debian Stretch.

I tried several combinations of CFLAGS=-fno-pie -fno-PIE LDFLAGS=-no-pie with no succes.

For example:

/configure --with-core=cobalt --enable-smp --enable-pshared CFLAGS="-v -fPIC -fno-pie -fno-PIE"  CXXFLAGS="-fno-pie -fno-PIE" LDFLAGS="-no-pie -shared"

results in:

configure: error: cannot run C compiled programs.

I then resulted just like you to installing an older gcc next to the Debian Stretch system gcc-6.3.0

Still interested in the problem I recently downloaded the GCC source code and ran grep which returned in gcc/defaults.h

/* Default value for flag_pie when flag_pie is initialized to -1:
   --enable-default-pie: Default flag_pie to -fPIE.
   --disable-default-pie: Default flag_pie to 0.
 */
#ifdef ENABLE_DEFAULT_PIE
# ifndef DEFAULT_FLAG_PIE
#  define DEFAULT_FLAG_PIE 2
# endif
#else
# define DEFAULT_FLAG_PIE 0
#endif

I then decided to configure the gcc source code with similar options to the Debian system default GCC except I choose --disable-default-pie

I configured, build, tested and installed in my home directory, nicely separated from the Debian system default.

With update-alternatives I can now switch between the two.

capsugel@debian:~$ gcc -v
Using built-in specs.                                                                                                                                        
COLLECT_GCC=gcc                                                                                                                                              
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper                                                                                              
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-16' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 6.3.0 20170425 (Debian 6.3.0-16) 
capsugel@debian:~$ sudo update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

  Selection    Path                                                  Priority   Status
------------------------------------------------------------
* 0            /usr/bin/gcc-6                                         60        auto mode
  1            /home/capsugel/RT/gcc/usr/bin/x86_64-linux-gnu-gcc-6   40        manual mode
  2            /usr/bin/gcc-6                                         60        manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /home/capsugel/RT/gcc/usr/bin/x86_64-linux-gnu-gcc-6 to provide /usr/bin/gcc (gcc) in manual mode
capsugel@debian:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/capsugel/RT/gcc/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/capsugel/RT/gcc/source/gcc-6.3.0/configure -v --with-pkgversion='RT 2017-05-07' --enable-languages=c,c++ --prefix=/home/capsugel/RT/gcc/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/home/capsugel/RT/gcc/usr/lib --without-included-gettext --enable-threads=posix --libdir=/home/capsugel/RT/gcc/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --disable-default-pie --with-system-zlib --disable-browser-plugin --with-target-system-zlib --enable-multiarch --with-arch-32=i686 --with-abi=m64 --disable-multilib --with-tune=generic --enable-checking=release
Thread model: posix
gcc version 6.3.0 (RT 2017-05-07) 
capsugel@debian:~$ 

That is what works for me so far.

Gino