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

Build breaks on FreeBSD: it needs -fPIC #542

Closed
yurivict opened this issue Jan 4, 2020 · 4 comments
Closed

Build breaks on FreeBSD: it needs -fPIC #542

yurivict opened this issue Jan 4, 2020 · 4 comments
Labels
build needtriage Needs to be triaged further

Comments

@yurivict
Copy link

yurivict commented Jan 4, 2020

got version from file /wrkdirs/usr/ports/devel/py-llvmlite/work-py36/llvmlite-0.31.0/llvmlite/_version.py {'version': '0.31.0', 'full': 'fe7d985f6421d87f613bd414479d29d912771562'}
running build_ext
/usr/local/bin/python3.6 /wrkdirs/usr/ports/devel/py-llvmlite/work-py36/llvmlite-0.31.0/ffi/build.py
LLVM version... clang++ -std=c++11 -stdlib=libc++ -shared -I/usr/local/llvm80/include -std=c++11 -fno-exceptions -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti -g assembly.cpp bitcode.cpp core.cpp initfini.cpp module.cpp value.cpp  executionengine.cpp transforms.cpp passmanagers.cpp targets.cpp dylib.cpp  linker.cpp object_file.cpp -o libllvmlite.so -L/usr/local/llvm80/lib -lLLVM-8
ld: error: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

using cmake to build

llvmlite-0.31.0

@stuartarchibald
Copy link
Contributor

Thanks for the report. I'm not sure what the build target is from the above (wheel-like?!) if so perhaps add pic = sys.platform.startswith(('linux', 'freebsd','openbsd')) here:

pic = sys.platform.startswith('linux')
?
if that fixes it please let us know, thanks.

@stuartarchibald stuartarchibald added the needtriage Needs to be triaged further label Jan 8, 2020
@nehaljwani
Copy link
Contributor

nehaljwani commented Mar 28, 2020

I was trying to build llvmlite-v0.30.0 with a build of llvmdev-v8.0.0 (both built using devtoolset-2) and faced the same error on Linux as well. I ended up exporting CXXFLAGS="${CXXFLAGS-} -fPIC"

I am not sure why you are doing it only for building a wheel. In both cases you want to shove object files into a shared library, so they need to have position independent code (at least on Linux).

You do not see this problem with the conda recipe because the activation scripts for the compilers inject -fPIC by default:
https://github.com/AnacondaRecipes/ctng-compiler-activation-feedstock/blob/f9ee66fe68bd6ffacb59894065f2614d8215891f/recipe/conda_build_config.yaml#L29

@karolyi
Copy link

karolyi commented Jul 21, 2020

+1 here, related to #522

@esc esc added the build label Jul 21, 2020
gmarkall added a commit to gmarkall/llvmlite that referenced this issue Aug 21, 2020
On systems that do not build PIC by default, linking libllvmlite.so
fails. This commit adds an option to the `build_ext` command in setup.py
(`--pic`) to compile with `-fPIC`.

Related issues: numba#553, numba#542, numba#522 - this commit may address some of these
issues.
@gmarkall
Copy link
Member

Closing this issue as build with -fPIC on FreeBSD was added in #627.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build needtriage Needs to be triaged further
Projects
None yet
Development

No branches or pull requests

6 participants