shared object and how to fix?

Linux specific forum
vwidmer
Enthusiast
Enthusiast
Posts: 282
Joined: Mon Jan 20, 2014 6:32 pm

shared object and how to fix?

Post by vwidmer »

As from this topic http://www.purebasic.fr/english/viewtop ... 23&t=66990 this is not a bug. If some one can please help to configure or make this work it would be great thanks.

I am using Arch linux which recently decided to enable PIE and SSP in gcc. What ever changes they made has also affected PureBasic so now that when I build anyting it will be flaged as "shared object" and not "executable".

I have found this example how to fix it in gcc so if some one knows how I can apply or do something similar in PureBasic it would fix this issue I think.

Code: Select all

You should add -no-pie option to compilation command line

without :

$ gcc main.c -o main

$ file main

main:ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=46ada4e5e25fc120ca052c9beb8bfa5491fc6239, not stripped

wtih :

$ gcc main.c -o main -no-pie

$ file main

main: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=17f860c6c84fc1a5771c8744b7aaaf164c219559, not stripped
Thanks
WARNING: I dont know what I am doing! I just put stuff here and there and sometimes like magic it works. So please improve on my code and post your changes so I can learn more. TIA
vwidmer
Enthusiast
Enthusiast
Posts: 282
Joined: Mon Jan 20, 2014 6:32 pm

Re: shared object and how to fix?

Post by vwidmer »

Some times the answers are staring you right in the face.. then they just slap you because you didnt see it earlier :)

Anyways if any one else is having this issue this seemed to fix it for me by just adding this to the top of the code.

Code: Select all

ImportC "-no-pie" : EndImport
Hope it helps some one else and I am happy to be able to make "executable" files again and not "shared object" files :)
WARNING: I dont know what I am doing! I just put stuff here and there and sometimes like magic it works. So please improve on my code and post your changes so I can learn more. TIA
User avatar
Sicro
Enthusiast
Enthusiast
Posts: 538
Joined: Wed Jun 25, 2014 5:25 pm
Location: Germany
Contact:

Re: shared object and how to fix?

Post by Sicro »

Thank you so much! I had the same problem.
Image
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
Post Reply