Need help packaging quantum-blackbird (antlr4-common.h: No such file or directory)

Hello,

I have been trying to package python-quantum-blackbird.

https://build.opensuse.org/package/show/home:andythe_great/python-quantum-blackbird
https://github.com/XanaduAI/blackbird

I tried installing the libraries and header files for C++ but failed.

The error can be reproduce on my local machine .
Step to reproduce on local machine.

  1. Download source from github https://github.com/XanaduAI/blackbird/archive/v0.2.1.tar.gz
  2. Extract it
  3. Required libantlr4-runtime-devel as dependencies so install it with sudo zypper in libantlr4-runtime-devel.
  4. Change directory to blackbird_cpp folder.
  5. cmake .
  6. sudo make install
  7. Error as shown below.
Scanning dependencies of target blackbird
 20%] Building CXX object CMakeFiles/blackbird.dir/Visitor.cpp.o
In file included from /usr/include/antlr4-runtime/CharStream.h:9,
                 from /usr/include/antlr4-runtime/ANTLRInputStream.h:8,
                 from /usr/include/antlr4-runtime/ANTLRFileStream.h:8,
                 from /usr/include/antlr4-runtime/antlr4-runtime.h:14,
                 from /home/kev/Desktop/quantum-blackbird-0.2.4/blackbird_cpp/Blackbird.h:23,
                 from /home/kev/Desktop/quantum-blackbird-0.2.4/blackbird_cpp/Visitor.cpp:16:
/usr/include/antlr4-runtime/misc/Interval.h:8:10: fatal error: antlr4-common.h: No such file or directory
    8 | #include "antlr4-common.h"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/blackbird.dir/build.make:82: CMakeFiles/blackbird.dir/Visitor.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/blackbird.dir/all] Error 2
make: *** [Makefile:149: all] Error 2


It complain about fatal error: antlr4-common.h: No such file or directory, but antlr4-common.h should be provided by libantlr4-runtime-devel. SO what is going on here?
Thank you

If this file is not in one of default include directories you either need to specify correct include directory during compilation (-I…) or patch sources to use path relative to one of standard include directories.

What is the -I thing you speak of?
Thanks

I changing the directories in CmakeList.txt to,

include_directories(/usr/include/)
include_directories(/usr/include/antlr4-runtime/)

which fix the antlr4 issue, but a whole new problem occur.
Thanks anyway.

Hi
The -I is the way to (-I)nclude a directory, look in the CmakeList.txt and look for the includes and add (don’t change) so it gets appended to the includes.

I add more directories like this, it found antlr4 as expect now.

include_directories(/usr/local/include)
include_directories(/usr/local/include/antlr4-runtime)
include_directories(/usr/include/)
include_directories(/usr/include/antlr4-runtime/)

But I encounter other error instead, I got a lot of this, not sure what it meant.

/home/abuild/rpmbuild/BUILD/quantum-blackbird-0.2.4/blackbird_cpp/Visitor.cpp:262:5: error: control reaches end of non-void function -Werror=return-type]

Hi
You need to look at the code at Visitor.cpp line 262 and fix the return to actually mean something, depends on what it’s expecting… looks like it gets to the end, all the previous are return val; but no return if it doesn’t return val… what is it passing through at that point?

I see (at blackbird/blackbird_cpp/Visitor.cpp at master · XanaduAI/blackbird · GitHub)


|            return val;
|
|
|


|        }
|
|
|


ERROR IS HERE!
    }

Maybe worth asking upstream, but the expression is documented at line 187…