[英]./zbarmodule.h:26:10: fatal error: 'zbar.h' file not found
[英]Shiboken2 qobject.h:46:10: fatal: 'QtCore/qobjectdefs.h' file not found
我正在尝试使用 ShibokenD25Z C++ ZA2F2ED4F8EBC2CBB14C21A29DC40 为 Qt 创建 Python 绑定。 As far as I can tell, there's no official example on how to do so (the only example on the Qt Blog deals with a generic C++ class https://www.qt.io/blog/2018/05/31/write-蟒蛇绑定)。 所以我改为关注这篇博文: https://blog.basyskom.com/2019/using-shiboken2-to-create-python-bindings-for-a-qt-library/
该示例适用于 Linux,但 Shiboken2 无法在 Mac 上构建,并出现错误qobject.h:46:10: fatal: 'QtCore/qobjectdefs.h' file not found
这是发生的事情的日志:
(pyside2build) MacBook-Pro-i7:build andreac$ cmake ..
-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- QtCore include folders: /Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework;/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers;/Users/andreac/Qt/5.12.6/clang_64/.//mkspecs/macx-clang
-- Using python interpreter: /Users/andreac/pyside2build/bin/python
-- Found Python3: /Users/andreac/pyside2build/bin/python3.7 (found version "3.7.5") found components: Interpreter Development
-- Using PySide2 installation: /Users/andreac/pyside2build/lib/python3.7/site-packages/PySide2
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/andreac/pyside2build/src/binding-example/build
(pyside2build) MacBook-Pro-i7:build andreac$ make
Scanning dependencies of target libexamplebinding_autogen
[ 9%] Automatic MOC for target libexamplebinding
[ 9%] Built target libexamplebinding_autogen
Scanning dependencies of target libexamplebinding
[ 18%] Building CXX object CMakeFiles/libexamplebinding.dir/libexamplebinding_autogen/mocs_compilation.cpp.o
[ 27%] Building CXX object CMakeFiles/libexamplebinding.dir/qobjectwithenum.cpp.o
[ 36%] Linking CXX shared library libexamplebinding.dylib
[ 36%] Built target libexamplebinding
Scanning dependencies of target Shiboken2QtExample_autogen
[ 45%] Running generator for /Users/andreac/pyside2build/src/binding-example/bindings.xml.
(bindings) clang_parseTranslationUnit2(0x0, cmd[17]=-nostdinc -isystem/opt/X11/include -isystem/usr/local/include -isystem/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1 -isystem/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include -isystem/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -isystem/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -iframework/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks -fPIC -Wno-expansion-to-defined -Wno-constant-logical-operand -std=c++14 -I/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework -I/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers -I/Users/andreac/Qt/5.12.6/clang_64/mkspecs/macx-clang -I/Users/andreac/pyside2build/src/binding-example /private/var/folders/8v/8h2g7jz573g9rlwyp4zh87qm0000gn/T/bindings_eyZJOr.hpp)
/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers/qobject.h:46:10: fatal error: 'QtCore/qobjectdefs.h' file not found
(bindings) Errors in /private/var/folders/8v/8h2g7jz573g9rlwyp4zh87qm0000gn/T/bindings_eyZJOr.hpp:
/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers/qobject.h:46:10: fatal: 'QtCore/qobjectdefs.h' file not found
/private/var/folders/8v/8h2g7jz573g9rlwyp4zh87qm0000gn/T/bindings_eyZJOr.hpp:1:10: note: in file included from /private/var/folders/8v/8h2g7jz573g9rlwyp4zh87qm0000gn/T/bindings_eyZJOr.hpp:1:
/Users/andreac/pyside2build/src/binding-example/bindings.h:3:10: note: in file included from /Users/andreac/pyside2build/src/binding-example/bindings.h:3:
/Users/andreac/pyside2build/src/binding-example/qobjectwithenum.h:2:10: note: in file included from /Users/andreac/pyside2build/src/binding-example/qobjectwithenum.h:2:
/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers/QObject:1:10: note: in file included from /Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers/QObject:1:
(bindings) Clang: 1 diagnostic messages:
/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers/qobject.h:46:10: fatal: 'QtCore/qobjectdefs.h' file not found
/private/var/folders/8v/8h2g7jz573g9rlwyp4zh87qm0000gn/T/bindings_eyZJOr.hpp:1:10: note: in file included from /private/var/folders/8v/8h2g7jz573g9rlwyp4zh87qm0000gn/T/bindings_eyZJOr.hpp:1:
/Users/andreac/pyside2build/src/binding-example/bindings.h:3:10: note: in file included from /Users/andreac/pyside2build/src/binding-example/bindings.h:3:
/Users/andreac/pyside2build/src/binding-example/qobjectwithenum.h:2:10: note: in file included from /Users/andreac/pyside2build/src/binding-example/qobjectwithenum.h:2:
/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers/QObject:1:10: note: in file included from /Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers/QObject:1:
Keeping temporary file: /private/var/folders/8v/8h2g7jz573g9rlwyp4zh87qm0000gn/T/bindings_eyZJOr.hpp
shiboken: Error running ApiExtractor.
Command line: --generator-set=shiboken --enable-parent-ctor-heuristic --enable-return-value-heuristic --use-isnull-as-nb_nonzero --avoid-protected-hack -I/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework -I/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers -I/Users/andreac/Qt/5.12.6/clang_64/.//mkspecs/macx-clang -T/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework -T/Users/andreac/Qt/5.12.6/clang_64/lib/QtCore.framework/Headers -T/Users/andreac/Qt/5.12.6/clang_64/.//mkspecs/macx-clang -I/Users/andreac/pyside2build/src/binding-example -T/Users/andreac/pyside2build/src/binding-example --output-directory=/Users/andreac/pyside2build/src/binding-example/build /Users/andreac/pyside2build/src/binding-example/bindings.h /Users/andreac/pyside2build/src/binding-example/bindings.xml
make[2]: *** [Shiboken2QtExample/qobjectwithenum_wrapper.cpp] Error 1
make[1]: *** [CMakeFiles/Shiboken2QtExample_autogen.dir/all] Error 2
make: *** [all] Error 2
关于如何解决问题的任何想法?
看来我需要使用Shiboken2
的-F
选项来指定框架的位置。 将以下内容添加到调用命令可解决该问题:
-F/Users/andreac/Qt/5.12.6/clang_64/lib/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.