Skip to content
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

folly/python/executor_api.h No such file or directory #1703

Open
ujjawalcse opened this issue Jan 8, 2022 · 28 comments
Open

folly/python/executor_api.h No such file or directory #1703

ujjawalcse opened this issue Jan 8, 2022 · 28 comments

Comments

@ujjawalcse
Copy link

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.

@yfeldblum
Copy link
Contributor

I think that the whole directory folly/python/ is currently excluded from the cmake build. This may not be the best solution in the long term but hopefully it is good enough in the short term.

@gmarzot
Copy link

gmarzot commented Dec 9, 2024

the problem has evolved it appears - there is no longer a missing file, executor_api.h, but an output naming collision with -DPYTHON_EXTENSIONS=ON enabled.

Does anyone own folly/cython bindings? actively working in this area? Presumably the internal buck build works and only oss build had issues. Are there any active clients of these python bindings?

cmake with -DPYTHON_EXTNSIONS=ON error output


Compiling folly/executor.pyx because it changed.
Compiling folly/iobuf.pyx because it changed.
[1/2] Cythonizing folly/executor.pyx
warning: folly/init.pxd:50:21: Rvalue-reference as function argument not supported

Error compiling Cython file:

...

Copyright (c) Meta Platforms, Inc. and affiliates.

^

folly/executor.pyx:1:0: The output file already exists and does not look like it was generated by Cython: "executor.cpp"
Traceback (most recent call last):
File "/home/gmarzot/Projects/moq/moxygen/_build/deps/folly/folly/python/setup.py", line 48, in
ext_modules=cythonize(exts, compiler_directives={"language_level": 3}),
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gmarzot/Projects/moq/moxygen/.venv/lib/python3.13/site-packages/Cython/Build/Dependencies.py", line 1109, in cythonize
cythonize_one(*args)
~~~~~~~~~~~~~^^^^^^^
File "/home/gmarzot/Projects/moq/moxygen/.venv/lib/python3.13/site-packages/Cython/Build/Dependencies.py", line 1256, in cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: folly/executor.pyx
make[2]: *** [folly/CMakeFiles/folly_python_bindings.dir/build.make:73: folly_python_bindings] Error 1
make[1]: *** [CMakeFiles/Makefile2:276: folly/CMakeFiles/folly_python_bindings.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

@novitae
Copy link

novitae commented Dec 14, 2024

@gmarzot any progress on this ?

@gmarzot
Copy link

gmarzot commented Dec 14, 2024

@gmarzot any progress on this ?
@novitae
yes in fact. I have the bindings all building. but untested and i am not sure of all my assumptions.

see: gmarzot#1

I am building like this:

sudo ./build/fbcode_builder/getdeps.py install-system-deps --recursive

DESTDIR=/tmp/folly ./build/fbcode_builder/getdeps.py build --scratch-path /tmp/folly --allow-system-packages --extra-cmake-defines='{"CMAKE_CXX_FLAGS": "-fPIC", "PYTHON_EXTENSIONS": "ON"}' --no-tests

next step is to get a setup.py for folly/folly/python/test directory and see if those tests can run

(i hove one weird problem - one dev host is ubuntu 20.04 lts and I cant get modern python3-dev installed so build fails with missing "Python.h" - clues and solutions welcome)

@novitae
Copy link

novitae commented Dec 14, 2024

I am building like this:

sudo ./build/fbcode_builder/getdeps.py install-system-deps --recursive

DESTDIR=/tmp/folly ./build/fbcode_builder/getdeps.py build --scratch-path /tmp/folly --allow-system-packages --extra-cmake-defines='{"CMAKE_CXX_FLAGS": "-fPIC", "PYTHON_EXTENSIONS": "ON"}' --no-tests

Thank you ! I tried (macOS), and it's failing for some other issues, I am investigating.

(i hove one weird problem - one dev host is ubuntu 20.04 lts and I cant get modern python3-dev installed so build fails with missing "Python.h" - clues and solutions welcome)

I had a similar issue recently, I fixed It by compiling indicating the path to my python. For me it was missing:

-L /opt/homebrew/Cellar/python@3.11/3.11.11/Frameworks/Python.framework/Versions/3.11/lib -l python3.11

@novitae
Copy link

novitae commented Dec 15, 2024

@gmarzot

I manage to build it completely using the branch of your fork ! 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)


