-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
libxml2: Fix python build & import #5930
Conversation
@waruqi 请帮忙调试 mac 上的问题。 已知信息:
/Applications/Xcode_15.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -pedantic -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wno-format-extra-args -O3 -DNDEBUG -arch arm64 -isysroot /Applications/Xcode_15.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -dynamiclib -Wl,-headerpad_max_install_names -current_version 2.13.4 -o libxml2mod.2.13.4.dylib -install_name @rpath/libxml2mod.2.13.4.dylib "CMakeFiles/LibXml2Mod.dir/libxml2-py.c.o" CMakeFiles/LibXml2Mod.dir/python/libxml.c.o CMakeFiles/LibXml2Mod.dir/python/types.c.o libxml2.a /Users/runner/.xmake/packages/p/python/3.13.0/3dd64f01e26f48debd2ccd8c08fdb2a3/lib/libpython3.13.a -ldl -lm /Users/runner/.xmake/packages/l/libiconv/1.17/035a4b093d48429a8f361b4ea32b4663/lib/libiconv.a -ldl -framework CoreFoundation
ld: warning: ignoring duplicate libraries: '-ldl'
ld: warning: search path '/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14/' not found
ld: warning: object file (/Users/runner/.xmake/packages/p/python/3.13.0/3dd64f01e26f48debd2ccd8c08fdb2a3/lib/libpython3.13.a[2](getbuildinfo.o)) was built for newer 'macOS' version (14.5) than being linked (14.0) python3 -c "import libxml2"
Traceback (most recent call last):
File "<string>", line 1, in <module>
import libxml2
File "/Users/runner/.xmake/packages/l/libxml2/v2.13.4/def471559399468b8c364a8c7c220590/python/libxml2.py", line 1, in <module>
import libxml2mod
ModuleNotFoundError: No module named 'libxml2mod' |
这边检测 python 都没过,还是找的系统的 python2.7 -- The C compiler identification is AppleClang 16.0.0.16000026
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefaul
t.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2")
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Looking for F_GETFL
-- Looking for F_GETFL - found
CMake Error at /usr/local/Cellar/cmake/3.25.3/share/cmake/Modules/FindPackageHandleStandardArgs.cm
ake:230 (message):
Could NOT find Python (missing: Development Development.Module
Development.Embed) (found version "2.7.17")
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.25.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPH
SA_FAILURE_MESSAGE)
/usr/local/Cellar/cmake/3.25.3/share/cmake/Modules/FindPython.cmake:561 (find_package_handle_sta
ndard_args)
CMakeLists.txt:69 (find_package)
|
这是啥环境,ci 上这里没问题。 -- Found Python: /Users/runner/.xmake/packages/p/python/3.13.0/3dd64f01e26f48debd2ccd8c08fdb2a3/bin/python3.13 (found version "3.13.0") found components: Interpreter Development Development.Module Development.Embed
-- Performing Test Iconv_IS_BUILT_IN
-- Performing Test Iconv_IS_BUILT_IN - Failed
-- Found Iconv: /Users/runner/.xmake/packages/l/libiconv/1.17/035a4b093d48429a8f361b4ea32b4663/lib/libiconv.a (found version "1.17") |
What kind of environment is this? There is no problem here on ci. -- Found Python: /Users/runner/.xmake/packages/p/python/3.13.0/3dd64f01e26f48debd2ccd8c08fdb2a3/bin/python3.13 (found version "3.13.0") found components: Interpreter Development Development.Module Development.Embed
-- Performing Test Iconv_IS_BUILT_IN
-- Performing Test Iconv_IS_BUILT_IN - Failed
-- Found Iconv: /Users/runner/.xmake/packages/l/libiconv/1.17/035a4b093d48429a8f361b4ea32b4663/lib/libiconv.a (found version "1.17") |
macos 下有几个问题
而cmakelists.txt 里面,它直接加了 Python link,没对 macos 做特殊处理,应该仅仅支持 linux 目前这边本地测试通过 python3 -c "import libxml2"
=> install libxml2 v2.13.4 .. ok |
There are several problems under macos
In cmakelists.txt, it directly adds the Python link. No special processing is done for macos. It should only support linux. At present, the local test here has passed python3 -c "import libxml2"
=> install libxml2 v2.13.4 .. ok |
Upstream report: https://gitlab.gnome.org/GNOME/libxml2/-/issues/824