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

ldc can't link embedded python properly on ubuntu #43

Open
ariovistus opened this issue Nov 11, 2015 · 12 comments
Open

ldc can't link embedded python properly on ubuntu #43

ariovistus opened this issue Nov 11, 2015 · 12 comments

Comments

@ariovistus
Copy link
Owner

and probably anywhere Py_ENABLE_SHARED is false.
symptom:
ImportError: /usr/lib/python3/dist-packages/numpy/core/multiarray.cpython-32mu.so: undefined symbol: PyExc_SystemError

ramification:
can't use numpy and other extensions

solution: insert -rdynamic early in the link flags. unfortunately, ldc rearranges flag order, and exposes no way to override.

other solution: go back to gcc for link command. please no.

@lomereiter
Copy link

Is -rdynamic the only possible workaround? Quick googling shows that many solve this problem just by adding dlopen("libpython<PYTHON_VERSION>.so.1", RTLD_LAZY | RTLD_GLOBAL); before Py_Initialize()

@JohanEngelen
Copy link

LDC has recently changed the linker flag order behavior. Please try again, and otherwise open an issue with LDC, thanks!

@ariovistus
Copy link
Owner Author

I assume this would be in 1.6?

@JohanEngelen
Copy link

JohanEngelen commented Dec 18, 2017

Yes indeed, 1.6.0 has what I meant.
I may be remembering things wrong. But we had a discussion and some changes related to linking flags and their order (but perhaps only related to the flags in ldc.conf)

@ariovistus
Copy link
Owner Author

Ok. will check it out when I get some time.

@ariovistus
Copy link
Owner Author

there wouldn't happen to be a quicker way to install than build from source, would there? on 16.04, apt-get serves 0.17.1

@JohanEngelen
Copy link

curl -fsS https://dlang.org/install.sh | bash -s install ldc

@JohanEngelen
Copy link

@wilzbach
Copy link
Contributor

@JohanEngelen
FYI: We can do it even a bit shorter: curl i.dlang.io | bash -s ldc

Since yesterday we also have a documentation page for the installer: https://dlang.org/install.html

@ariovistus
Copy link
Owner Author

Looks like ubuntu stopped building python with Py_ENABLE_SHARED=false, so this might not be much of an issue anymore.

@JohanEngelen
Copy link

@wilzbach

FYI: We can do it even a bit shorter: curl i.dlang.io | bash -s ldc

Brevity here is useless, and harms intelligibility. The original one at least makes it clear that you are downloading a shell script, and that you are installing ldc.

The installer page is very nice. (link needs to be added to the top menu!)

@ariovistus
Copy link
Owner Author

ubuntu 12.04 has an appropriate python build.
With pyd from master and ldc 1.6.0, the following code is sufficient to trigger the aforementioned symptom:

auto context = new InterpContext();
context.py_stmts("import numpy");

This issue has been collecting dust long enough that I do not remember how to get link to work with -rdynamic. Will need to play with it.

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

No branches or pull requests

4 participants