Then I encountered:

% 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'

I solved it by adding "fmt" to the libraries list of the "folly.iobuf" extension in the setup.py.


Now I am stuck on:

% python -u "/Users/n/cpp/2/t.py"
Traceback (most recent call last):
  File "/Users/n/cpp/2/t.py", line 1, in <module>
    import folly.executor
ImportError: dlopen(/opt/homebrew/lib/python3.11/site-packages/folly/executor.cpython-311-darwin.so, 0x0002): symbol not found in flat namespace '__ZN5folly6python16ProactorExecutor7executeEm'

@gmarzot
Copy link

gmarzot commented Dec 15, 2024 via email

@gmarzot
Copy link

gmarzot commented Dec 15, 2024

Ha.. I'm behind by one message. Looking

@gmarzot
Copy link

gmarzot commented Dec 15, 2024

    sources=["folly/executor.pyx","folly/executor_intf.cpp", "folly/ProactorExecutor.cpp"],

in setup.py

@novitae
Copy link

novitae commented Dec 15, 2024

what does your test script look like

just

import folly.executor

or

import folly.iobuf

@novitae
Copy link

novitae commented Dec 15, 2024

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

@gmarzot
Copy link

gmarzot commented Dec 15, 2024

the warnings remain concerning and in particular the ones related to std:move (you can see in the next cython release there are changes in this space: https://cython.readthedocs.io/en/latest/src/changes.html)

getting folly/folly/python/test built and running will be very telling.. needs whole setup.py and very similr process as we did in folly/folly/python (@novitae thank you for pushing this forward)

uhg ... now i am getting the can't link -lfmt problem again and i had that fixed at one point.

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 -I.venv/cpython-3.13.1-linux-x86_64-gnu/include -L.venv/cpython-3.13.1-linux-x86_64-gnu/lib", "PYTHON_EXTENSIONS": "ON"}' --no-tests

clang++ -pthread -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -fPIC -pthread -shared -Wl,--exclude-libs,ALL -LModules/_hacl build/temp.linux-x86_64-cpython-313/folly/error.o build/temp.linux-x86_64-cpython-313/folly/iobuf.o build/temp.linux-x86_64-cpython-313/folly/iobuf_ext.o build/temp.linux-x86_64-cpython-313/folly/iobuf_intf.o -L/usr/lib -L/usr/lib/x86_64-linux-gnu -L/tmp/folly/build/folly -L/install/lib -lfolly -lglog -ldouble-conversion -lfmt -o build/lib.linux-x86_64-cpython-313/folly/iobuf.cpython-313-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lfmt: No such file or directory


my environment a little diff with python3.13 and cython 3.0,11
find . -name 'Python.h'
./.venv/cpython-3.13.1-linux-x86_64-gnu/include/python3.13/Python.h
ls ./.venv/cpython-3.13.1-linux-x86_64-gnu/lib/
Tix8.4.3/ libpython3.13.so.1.0 python3.13/ thread2.8.7/
itcl4.2.2/ libpython3.so tcl8/ tk8.6/
libpython3.13.so pkgconfig/ tcl8.6/

for reference I am installing python3.13 and cython3.0.11 as follows:

ECHO=$([[ "$SHELL" == *"zsh"* ]] && echo "echo" || echo "echo -e")

$ECHO "${COLOR_GREEN}Setting up Python test environment ${COLOR_OFF}"
PYTHON_VERSION="3.13"   # Latest Python version to install via uv
CYTHON_VERSION="3.0.11" # Target Cython release (3.1.0a1 crashes - use 3.1.0 when released)

PLATFORM="$(uname -s)"
case "${PLATFORM}" in
    Linux*)     PLATFORM=Linux;;
    Darwin*)    PLATFORM=Mac;;
    *)          PLATFORM="UNKNOWN:${PLATFORM}"
esac
$ECHO "${COLOR_GREEN}Detected platform: $PLATFORM ${COLOR_OFF}"

# Ensure python3 and pip3 are installed
if [ "${PLATFORM}" = "Linux" ]; then
    if [ "${EUID}" -ne 0 ]; then
	SUDO=sudo
    fi
    ${SUDO} apt-get install -y python3 python3-pip python3-venv clang
elif [ "${PLATFORM}" = "Mac" ]; then
    brew install python3
else
    $ECHO "${COLOR_RED}[ ERROR ] Unrecognised platform: ${PLATFORM}${COLOR_OFF}"
    exit 1
fi 

VENV_DIR=".venv"
UV_PIP_INSTALL="uv pip install --no-config --upgrade"
export UV_PYTHON_INSTALL_DIR="${VENV_DIR}"

if [ ! -d "${VENV_DIR}" ]; then
    [ -f ".python-version" ] && rm -f ".python-version"
    python3 -m venv --prompt "pip" "${VENV_DIR}"
    source "${VENV_DIR}/bin/activate"
    python3 -m pip install --upgrade pip
    python3 -m pip install --upgrade uv
    uv venv --prompt "uv" \
        --seed --relocatable \
        --allow-existing --no-config \
        --python-preference only-managed \
        --python "${PYTHON_VERSION}" \
        "${VENV_DIR}"
fi

source ./.venv/bin/activate
if ! command -v "uv" >/dev/null 2>&1 ; then
    $ECHO "${COLOR_RED}[ ERROR ] Failed to install uv... ${COLOR_OFF}"
    exit -1
fi

# Ensure uv is upgraded to latest
${UV_PIP_INSTALL} uv

# Install desired python verion using uv
uv python install --no-config "${PYTHON_VERSION}"
uv python pin --no-config "${PYTHON_VERSION}" 

# Install required packages
${UV_PIP_INSTALL} build wheel setuptools
#${UV_PIP_INSTALL} "git+https://github.com/cython/cython.git@${CYTHON_VERSION}"
${UV_PIP_INSTALL} "cython==${CYTHON_VERSION}"
${UV_PIP_INSTALL} pytest pytest-asyncio pytest-cov 
${UV_PIP_INSTALL} aioquic

cd "${VENV_DIR}"
PYTHON_DIR=$(python3 -c 'import sysconfig; print(sysconfig.get_config_var("prefix").split("/")[-1])')
if [ -d "include" ] && [ ! -L "include" ]; then
    rm -rf "include"
fi
ln -sf "${PYTHON_DIR}/include" "include"
cd ..
deactivate

$ECHO "${COLOR_GREEN}Python test environment is set up ${COLOR_OFF}"

@novitae
Copy link

novitae commented Dec 15, 2024

uhg ... now i am getting the can't link -lfmt problem again and i had that fixed at one point.

It happened few times to me also during this whole process for other dependencies ...

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 -I.venv/cpython-3.13.1-linux-x86_64-gnu/include -L.venv/cpython-3.13.1-linux-x86_64-gnu/lib", "PYTHON_EXTENSIONS": "ON"}' --no-tests

  • If the command upper is the one you used, maybe it fails is because you say python3.11 (as me), but then use python3.13 ?
  • By the way I forgot precise that I also changed all the python3 (which points to my python3.13) to python3.11 in the folly/CMakeLists.txt.
  • If you use the setup.py I used, I've set the library_dirs for you as the one you set in your repo, maybe they aren't corresponding the actual ones you have now ? Or maybe check again you have it well installed (it happened to me 3 or 4 times to have issues just from this, you just loose your mind at this point lol)

I think something interesting we could try if you manage to pull this off, is to make a pypi package for folly, with a way more straightforward to install, that would just use the already installed package, without having to rebuild endlessly. We are trying to do the same thing on the same week, so other people must also struggle.

@gmarzot
Copy link

gmarzot commented Dec 16, 2024

@novitae
I solved a number of problems by adding this to setup.py . now no artificial destdir is required but may still be supplied and I am finding all libes from the build itself rather system installs only which must have been happening before.

# Add library paths from CMAKE_PREFIX_PATH
if cmake_prefix_path := os.environ.get("CMAKE_PREFIX_PATH"):
   library_dirs.extend(p + "/lib" for p in cmake_prefix_path.split(":"))
# Make sure DESTDIR is set to something reasonable for install
if 'DESTDIR' not in os.environ and 'GETDEPS_INSTALL_DIR' in os.environ:
   os.environ['DESTDIR'] = '.'

and yes making a releasable package would be cool .. need to get the test dir running and understand better what is implied by the issues/warning around move semantics (see warning in attached successfult build)
folly_build_final_1.log

@novitae
Copy link

novitae commented Dec 16, 2024

@novitae I solved a number of problems by adding this to setup.py . now no artificial destdir is required but may still be supplied and I am finding all libes from the build itself rather system installs only which must have been happening before.

# Add library paths from CMAKE_PREFIX_PATH
if cmake_prefix_path := os.environ.get("CMAKE_PREFIX_PATH"):
   library_dirs.extend(p + "/lib" for p in cmake_prefix_path.split(":"))
# Make sure DESTDIR is set to something reasonable for install
if 'DESTDIR' not in os.environ and 'GETDEPS_INSTALL_DIR' in os.environ:
   os.environ['DESTDIR'] = '.'

Nice ! So did you also manage to import and use the lib from python ?

understand better what is implied by the issues/warning around move semantics (see warning in attached successfult build) folly_build_final_1.log

I have no idea what could it be. Tbh with you, I started touching to all those makefile and C++ on Saturday fro the first time. I am a quick learner, but I don't think this quick 😅

@gmarzot
Copy link

gmarzot commented Dec 17, 2024

-- 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

@novitae
Copy link

novitae commented Dec 17, 2024

Also could you merge the pr I've done to your branch ? It contains the edited setup.py and also a small edit to the getdeps for an issue I had where the dir wasn't made when trying to write the getdeps file

@gmarzot
Copy link

gmarzot commented Dec 17, 2024

Also could you merge the pr I've done to your branch ? It contains the edited setup.py and also a small edit to the getdeps for an issue I had where the dir wasn't made when trying to write the getdeps file

The dir creation in getdeps should not have to occur. that file, build_marker, is in inst_dir which has to have been created prior to getting there. can you recreate the error without that patch. we shouldn't have to mess with core folly getdeps for the python stuff. all your other stuff is already included in my pr.. but we are still a ways from being able to offer this back to facebook/folly. still discovering various dependencies and link and run issues. and folly/folly/python/test not built/run yet.. i will keep my pr branch up to date

@novitae
Copy link

novitae commented Dec 17, 2024

The dir creation in getdeps should not have to occur. that file, build_marker, is in inst_dir which has to have been created prior to getting there. can you recreate the error without that patch.

Here it is, a the fail it raises. The line I previously added fixed this issue completely, without any side effects.
build_attempt.log

Anyway this is unrelated, I should do my own pr to folly about it.

@gmarzot
Copy link

gmarzot commented Dec 17, 2024

and that is repeatable after the follwing?
sudo ./build/fbcode_builder/getdeps.py clean --scratch-path "<scratch-path>"
sudo ./build/fbcode_builder/getdeps.py clean
sudo rm -rf "<scratch-path>"
sudo ./build/fbcode_builder/getdeps.py install-system-deps --recursive

(note: that last one is the only cmd that should need sudo)

its my assertion that a clean environment should never produce that problem

BTW i completely removed the need for DESTDIR - it looked archaic/vestigial to some ancient python env and actually did some strange things to install paths

@novitae
Copy link

novitae commented Dec 17, 2024

and that is repeatable after the follwing? sudo ./build/fbcode_builder/getdeps.py clean --scratch-path "" sudo ./build/fbcode_builder/getdeps.py clean sudo rm -rf "" sudo ./build/fbcode_builder/getdeps.py install-system-deps --recursive

Ok so I did this,

(note: that last one is the only cmd that should need sudo)

(btw homebrew on macOS refuses sudo, so the getdeps using it fails with it, so I did without)

BTW i completely removed the need for DESTDIR - it looked archaic/vestigial to some ancient python env and actually did some strange things to install paths

Here is my command, using a completely empty python3.13 version:

./build/fbcode_builder/getdeps.py clean --scratch-path /tmp/folly && \
    ./build/fbcode_builder/getdeps.py clean && \
    rm -rf /tmp/folly && \
    ./build/fbcode_builder/getdeps.py install-system-deps --recursive && \
    ./build/fbcode_builder/getdeps.py build folly --scratch-path /tmp/folly --extra-cmake-defines='{"CMAKE_CXX_FLAGS": "-fPIC $$(python3-config --includes) $$(python3-config --ldflags)", "PYTHON_EXTENSIONS": "ON"}' --no-tests

And I get stuck here:

Extract /private/tmp/folly/downloads/ninja-v1.10.2.tar.gz -> /private/tmp/folly/extracted/ninja-v1.10.2.tar.gz
Building ninja...
---
+ cd /private/tmp/folly/extracted/ninja-v1.10.2.tar.gz/ninja-1.10.2 && \
+ /Library/Frameworks/Python.framework/Versions/3.13/bin/python3 \
+      configure.py \
+      --bootstrap
Traceback (most recent call last):
  File "/private/tmp/folly/extracted/ninja-v1.10.2.tar.gz/ninja-1.10.2/configure.py", line 26, in <module>
    import pipes
ModuleNotFoundError: No module named 'pipes'
Command '['/Library/Frameworks/Python.framework/Versions/3.13/bin/python3', 'configure.py', '--bootstrap']' returned non-zero exit status 1.
!! Failed

When running in python 3.11, I remember seeing warning about pipes being deprecated. I think this is related to openwrt/openwrt#16675 & openwrt/openwrt#16693. Since you have python3.13, I guess you have it already installed, but on empty python, it blocks here. Upgrading ninja would probably fix it. I am using you fork.

@gmarzot
Copy link

gmarzot commented Dec 17, 2024

above is my bootstrap_python.sh script . it should run fine on MaOS and leave you in a uv based venv

@novitae
Copy link

novitae commented Dec 18, 2024

above is my bootstrap_python.sh script . it should run fine on MaOS and leave you in a uv based venv

It still fails using your bootstrap_python.sh script, after making sure I am in the right environment, and after cleaning the scratch path. I used the same command as I sent upper.

build_attempt.log

@gmarzot
Copy link

gmarzot commented Dec 19, 2024

~/Projects/moq/folly$ PYTHONPATH=/tmp/folly/installed/folly/lib/python3.13/site-packages python3 -c "from folly import fiber_manager; print('folly fiber_manager import successful')"
ERROR: something wrong with flag 'folly_hazptr_use_executor' in file '/home/gmarzot/Projects/moq/folly/folly/synchronization/Hazptr.cpp'. One possibility: file '/home/gmarzot/Projects/moq/folly/folly/synchronization/Hazptr.cpp' is being linked both statically and dynamically into this executable.

