Skip to content

segfault when try to run export_srcpkg example #37

@alec-l-1

Description

@alec-l-1

Hi. I am trying to run the example here https://tl2cgen.readthedocs.io/en/latest/treelite-migration.html but run into segfault when try to export the source package.

Here is my python code, essentially just copied from the link:

import treelite
import tl2cgen

builder = treelite.ModelBuilder(num_feature=3)

tree = treelite.ModelBuilder.Tree()
tree[0].set_numerical_test_node(
feature_id=0,
opname="<",
threshold=5.0,
default_left=True,
left_child_key=1,
right_child_key=2
)
tree[1].set_leaf_node(0.6)
tree[2].set_leaf_node(-0.4)
tree[0].set_root()

builder.append(tree)
model = builder.commit()  # Obtain treelite.Model object

tl2cgen.export_srcpkg(model, toolchain='gcc', pkgpath='./mymodel_pkg.zip', libname = "./mymodel.so", params={})

Here is the bt from the gdb:

#0  0x00007fffe76baf86 in void rapidjson::GenericReader<rapidjson::UTF8<char>, rapidjson::UTF8<char>, rapidjson::CrtAllocator>::ParseString<0u, rapidjson::GenericStringStream<rapidjson::UTF8<char> >, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator> >(rapidjson::GenericStringStream<rapidjson::UTF8<char> >&, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>&, bool) ()
   from /home/python/py3.10/lib/libtreelite.so
#1  0x00007fffe76bc160 in void rapidjson::GenericReader<rapidjson::UTF8<char>, rapidjson::UTF8<char>, rapidjson::CrtAllocator>::ParseValue<0u, rapidjson::GenericStringStream<rapidjson::UTF8<char> >, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator> >(rapidjson::GenericStringStream<rapidjson::UTF8<char> >&, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>&) ()
   from /home/python/py3.10/lib/libtreelite.so
#2  0x00007fffe5de2b68 in tl2cgen::compiler::CompilerParam::ParseFromJSON(char const*) () from /home/python/py3.10/lib/libtl2cgen.so
#3  0x00007fffe5ddde52 in TL2cgenGenerateCode () from /home/python/py3.10/lib/libtl2cgen.so
#4  0x00007ffff7e3d052 in ffi_call_unix64 () from /home/python/py3.10/lib/python3.10/lib-dynload/../../libffi.so.8

Wonder if anyone might have insight about what happened. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions