Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always use --pic when using GCC on Linux #1811

Closed
SeanTAllen opened this issue Apr 5, 2017 · 9 comments
Closed

Always use --pic when using GCC on Linux #1811

SeanTAllen opened this issue Apr 5, 2017 · 9 comments
Assignees

Comments

@SeanTAllen
Copy link
Member

Solution to #1484 has been decided that we will check for gcc for running on linux and use --pic in those cases by default. We believe this should make for a better experience for users. It might cause some issues but we can address them if they arises.

@SeanTAllen
Copy link
Member Author

We decided against this.

@sebastien
Copy link

Hi Sean, could you explain that decision? I just installed Pony on Ubuntu 16.10 and ran into the exact same problem. I'm thinking about others who like me ran into the same issue but might have just given up -- and leaving with a bad first impression of Pony (ie: it doesn't even compile "helloworld").

@SeanTAllen
Copy link
Member Author

Hi @sebastien, I can.

Some Linux distros require --pic, others don't. Building with --pic everywhere would hurt performance on platforms where it isn't required. As such we decided that doing for gcc in general was a bad idea. There are probably better ways to address than the rather blunt instrument of turning on for gcc.

@sebastien
Copy link

OK, so what about testing for $DISTRIB_ID="Ubuntu" and set the --pic flag accordingly in the build system?

@SeanTAllen
Copy link
Member Author

SeanTAllen commented Jun 27, 2017 via email

@jemc
Copy link
Member

jemc commented Jun 27, 2017

@sebastien Sorry, I'm a bit lost - where does this DISTRIB_ID come from?

@sebastien
Copy link

@jemc it is defined in /etc/lsb_release. I am not sure where to add the code, but if it were to be in pony's Makefile, it would look like this:

ifeq ($(shell test -f /etc/lsb-release && grep DISTRIB_ID /etc/lsb-release | cut -d= -f2),Ubuntu)
    BUILD_FLAGS  += --pic
    LINKER_FLAGS += --pic
endif

Am happy to create a pull request if you can point me to which file sets up the build environment variables for the ponyc command.

@insanitybit
Copy link

Curious - is the PIC performance impact measurable? In particular, I wonder if it would make sense to just enabled PIC on x86_64 hardware, where afaik there is no meaningful performance impact.

@SeanTAllen
Copy link
Member Author

There's definitely a performance impact. It adds a level of indirection that wouldn't otherwise exist. The higher the load on your system, the more you will feel the impact of that impact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants