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

Windows: -fPIC is added even platform is position independent #14

Closed
luislavena opened this issue Mar 8, 2013 · 3 comments
Closed

Windows: -fPIC is added even platform is position independent #14

luislavena opened this issue Mar 8, 2013 · 3 comments

Comments

@luislavena
Copy link

Hello,

While attempting to cross-compile libsodium to Windows (from OSX using mingw-w64 GCC 4.5.4), I've encountered several warnings during compilation:

Making all in include
make[3]: Nothing to be done for `all'.
  CC       libsodium_la-core_hsalsa20.lo
crypto_core/hsalsa20/ref2/core_hsalsa20.c:1:0: warning: -fPIC ignored for target (all code is position independent)
  CC       libsodium_la-core_salsa20.lo
crypto_core/salsa20/ref/core_salsa20.c:1:0: warning: -fPIC ignored for target (all code is position independent)
  CC       libsodium_la-core_salsa2012.lo
crypto_core/salsa2012/ref/core_salsa2012.c:1:0: warning: -fPIC ignored for target (all code is position independent)
  CC       libsodium_la-core_salsa208.lo
crypto_core/salsa208/ref/core_salsa208.c:1:0: warning: -fPIC ignored for target (all code is position independent)

Perhaps -fPIC check done in configure.ac can evaluate the platform being targeted?

Environment information:

$ uname -v
Darwin Kernel Version 12.2.1: Thu Oct 18 12:13:47 PDT 2012; root:xnu-2050.20.9~1/RELEASE_X86_64

$ i686-w64-mingw32-gcc --version
i686-w64-mingw32-gcc (GCC) 4.5.4 20110822 (prerelease)

Cross-compiler was obtained from mingw-w64 project.

Thank you

❤️ ❤️ ❤️

@jedisct1
Copy link
Owner

jedisct1 commented Mar 8, 2013

This warning is really harmless, the compiler is actually saying "hey, I'm doing what you expected".
We definitely want the code to be position-independent. I don't know if this is the case by default for all versions of MingW and if it will always be the case.
Do you know of a reliable way with autoconf to detect if some compilation option spits out a warning? Or if there is a -Wno-* switch we could use?

@luislavena
Copy link
Author

I don't know if this is the case by default for all versions of MingW and if it will always be the case.

http://en.wikipedia.org/wiki/Position-independent_code#Windows_DLLs

Do you know of a reliable way with autoconf to detect if some compilation option spits out a warning?

http://stackoverflow.com/a/4787225/117298

I think libtool is already aware of this?

@jedisct1
Copy link
Owner

libtool doesn't seem to be aware of this. Removing -fPIC from our configure.ac file causes libtool to re-add it no matter what.
I'll look at it later. This doesn't change the compiled code in any ways.

Repository owner locked and limited conversation to collaborators Aug 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants