Compilation failed (ver. 0.24.4)

edited January 2016 in General
Hi,

I run build.sh and got the following errors during compilation:

----------------
/home/stolbikov/SKLAD/KLAYOUT/klayout-0.24.4/src/pyaConvert.h: In function 'bool pya::test_type(PyObject*, bool) [with T = const char*]':
/home/stolbikov/SKLAD/KLAYOUT/klayout-0.24.4/src/pyaConvert.h:172: error: 'PyByteArray_Check' was not declared in this scope
/home/stolbikov/SKLAD/KLAYOUT/klayout-0.24.4/src/pya.cc: In function 'void pya::set_type_attr(PyTypeObject*, const std::string&, pya::PythonRef&)':
/home/stolbikov/SKLAD/KLAYOUT/klayout-0.24.4/src/pya.cc:617: error: invalid conversion from 'const char*' to 'char*'
/home/stolbikov/SKLAD/KLAYOUT/klayout-0.24.4/src/pya.cc: In function 'PyObject* pya::object_dup(PyObject*, PyObject*)':
/home/stolbikov/SKLAD/KLAYOUT/klayout-0.24.4/src/pya.cc:788: error: 'Py_TYPE' was not declared in this scope
-----------------

And so on.

I use the following operating system:
Linux version 2.6.18-238.el5 (mockbuild@x86-012.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)) #1 SMP Sun Dec 19 14:22:44 EST 2010

What can be the problem?

Thank you,
Eugene

Comments

  • edited November -1

    Hi Eugene,

    The log is a bit sparse, so I can't tell much. But my first guess is the Python version not being compatible with KLayout's code. Could you tell me the Python version you compile against?

    If you don't require Python you can skip Python using the "-nopython" option on build.sh.

    Matthias

  • edited November -1
    Hi Matthias,

    You are right, I have Python 2.4.3 and ruby 1.8.5 and both these versions are not supported.
    I was able to compile klayout only with -nopython and -noruby options.
    Thank you very much for your help.
    Your klayout is the best and very helpful!
  • edited November -1

    Thanks for your feedback :-)

    Ruby should be 1.8.7 at least and Python has to be 2.6 at least. Older versions lack vital features which are very hard to emulate.

    Regards,

    Matthias

  • edited November -1
    Hi Matthias,

    I decided to install Klayout with Ruby and Python support and installed the latest tools versions: Ruby-2.3.0 and Python-3.5.1.
    They are installed successfully without errors.
    Then I run klayout compilation like ./build.sh -qt /tools/Qt-4.8.6
    An I got the following report:

    ------------------------------------------------------------------------
    Scanning installation ..

    Using Ruby interpreter: ruby
    Ruby version code is 20300
    Ruby library found: /proj/memcom/releases/tools/ruby-2.3.0/lib/libruby.so.2.3.0
    Ruby headers found: /proj/memcom/releases/tools/ruby-2.3.0/include/ruby-2.3.0 and /proj/memcom/releases/tools/ruby-2.3.0/include/ruby-2.3.0/x86_64-linux
    Ruby installation is in:
    - /proj/memcom/releases/tools/ruby-2.3.0/lib/libruby.so.2.3.0 (lib)
    - /proj/memcom/releases/tools/ruby-2.3.0/include/ruby-2.3.0 (includes)
    - /proj/memcom/releases/tools/ruby-2.3.0/include/ruby-2.3.0/x86_64-linux (config for 1.9.x)

    Using Python interpreter: python
    Python library found: /usr/lib64/libpython2.4.so
    Python headers found: /usr/include/python2.4
    Python installation is in:
    - /usr/lib64/libpython2.4.so (lib)
    - /usr/include/python2.4 (includes)

    Qt installation directory is /tools/Qt-4.8.6/lib (lib), /tools/Qt-4.8.6/bin (tools) and /tools/Qt-4.8.6/include (includes)

    Platform is linux-64-gcc-release
    *** ERROR: wrong -rblib path: /proj/memcom/releases/tools/ruby-2.3.0/lib/libruby.so.2.3.0 does not exist or not a file
    ------------------------------------------------------------------------

    Here, in first strings your build.sh script says that
    "Ruby library found: /proj/memcom/releases/tools/ruby-2.3.0/lib/libruby.so.2.3.0"
    But in real it is absent, but /proj/memcom/releases/tools/ruby-2.3.0/lib/libruby-static.a is only present.

    Looking in your build.sh I found that you check these files using ruby functions and libruby-static.a is checking only if
    $RUBYLIBFILENAME is empty after first check:

    ------------------------------------------------------------------------
    # Get ruby installation files
    if [ "$RUBYLIBFILE" = "" ]; then
    RUBYLIBFILENAME=`$RUBY -rrbconfig -e "puts (RbConfig::CONFIG['LIBRUBY_SO'] || '')"`
    if [ "$RUBYLIBFILENAME" = "" ]; then
    RUBYLIBFILENAME=`$RUBY -rrbconfig -e "puts (RbConfig::CONFIG['LIBRUBY_A'] || '')"`
    fi
    ------------------------------------------------------------------------

    But in my case ruby -rrbconfig -e "puts (RbConfig::CONFIG['LIBRUBY_SO'] || '')" returns libruby.so.2.3.0 even if file is absent.

    I had to comment first check to enter in second "if" to define RUBYLIBFILENAME=libruby-static.a.
    Then compilation gone forward.

    Is it a bug in build.sh or some issues in my ruby installation?

    Best regards,
    Eugene.
  • edited November -1

    Hi Eugene,

    the composition of Ruby's CONFIG repository is still a bit magic to me ... what precisely is to be taken when I am not sure. I was assuming that if RbConfig::CONFIG['LIBRUBY_SO'] is given there should be such a library, but apparently that's not always the case.

    In general, there seems to be some confusion about what's better to use: shared objects or static libraries. In some Ruby versions the shared library was not fully functional while with static libraries Ruby is able to mess up your application since it provides overloads for "fopen" and other basic system functions.

    Today, all Linux packages come with shared objects now so I used that as a my first preference. But self-built installations often lack the shared object since "--enable-shared" has to be explicitly enabled when building Ruby. Nevertheless the build script should rather check for the shared object as an option than taking it's presence for granted.

    Thanks for mentioning this,

    Matthias

  • edited November -1
    Matthias,

    Yessss! Finally I got Klayout compiled successfully with support of Ruby and Python.

    Klayout compilation failed with Ruby 2.3.0 that is compiled with static libraries, even if I fixed your build.sh.
    I used "--enable-shared" option for Ruby compilation and Klayout compilation gone forward, but failed at Python 3.5.1.
    I installed Python 2.7.11 and then got Klayout compilation passed.

    Best regards,
    Eugene.
  • edited February 2016

    Hi Eugene,

    I have not tried Python 3.5.1 yet. The most recent one I used so far was 3.4.3. I'd need much more compute power to try all combinations myself.

    Regards,

    Matthias

Sign In or Register to comment.