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

importing problems with new C functions? #152

Merged
merged 1 commit into from
Jun 5, 2014

Conversation

wkerzendorf
Copy link
Member

Hello

@orbitfold @wkerzendorf

I'm having trouble with import (this is with latest master branch of code):

In [1]: from tardis.tests import montecarlo_test_wrappers
WARNING: ConfigurationDefaultMissingWarning: Requested default configuration file /Users/stuartsim/Tardis/tardis/build/lib.macosx-10.9-x86_64-2.7/tardis/tardis.cfg is not a file. Cannot install default profile. If you are importing from source, this is expected. [tardis._astropy_init]
ERROR: ImportError: dlopen(/Users/stuartsim/Tardis/tardis/build/lib.macosx-10.9-x86_64-2.7/tardis/tests/montecarlo_test_wrappers.so, 2): Symbol not found: _compute_distance2electron
  Referenced from: /Users/stuartsim/Tardis/tardis/build/lib.macosx-10.9-x86_64-2.7/tardis/tests/montecarlo_test_wrappers.so
  Expected in: flat namespace
 in /Users/stuartsim/Tardis/tardis/build/lib.macosx-10.9-x86_64-2.7/tardis/tests/montecarlo_test_wrappers.so [IPython.core.interactiveshell]
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-155ec909d77a> in <module>()
----> 1 from tardis.tests import montecarlo_test_wrappers

ImportError: dlopen(/Users/stuartsim/Tardis/tardis/build/lib.macosx-10.9-x86_64-2.7/tardis/tests/montecarlo_test_wrappers.so, 2): Symbol not found: _compute_distance2electron
  Referenced from: /Users/stuartsim/Tardis/tardis/build/lib.macosx-10.9-x86_64-2.7/tardis/tests/montecarlo_test_wrappers.so
  Expected in: flat namespace
 in /Users/stuartsim/Tardis/tardis/build/lib.macosx-10.9-x86_64-2.7/tardis/tests/montecarlo_test_wrappers.so

This problem means that the test suite doesn't work for me just now. Since it's complaining about computedistance2electon, I wonder if it's something to do with having moved those functions to C? Any suggestions?

@orbitfold
Copy link
Contributor

Hello. Delete build directory and try again? Seems to me that montecarlo_test_wrappers.pyx was not recompiled. I think this happens because montecarlo_test_wrappers.pyx does not know it depends on montecarlo.pyx and thus does not recompiles when montecarlo.pyx changes.

@ssim
Copy link
Contributor Author

ssim commented Jun 4, 2014

Hello - hmmm no, I tried "nuking" the build directory

rm -r /Users/stuartsim/Tardis/tardis/build

but then still get the same problem after first doing:

python setup.py build

then

from tardis.tests import montecarlo_test_wrappers
ERROR: ImportError: dlopen(/Users/stuartsim/Tardis/tardis/build/lib.macosx-10.9-x86_64-2.7/tardis/tests/montecarlo_test_wrappers.so, 2): Symbol not found: _compute_distance2electron
  Referenced from: /Users/stuartsim/Tardis/tardis/build/lib.macosx-10.9-x86_64-2.7/tardis/tests/montecarlo_test_wrappers.so
  Expected in: flat namespace
 in /Users/stuartsim/Tardis/tardis/build/lib.macosx-10.9-x86_64-2.7/tardis/tests/montecarlo_test_wrappers.so [IPython.core.interactiveshell]
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-155ec909d77a> in <module>()
----> 1 from tardis.tests import montecarlo_test_wrappers

ImportError: dlopen(/Users/stuartsim/Tardis/tardis/build/lib.macosx-10.9-x86_64-2.7/tardis/tests/montecarlo_test_wrappers.so, 2): Symbol not found: _compute_distance2electron
  Referenced from: /Users/stuartsim/Tardis/tardis/build/lib.macosx-10.9-x86_64-2.7/tardis/tests/montecarlo_test_wrappers.so
  Expected in: flat namespace
 in /Users/stuartsim/Tardis/tardis/build/lib.macosx-10.9-x86_64-2.7/tardis/tests/montecarlo_test_wrappers.so

In [3]: 

Is there possibly something odd about paths?

@wkerzendorf
Copy link
Member

@orbitfold I get the same problem on my mavericks 10.9 machine

@orbitfold
Copy link
Contributor

Hard to say why this happens. I don't own a Mac to test on. I don't have a similar issue on Linux. Symbol not found means that montecarlo_test_wrappers.so was not linked against anything containing compute_distance2electron which in this case is cmontecarlo.c. So the thing to check is if montecarlo_test_wrappers.pyx is linked against cmontecarlo.c.

@orbitfold
Copy link
Contributor

Yet actual Tardis simulation runs fine right?

@wkerzendorf
Copy link
Member

Nope. It's not importable. It crashes when I do 'from tardis import montecarlo'

@wkerzendorf
Copy link
Member

@ssim @orbitfold I've converted the issue into a PR and attached a fix that @orbitfold and I found.

@wkerzendorf
Copy link
Member

@orbitfold @ssim - ready for merge?

@ssim
Copy link
Contributor Author

ssim commented Jun 5, 2014

I have not tried it out, but it passes ok so I'm happy for us to merge - I will then try it when I get some time? So @wkerzendorf do merge if you are happy.

wkerzendorf added a commit that referenced this pull request Jun 5, 2014
importing problems with new C functions?
@wkerzendorf wkerzendorf merged commit 086ce14 into tardis-sn:master Jun 5, 2014
@ssim
Copy link
Contributor Author

ssim commented Jun 5, 2014

Excellent - and I can now confirm that, at least on my local machine, the tests now pass. I will try a clean setup shortly.

On 5 Jun 2014, at 16:52, Wolfgang Kerzendorf notifications@github.com wrote:

Merged #152.


Reply to this email directly or view it on GitHub.

@orbitfold
Copy link
Contributor

For the record - the problem was with how clang does inlining (well they claim it is the correct behavior). As can be read about here http://clang.llvm.org/compatibility.html#inline

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 this pull request may close these issues.

3 participants