Compilation failed (ver. 0.24.4)

edited January 2016 in General

I run 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/ In function 'void pya::set_type_attr(PyTypeObject*, const std::string&, pya::PythonRef&)':
/home/stolbikov/SKLAD/KLAYOUT/klayout-0.24.4/src/ error: invalid conversion from 'const char*' to 'char*'
/home/stolbikov/SKLAD/KLAYOUT/klayout-0.24.4/src/ In function 'PyObject* pya::object_dup(PyObject*, PyObject*)':
/home/stolbikov/SKLAD/KLAYOUT/klayout-0.24.4/src/ 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 ( (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,


  • 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


  • 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.



  • 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 ./ -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/
    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/ (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/
    Python headers found: /usr/include/python2.4
    Python installation is in:
    - /usr/lib64/ (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/ does not exist or not a file

    Here, in first strings your script says that
    "Ruby library found: /proj/memcom/releases/tools/ruby-2.3.0/lib/"
    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 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'] || '')"`

    But in my case ruby -rrbconfig -e "puts (RbConfig::CONFIG['LIBRUBY_SO'] || '')" returns 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 or some issues in my ruby installation?

    Best regards,
  • 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,


  • edited November -1

    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
    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,
  • 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.



Sign In or Register to comment.