folly: folly/python/executor_api.h No such file or directory

Hi, I’m trying the following steps to build folly,

git clone https://github.com/facebook/folly
cd folly 
 mkdir _build 
 cd _build 
 cmake -DBUILD_SHARED_LIBS=ON -DPYTHON_EXTENSIONS=ON -DBUILD_EXAMPLES=off -DBUILD_TESTS=off ../. 
  make -j4 
  make install 

cmake build executed successfully. But make -j4 got error at 97% execution raising folly/python/executor_api.h No such file or directory. I checked the same location there is one executor.h file but couldn’t locate any executor_api.h file

Please suggest if someone got similar issue. Thanks.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 28 (14 by maintainers)

Most upvoted comments

ha … i have a sponsor button on github i think… but i’d prefer you donate to a charity or other worthy cause. I am working on this today and still battling the errors i have for fiber_manager import related to multiple symbols defs/conflicts… not all the folly build flags do what they say. I think the setup needs to be very precise about what objects to link against. more to come but holidays going on here

On Mon, Dec 23, 2024 at 11:18 AM аэт @.***> wrote:

@novitae https://github.com/novitae i have a mac that i am setting up so maybe some news on that in a while. will bet you 5$ no code change in getdeps should be needed 😉

@gmarzot https://github.com/gmarzot send me your PayPal, you were right

I used your latest version of your fork, and it builds successfully on python3.13. Please just remove the unwind lib for non-linux in the setup.py, as it is only on linux (I didn’t check windows, but it’s not on macOS)

— Reply to this email directly, view it on GitHub https://github.com/facebook/folly/issues/1703#issuecomment-2558085898, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7T3IH7VV7OIRLQKO3Z4YD2HAZV5AVCNFSM6AAAAABTH2XYRCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJYGA4DKOBZHA . You are receiving this because you were mentioned.Message ID: @.***>

– Up-to-date: /tmp/folly/installed/folly/include/folly/python/executor_api.h ‘python3’ ‘-c’ ‘import sys,os; os.environ[‘PYTHONPATH’] = f’/tmp/folly/installed/folly/lib/python{sys.version_info.major}.{sys.version_info.minor}/site-packages’’ ‘/home/gmarzot/Projects/moq/folly/folly/python/setup.py’ ‘install’ ‘–prefix’ ‘/tmp/folly/installed/folly’ ‘–verbose’ ‘–single-version-externally-managed’ ‘–record=installed_files.txt’ – Up-to-date: /tmp/folly/installed/folly/include/folly/debugging/exception_tracer/ExceptionAbi.h – Up-to-date: /tmp/folly/installed/folly/include/folly/debugging/exception_tracer/ExceptionCounterLib.h – Up-to-date: /tmp/folly/installed/folly/include/folly/debugging/exception_tracer/ExceptionTracer.h – Up-to-date: /tmp/folly/installed/folly/include/folly/debugging/exception_tracer/ExceptionTracerLib.h – Up-to-date: /tmp/folly/installed/folly/include/folly/debugging/exception_tracer/StackTrace.h – Up-to-date: /tmp/folly/installed/folly/lib/libfolly_exception_tracer_base.a – Up-to-date: /tmp/folly/installed/folly/lib/libfolly_exception_tracer.a – Up-to-date: /tmp/folly/installed/folly/lib/libfolly_exception_counter.a Building on {distro=ubuntu, distro_vers=22.04, fb=off, fbsource=off, os=linux, shared_libs=off, test=off} Assessing fast_float… Assessing fmt… Assessing glog… Assessing googletest… Assessing libunwind… Assessing xz… Assessing folly… Building folly… (uv) gmarzot@GMARZOT-LAPTOP:~/Projects/moq/folly$ PYTHONPATH=/tmp/folly/installed/folly/lib/python3.13/site-packages python3 -c “import folly; print(‘Folly import successful’)” Folly import successful

progress… still some issues. pushing current branch updates

After resolving the missing ones, I can import all. Here is the setup.py:

#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Do not call directly, use cmake
#
# Cython requires source files in a specific structure, the structure is
# created as tree of links to the real source files.

import sys, platform
from Cython.Build import cythonize
from Cython.Compiler import Options
from setuptools import Extension, setup

Options.fast_fail = True

