-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build instructions for mstch_py3 generated code #426
Comments
update: I added a |
Ok, small progress. I generated from setuptools import setup
from Cython.Build import cythonize
setup(
ext_modules=cythonize(["x/types.pyx", "x/clients.pyx", "x/services.pyx"], language_level=3),
include_dirs=["../."]
) with this, I can compile three modules,
however, when I try to import the
and when I try to import the
|
OK, I overcame some of the missing symbol errors by recompiling the pyx files |
After a couple of days of trial and error, I figured out a from setuptools import Extension, setup
from Cython.Build import cythonize
libraries = [
"folly",
"thriftcpp2",
]
extra_libraries = [
"x.cpython-38-x86_64-linux-gnu",
]
extra_library_dirs = [
"build/lib.linux-x86_64-3.8/x",
]
extensions = [
Extension(
"x.libx",
[
"gen-cpp2/x.cpp",
"gen-cpp2/xAsyncClient.cpp",
"gen-cpp2/x_processmap_binary.cpp",
"gen-cpp2/x_processmap_compact.cpp",
"gen-cpp2/x_constants.cpp",
"gen-cpp2/x_data.cpp",
"gen-cpp2/x_metadata.cpp",
"gen-cpp2/x_types.cpp"
],
include_dirs=[],
libraries=libraries,
library_dirs=[],
extra_compile_args = ["--std=c++17"]
),
Extension(
"x.types",
[
"x/types.pyx",
"fbthrift/thrift/lib/py3/metadata.cpp",
"fbthrift/thrift/lib/py3/enums.cpp",
],
include_dirs=["../."],
libraries=libraries + extra_libraries,
library_dirs=extra_library_dirs,
extra_compile_args = ["--std=c++17"]
),
Extension(
"x.metadata",
[
"x/metadata.pyx",
"fbthrift/thrift/lib/py3/metadata.cpp",
"fbthrift/thrift/lib/py3/enums.cpp",
],
include_dirs=["../."],
libraries=libraries + extra_libraries,
library_dirs=extra_library_dirs,
extra_compile_args = ["--std=c++17"]
),
Extension(
"x.types_fields",
[
"x/types_fields.pyx",
"fbthrift/thrift/lib/py3/metadata.cpp",
"fbthrift/thrift/lib/py3/enums.cpp",
],
include_dirs=["../."],
libraries=libraries + extra_libraries,
library_dirs=extra_library_dirs,
extra_compile_args = ["--std=c++17"]
),
Extension(
"x.types_reflection",
[
"x/types_reflection.pyx",
"fbthrift/thrift/lib/py3/metadata.cpp",
"fbthrift/thrift/lib/py3/enums.cpp",
],
include_dirs=["../."],
libraries=libraries + extra_libraries,
library_dirs=extra_library_dirs,
extra_compile_args = ["--std=c++17"]
),
Extension(
"x.clients",
[
"x/clients.pyx",
"x/clients_wrapper.cpp",
"fbthrift/thrift/lib/py3/metadata.cpp",
"fbthrift/thrift/lib/py3/enums.cpp",
],
include_dirs=["../."],
libraries=libraries + extra_libraries,
library_dirs=extra_library_dirs,
extra_compile_args = ["--std=c++17"]
),
Extension(
"x.services",
[
"x/services.pyx",
"x/services_wrapper.cpp",
"fbthrift/thrift/lib/py3/metadata.cpp",
"fbthrift/thrift/lib/py3/enums.cpp",
],
include_dirs=["../."],
libraries=libraries + extra_libraries,
library_dirs=extra_library_dirs,
extra_compile_args = ["--std=c++17"]
),
Extension(
"x.services_reflection",
[
"x/services_reflection.pyx",
"fbthrift/thrift/lib/py3/metadata.cpp",
"fbthrift/thrift/lib/py3/enums.cpp",
],
include_dirs=["../."],
libraries=libraries + extra_libraries,
library_dirs=extra_library_dirs,
extra_compile_args = ["--std=c++17"]
)
]
setup(
ext_modules=cythonize(extensions, language_level=3)
) It would be amazing if the thrift compiler would generate build scripts as well. |
Hi,
After installing
thrift-0.0.1-cp38-cp38-linux_x86_64.whl
, I'm now looking for a way to compile the code generated bythrift1 --gen mstch_py3 x.thrift
. I'm getting a folder,gen-py3/x
, with the following contents:I've been trying to understand how the tests are compiled, for instance those deposited in
fbthrift/_build/thrift/lib/py3/test/gen-py3/binary
, but without much luck. I am not familiar with Cmake.When I try to use cython to compile each of the
pyx
files tocpp
manually in this folder,, I am getting a lot of failed import errors. It even seems that there are cyclic dependencies between
types
andtypes_fields
. Is there a way to generate a Cmake file withthrift1
as well? I'm really lost here.I'd be glad for any advice. Thanks!
The text was updated successfully, but these errors were encountered: