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 on py3 #64

Open
nbecker opened this issue Jun 27, 2016 · 5 comments
Open

build on py3 #64

nbecker opened this issue Jun 27, 2016 · 5 comments

Comments

@nbecker
Copy link
Contributor

nbecker commented Jun 27, 2016

I just checked out fresh copy of master. I had to fix one config test 1st:

diff --git a/python.py b/python.py
index 21a918e..e99445e 100644
--- a/python.py
+++ b/python.py
@@ -97,8 +97,12 @@ def CheckNumPy(context):
 #undef _DEBUG
 #include "Python.h"
 #include "numpy/arrayobject.h"
+#if PY_MAJOR_VERSION == 2
 void doImport() {
-  import_array();
+#else
+void * doImport() {
+#endif
+    import_array();
 }
 int main()
 {

But now build stops, hard to track this down:

/usr/bin/python3 /home/nbecker/scons/bootstrap/src/script/scons.py --config=force --debug=stacktrace --with-boost-include=/home/nbecker/ndarray.new/../include --with-boost-lib=/home/nbecker/ndarray.new/../lib --with-eigen-include=/usr/include/eigen3 --prefix=/home/nbecker/ndarray.new/../.local install CCFLAGS=-g -O3 -march=native --boost-python-lib=boost_python3
scons: Reading SConscript files ...
Check building with Eigen... yes
Check building against fftw... yes

*** No errors detected
Check building against Boost.Test... yes
Check building against Python... yes
Check building against NumPy... yes
Checking for SWIG...no
Check building against Boost.Preprocessor... yes
Check building against Boost.Python... yes
  File "<string>", line 20

    bin = env.Program(target="%s.test" % source, source=source)

                                                              ^

TabError: inconsistent use of tabs and spaces in indentation

@nbecker
Copy link
Contributor Author

nbecker commented Jun 27, 2016

Found the problem:

diff --git a/tests/SConscript b/tests/SConscript
index 7955aa9..25a0645 100644
--- a/tests/SConscript
+++ b/tests/SConscript
@@ -17,7 +17,7 @@ def RunBinaryUnitTest(target, source, env):

 def BinaryUnitTest(env, source, dependencies=None):
     if os.name != 'nt':
-       bin = env.Program(target="%s.test" % source, source=source)
+        bin = env.Program(target="%s.test" % source, source=source)
     else:
         bin = env.Program(source)
     run = env.Command(".%s.succeeded" % str(source), bin, RunBinaryUnitTest)

@TallJimbo
Copy link
Member

Thanks. Fix will be up shortly; I'm trying to reproduce this with the CI system I'm putting together right now, but if I can't get that working quickly I'll just apply your patch.

@TallJimbo
Copy link
Member

So, this wasn't as simple as I thought:

  • I don't understand how you're building on Python 3 at all using SCons; did you hack your SCons install? SCons itself claims not to support Python 3, and indeed the one I have does not work with the command you've shown above. I've pretty much switched to using CMake build myself, and that definitely works with Python 3. It looks like there are also other places where Python 2 is assumed in the SConsChecks submodule, which makes sense if it's assuming only Python 2 is possible via SCons.
  • I don't seen any indentation problems in tests/SConscript; are you sure that isn't something local?

@nbecker
Copy link
Contributor Author

nbecker commented Jun 27, 2016

Yes I hacked scons - although there should be a usable upstream version at
this point

I don't know how tests/SConscript got a problem since I am working from a
clean pull and didn't touch it AFAIK, but anyway untabify fixed it for me.

On Mon, Jun 27, 2016 at 10:12 AM, Jim Bosch [email protected]
wrote:

So, this wasn't as simple as I thought:

  • I don't understand how you're building on Python 3 at all using
    SCons; did you hack your SCons install? SCons itself claims not to support
    Python 3, and indeed the one I have does not work with the command you've
    shown above. I've pretty much switched to using CMake build myself, and
    that definitely works with Python 3. It looks like there are also other
    places where Python 2 is assumed in the SConsChecks submodule, which makes
    sense if it's assuming only Python 2 is possible via SCons.
  • I don't seen any indentation problems in tests/SConscript; are you
    sure that isn't something local?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#64 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAHK0JLOgaFPl4SU7LwD-kJICMuDT5Keks5qP9owgaJpZM4I_FnX
.

Those who don't understand recursion are doomed to repeat it

@TallJimbo
Copy link
Member

I've submitted a PR for the first issue at classner/SConsChecks#1. I'll keep this open until that's done and the submodule is updated.

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

2 participants