Build KLayout 0.25 on macOS

edited April 2017 in KLayout Support


I am trying to build the latest version of KLayout from your Git on macOS Sierra. I am trying to build this using QT5 support (since retina screens are supported in QT5). However, I am struggling to build this version on macOS. I had no trouble building it on a Ubuntu box, however, on my mac system, it stops building and gives the following error:

../klayout/src/gsi/gsiClass.h:256:24: error: 'take_object' following the 'template' keyword does not refer to a template
return from.template take_object ();

../klayout/src/gsi/gsiClass.h:256:35: error: expected unqualified-id
return from.template take_object ();
../klayout/src/gsi/gsiClass.h:256:36: error: 'X' does not refer to a value
return from.template take_object ();
../klayout/src/gsi/gsiClass.h:253:17: note: declared here
../klayout/src/gsi/gsiClass.h:256:40: error: expected expression
return from.template take_object ();

I tried to build both using Apple's build-in clang, as well as a homebrew version of gcc/g++, but both give this error. Any suggestions on how to fix this issue?


  • edited April 2017

    Hi nicoh,

    which clang and gcc version are you using?

    You can try to delete the "template" keyword. That may break the build on other systems, so I have to check that for other compilers.


    P.S. please don't expect the master on GitHub to be stable.

  • edited 8:54PM

    Hi Matthias,

    Thanks for your comment. I am using Apple LLVM version 8.1.0 (clang-802.0.41) and also i have tried gcc 6.3.0.

    What exactly do you mean by 'delete the template keyword'? If I comment out the section of code (253-256) that gives these errors, it will build on for quite some time, before stopping the build at:

    ../klayout/src/db/ error: explicit specialization of 'instance' after instantiation
    template<> DB_PUBLIC tl::Registrar *tl::Registrar::instance = 0;

  • edited 8:54PM

    I mean:


    from.template take_object<X> ();


    from.take_object<X> ();


  • edited May 2017
    Thanks for the reply. This also does not seem to help:
    ../klayout/src/gsi/gsiClass.h:256:15: error: use of undeclared identifier 'take_object' return from take_object<X> ();
    ../klayout/src/gsi/gsiClass.h:256:27: error: 'X' does not refer to a value return from take_object<X> ();
    ../klayout/src/gsi/gsiClass.h:253:17: note: declared here template <class X>
    ../klayout/src/gsi/gsiClass.h:256:31: error: expected expression return from take_object<X> ();
Sign In or Register to comment.