if sys.platform == "darwin" and platform.machine() == "arm64":
    # Macos (arm64, homebrew path is different than intel)
    library_dirs = ["/opt/homebrew/lib"]
else:
    # Debian/Ubuntu
    library_dirs = ["/usr/lib", "/usr/lib/x86_64-linux-gnu"]

exts = [
    Extension(
        "folly.executor",
        sources=[
            "folly/executor.pyx",
            "folly/executor_intf.cpp",
            "folly/ProactorExecutor.cpp",
            "folly/error.cpp",
        ],
        libraries=["folly", "glog", "double-conversion"],
        extra_compile_args=["-std=c++20"],  # C++20 for coroutines
        include_dirs=[".", "../.."],  # cython generated code
        library_dirs=library_dirs,
    ),
    Extension(
        "folly.iobuf",
        sources=[
            "folly/iobuf.pyx",
            "folly/iobuf_intf.cpp",
            "folly/iobuf_ext.cpp",
            "folly/error.cpp",
        ],
        libraries=["folly", "glog", "double-conversion", "fmt"],
        extra_compile_args=["-std=c++20"],  # C++20 for coroutines
        include_dirs=[".","../.."],  # cython generated code
        library_dirs=library_dirs,
    ),
    Extension(
        "folly.fiber_manager",
        sources=[
            "folly/fiber_manager.pyx",
            "folly/fibers.cpp",
            "folly/error.cpp",
        ],
        libraries=["folly", "glog", "double-conversion", "fmt", "event"],
        extra_compile_args=["-std=c++20"],  # C++20 for coroutines
        include_dirs=[".","../.."],  # cython generated code
        library_dirs=library_dirs,
    )
]

setup(
    name="folly",
    version="0.0.1",
    packages=["folly"],
    package_data={"": ["*.pxd", "*.pyi", "*.h"]},
    setup_requires=["cython"],
    zip_safe=False,
    ext_modules=cythonize(exts, compiler_directives={"language_level": 3}),
)

DESTDIR=/tmp/folly python3.11 ./build/fbcode_builder/getdeps.py build folly --allow-system-packages --scratch-path /tmp/folly --extra-cmake-defines='{"CMAKE_CXX_FLAGS": "-fPIC $$(python3.11-config --includes) $$(python3.11-config --ldflags)", "PYTHON_EXTENSIONS": "ON"}' --no-tests

I think that lib needs to be in the cython setup.py

    libraries=["folly", "fmt", "glog", "double-conversion"],

likely there are others. what does your test script look like and what is PYTHONPATH?

On Sun, Dec 15, 2024 at 7:59 AM аэт @.***> wrote:

@gmarzot https://github.com/gmarzot

I manage to build it completely ! I encountered the same missing “Python.h” issue as you, here is how I solved it:

DESTDIR=/tmp/folly python3.11 ./build/fbcode_builder/getdeps.py build folly --scratch-path /tmp/folly --allow-system-packages –extra-cmake-defines=‘{“CMAKE_CXX_FLAGS”: “-fPIC $$(python3.11-config –includes) $$(python3.11-config --ldflags)”, “PYTHON_EXTENSIONS”: “ON”}’ –no-tests

(I am specifying python3.11 because my python3 points to python3.13)

Now I am stuck with:

% python -u “/Users/n/cpp/2/t.py” Traceback (most recent call last): File “/Users/n/cpp/2/t.py”, line 1, in <module> from folly.iobuf import IOBuf, WritableIOBuf ImportError: dlopen(/opt/homebrew/lib/python3.11/site-packages/folly/iobuf.cpython-311-darwin.so, 0x0002): symbol not found in flat namespace ‘__ZN3fmt3v117vformatENS0_17basic_string_viewIcEENS0_17basic_format_argsINS0_7contextEEE’

Which says that the function fmt::v11::vformat(fmt::v11::basic_string_view<char>, fmt::v11::basic_format_argsfmt::v11::context) was not included during the build. It seems like adding -lfmt to the “CMAKE_CXX_FLAGS” isn’t fixing it.

— Reply to this email directly, view it on GitHub https://github.com/facebook/folly/issues/1703#issuecomment-2543864395, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7T3IHCTU7LTKEXS6TDO5D2FV4LVAVCNFSM6AAAAABTH2XYRCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNBTHA3DIMZZGU . You are receiving this because you were mentioned.Message ID: @.***>