primitiv: [FreeBSD] Python runtime error: "Default object is null."

Steps to reproduce:

Install primitiv in FreeBSD 11.1 by the following commands (root):

pkg install protobuf cmake git googletest python3
python3 -m ensurepip
pip3 install numpy cython
git clone https://github.com/odashi/primitiv.git
cd primitiv
cmake . -DPRIMITIV_BUILD_TESTS=ON
make
make test
make install
cd python-primitiv
env CPLUS_INCLUDE_PATH=/usr/local/include ./setup.py build

The following python code throws an error:

>>> from primitiv import *
>>> dev = devices.Naive()
>>> Device.set_default(dev)
>>> g = Graph()
>>> Graph.set_default(g)
>>> dev == Device.get_default()
True
>>> g == Graph.get_default()
True
>>> node = operators.ones([2,3])               
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "primitiv/_operator.pyx", line 226, in primitiv._operator._operators.ones
    return wrapNode(op_ones[CppNode](normShape(shape).wrapped, device.wrapped[0]))
RuntimeError: /root/primitiv/primitiv/mixins.h: 69: Default object is null.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 30 (30 by maintainers)

Most upvoted comments

  • Build OK?

    OSX FreeBSD Linux
    w/o explicit OK OK OK
    w/ explicit OK OK Failed
  • Symbol type of default_obj_

    OSX FreeBSD Linux
    w/o explicit C++ lib D V u
    Python lib D V u
    Address Same Diff Same
    w/ explicit C++ lib S B N/A
    Python lib D V N/A
    Address Diff Same N/A

Instead of -lprimitiv could you please pass the full path to .so file, like:

c++ -shared -lpthread -L/usr/local/lib <full_path_to>/primitiv.so -fstack-protector build/temp.freebsd-11.1-RELEASE-amd64-3.6/primitiv/_graph.o -L/usr/local/lib  -lpython3.6m -o build/lib.free bsd-11.1-RELEASE-amd64-3.6/primitiv/_graph.so

That’s actually would be a bit more robust, but the variant above may do as well.

@odashi Yes. Two addresses (&default_obj_ in _graph.so and &default_obj_ in libprimitiv.so) are different value.