~/Projects/moq/folly$ nm /tmp/folly/installed/folly/lib/libfolly.a | grep use_executor
U _ZN5folly19hazptr_use_executorEv
U _ZN5folly19hazptr_use_executorEv
U _ZN5folly19hazptr_use_executorEv
U _ZN5folly19hazptr_use_executorEv
U _ZN5folly19hazptr_use_executorEv
U _ZN5folly19hazptr_use_executorEv
U _ZN5folly19hazptr_use_executorEv
U _ZN5folly19hazptr_use_executorEv
0000000000000001 D _ZN3fLB31FLAGS_folly_hazptr_use_executorE
00000000000001c0 b _ZN3fLBL27o_folly_hazptr_use_executorE
0000000000000000 d _ZN3fLBL33FLAGS_nofolly_hazptr_use_executorE
0000000000000000 T _ZN5folly19hazptr_use_executorEv
U _ZN5folly19hazptr_use_executorEv
nm: memcpy.S.o: no symbols

~/Projects/moq/folly$ PYTHONPATH=/tmp/folly/installed/folly/lib/python3.13/site-packages python3 -c "from folly import iobuf; print('folly iobuf import successful')"
folly iobuf import successful

~/Projects/moq/folly$ PYTHONPATH=/tmp/folly/installed/folly/lib/python3.13/site-packages python3 -c "import folly; print('folly import successful')"
folly import successful

~/Projects/moq/folly$ PYTHONPATH=/tmp/folly/installed/folly/lib/python3.13/site-packages python3 -c "from folly import executor; print('folly executor import successful')"
folly executor import successful

still luck importing folly.fiber_manager - the rest imports fine. I actually cant find anything else that wants to importfolly. fiber_manager. Anway the error above is baffling as they all link to libfolly.a

attached is the build log if anyone from facebook has an idea @yfeldblum .
folly_build.log

@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 ;)

@novitae
Copy link

novitae commented Dec 21, 2024

@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 send me your PayPal, you were right

I used your latest version of your fork, and it builds successfully on python3.13, without even a venv. 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)

Here is my command (if I loose it, somehow):

./build/fbcode_builder/getdeps.py clean &&
    ./build/fbcode_builder/getdeps.py install-system-deps --recursive && \
    ./build/fbcode_builder/getdeps.py build folly --allow-system-packages --extra-cmake-defines='{"CMAKE_CXX_FLAGS": "-fPIC $$(python3-config --includes) $$(python3-config --ldflags)", "PYTHON_EXTENSIONS": "ON"}' --no-tests --project-install-prefix /Users/n/cpp/2/.venv

When running in python 3.11, I remember seeing warning about pipes being deprecated. I think this is related to openwrt/openwrt#16675 & openwrt/openwrt#16693. Since you have python3.13, I guess you have it already installed, but on empty python, it blocks here. Upgrading ninja would probably fix it. I am using you fork.

Also, it turns out the upper issue was happening when not using --allow-system-packages.

@gmarzot
Copy link

gmarzot commented Dec 23, 2024 via email

@gmarzot
Copy link

gmarzot commented Jan 3, 2025

@novitae some success on macos - a number of changes needed. see gmarzot#1 for updates and notes.

(uv) gmarzot@MarzBook folly % export PYTHONPATH=/tmp/folly/installed/folly/lib/python3.13/site-packages

python3 -c "import folly; print('folly import successful')"
python3 -c "from folly import executor; print('folly executor import successful')"
python3 -c "from folly import iobuf; print('folly iobuf import successful')"
python3 -c "from folly import fiber_manager; print('folly fiber_manager import successful')"
folly import successful
folly executor import successful
folly iobuf import successful
folly fiber_manager import successful

@novitae
Copy link

novitae commented Feb 7, 2025

Hey @gmarzot, big progress so far, I hope the PR will be accepted. I've seen on your recent activity that you are working around HTTP3 (I've seen aioquic here), as I am. Moreover, there are chances we want to do the exact same thing. Would there be a way I could contact you directly to talk in private ? Twitter, discord, email, ... ? Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants