Build problems with KLayout/Python

Hi there,

Trying to build KLayout and it's failing. I'm using a different install of Python and using the -python argument to build.sh. Not sure if this is what's triggering the problem.

Sub-components are failing to link because of missing references to libpythonXXX.so. The libpythonXXX.so is missing from the link command. If you manually redo the link and add the libpythonXXX.so to the end it succeeds - but it looks like there are a whole lot of these links to do - to many to do manually each time.

Example output from make/build.sh

Entering directory `[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds'
g++ -Wl,-O1 -Wl,-z,relro -o ../../../../build-release/strm2gds main.o    -L/usr/lib64 -L/home/simon/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../.. -lklayout_bd -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_lib -lklayout_rdb -lklayout_rba -lklayout_pya /usr/lib64/libruby.so.2.0.0 -lQtScript -lQtSql -lQtXml -lQtGui -lQtNetwork -lQtCore -lQtDesigner -lpthread 
/bin/ld: warning: libpython3.6m.so.1.0, needed by [manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so, not found (try using -rpath or -rpath-link)
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyErr_SetNone'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyLong_FromLong'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyUnicode_AsUTF8String'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyDict_SetItem'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyModule_Create2'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyByteArray_Type'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyDict_SetItemString'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `_Py_FalseStruct'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyImport_ImportModule'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyDescr_NewClassMethod'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyType_IsSubtype'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyModule_GetDict'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyObject_SetAttrString'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyErr_Fetch'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyErr_GivenExceptionMatches'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyLong_AsUnsignedLongLongMask'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyExc_RuntimeError'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyWeakref_GetObject'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyDescr_NewMethod'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyTuple_GetSlice'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyDict_Size'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyUnicode_DecodeUTF8'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyErr_SetString'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyObject_CallObject'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PySys_GetObject'
[manually redacted]/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../../libklayout_pya.so: undefined reference to `PyList_GetItem'

etc etc

To manually fix it I go:

prompt$ cd buddies/src/strm2gds
prompt$ g++ -Wl,-O1 -Wl,-z,relro -o ../../../../build-release/strm2gds main.o    -L/usr/lib64 -L/home/simon/klayout/klayout-0.25.8/build-release/buddies/src/strm2gds/../../.. -lklayout_bd -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_lib -lklayout_rdb -lklayout_rba -lklayout_pya /usr/lib64/libruby.so.2.0.0 -lQtScript -lQtSql -lQtXml -lQtGui -lQtNetwork -lQtCore -lQtDesigner -lpthread** [manually removed]/lib/libpython3.6m.so**
prompt$ cd ../../..

It works fine - but then going back and running make just moves on to the next link with the missing lipythonxyz.so

Comments

  • Hi,

    to be able to help, I'd need the full log. I also need to know what's the OS and the precise build command you're using.

    Matthias

  • my workaround was to add the python library path to $LD_LIBRARY_PATH.

Sign In or Register to comment.