Ultimaker / libArcus

Communication library between internal components for Ultimaker software

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libArcus build error in windows when generating python_module_Arcus

edisonsfang opened this issue · comments

when i build the source in windows, the error was produced. Detail information as follow.
how can i solve that?

>nmake

Microsoft (R) 程序维护实用工具 14.13.26129.0 版
版权所有 (C) Microsoft Corporation。  保留所有权利。

Scanning dependencies of target Arcus
[  4%] Building CXX object CMakeFiles/Arcus.dir/src/Socket.cpp.obj
Socket.cpp
d:\documents\libarcus\src\Error.h(103): warning C4251: “Arcus::Error::_error_message”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“Arcus::Error”的客户端使用
D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include\xstring(4273): note: 参 见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
d:\documents\libarcus\src\Socket.h(151): warning C4251: “Arcus::Socket::d”: class“std::unique_ptr<Arcus::Socket::Private,std::default_delete<_Ty>>”需要有 dll 接口由 class“Arcus::Socket”的客户端使用
        with
        [
            _Ty=Arcus::Socket::Private
        ]
d:\documents\libarcus\src\Socket.h(151): note: 参见“std::unique_ptr<Arcus::Socket::Private,std::default_delete<_Ty>>” 的声明
        with
        [
            _Ty=Arcus::Socket::Private
        ]
[  9%] Building CXX object CMakeFiles/Arcus.dir/src/SocketListener.cpp.obj
SocketListener.cpp
d:\documents\libarcus\src\Error.h(103): warning C4251: “Arcus::Error::_error_message”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“Arcus::Error”的客户端使用
D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include\xstring(4273): note: 参 见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
d:\documents\libarcus\src\Socket.h(151): warning C4251: “Arcus::Socket::d”: class“std::unique_ptr<Arcus::Socket::Private,std::default_delete<_Ty>>”需要有 dll 接口由 class“Arcus::Socket”的客户端使用
        with
        [
            _Ty=Arcus::Socket::Private
        ]
d:\documents\libarcus\src\Socket.h(151): note: 参见“std::unique_ptr<Arcus::Socket::Private,std::default_delete<_Ty>>” 的声明
        with
        [
            _Ty=Arcus::Socket::Private
        ]
[ 13%] Building CXX object CMakeFiles/Arcus.dir/src/MessageTypeStore.cpp.obj
MessageTypeStore.cpp
D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include\google/protobuf/wire_format_lite.h(935): warning C4244: “参数”: 从“google::protobuf::uint64”转换到“google::protobuf::uint32”,可能丢失数据
D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include\google/protobuf/parse_context.h(269): warning C4244: “-=”: 从“google::protobuf::stringpiece_ssize_type”转换到“int”,可能丢失数据
D:\documents\libArcus\src\MessageTypeStore.cpp(40): warning C4267: “初始化”: 从“size_t”转换到“uint32_t”,可能丢失 数据
[ 18%] Building CXX object CMakeFiles/Arcus.dir/src/PlatformSocket.cpp.obj
PlatformSocket.cpp
D:\documents\libArcus\src\PlatformSocket.cpp(86): warning C4244: “=”: 从“SOCKET”转换到“int”,可能丢失数据
D:\documents\libArcus\src\PlatformSocket.cpp(112): warning C4244: “初始化”: 从“SOCKET”转换到“int”,可能丢失数据
D:\documents\libArcus\src\PlatformSocket.cpp(193): warning C4267: “参数”: 从“size_t”转换到“int”,可能丢失数据
D:\documents\libArcus\src\PlatformSocket.cpp(236): warning C4267: “参数”: 从“size_t”转换到“int”,可能丢失数据
[ 22%] Building CXX object CMakeFiles/Arcus.dir/src/Error.cpp.obj
Error.cpp
d:\documents\libarcus\src\Error.h(103): warning C4251: “Arcus::Error::_error_message”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“Arcus::Error”的客户端使用
D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include\xstring(4273): note: 参 见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
[ 27%] Linking CXX shared library Arcus.dll
  正在创建库 Arcus.lib 和对象 Arcus.exp
[ 27%] Built target Arcus
[ 31%] Generating python/sipArcuspart0.cpp, python/sipArcuspart1.cpp, python/sipArcuspart2.cpp, python/sipArcuspart3.cpp, python/sipArcuspart4.cpp, python/sipArcuspart5.cpp, python/sipArcuspart6.cpp, python/sipArcuspart7.cpp

Scanning dependencies of target python_module_Arcus
[ 36%] Building CXX object CMakeFiles/python_module_Arcus.dir/python/sipArcuspart0.cpp.obj
sipArcuspart0.cpp
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(83): error C2039: “api_call_procedure_method”: 不是“_sipAPIDef”的成员
D:\ProgramData\Anaconda3\include\sip.h(1360): note: 参见“_sipAPIDef”的声明
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(88): error C2039: “api_call_procedure_method”: 不是“_sipAPIDef”的成员
D:\ProgramData\Anaconda3\include\sip.h(1360): note: 参见“_sipAPIDef”的声明
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(93): error C2039: “api_call_procedure_method”: 不是“_sipAPIDef”的成员
D:\ProgramData\Anaconda3\include\sip.h(1360): note: 参见“_sipAPIDef”的声明
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(98): error C2078: 初始值设定项太多
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(145): error C2440: “初始化”: 无法从“const char [832]”转换为“int”
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(145): note: 没有使该转换得以执行的上下文
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(145): error C2440: “初始化”: 无法从“int”转换为“_sipQtAPI *”
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(145): note: 从整型强制转换为指针类型要求 reinterpret_cast、C 样式强制转换或函数样式强制转换
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(145): error C2440: “初始化”: 无法从“sipTypeDef *[10]”转换为“int”
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(145): note: 没有使该转换得以执行的上下文
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(145): error C2440: “初始化”: 无法从“initializer list”转换为“sipVirtErrorHandlerFunc *”
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(145): note: 初始值设定项包含过多元素
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(301): error C2039: “api_instance_destroyed_ex”: 不是“_sipAPIDef”的成员
D:\ProgramData\Anaconda3\include\sip.h(1360): note: 参见“_sipAPIDef”的声明
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(691): error C2039: “api_is_derived_class”: 不是“_sipAPIDef”的成员
D:\ProgramData\Anaconda3\include\sip.h(1360): note: 参见“_sipAPIDef”的声明
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(694): error C2039: “api_is_owned_by_python”: 不是“_sipAPIDef”的成员
D:\ProgramData\Anaconda3\include\sip.h(1360): note: 参见“_sipAPIDef”的声明
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(696): error C2039: “api_is_derived_class”: 不是“_sipAPIDef”的成员
D:\ProgramData\Anaconda3\include\sip.h(1360): note: 参见“_sipAPIDef”的声明
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(696): error C2660: “release_Socket”: 函数不接受 1 个参数
D:\documents\libArcus\build\release\python\sipArcuspart0.cpp(787): error C2078: 初始值设定项太多
NMAKE : fatal error U1077: “"D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\bin\Hostx64\x64\cl.exe"”: 返回代码“0x2”
Stop.
NMAKE : fatal error U1077: “"D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\bin\HostX64\x64\nmake.exe"”: 返回代码“0x2”
Stop.
NMAKE : fatal error U1077: “"D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\bin\HostX64\x64\nmake.exe"”: 返回代码“0x2”
Stop.

Hi @JockJo,

Assuming you've set up the dependencies, you could follow these intructions:

NOTE: If you decide to install VS2017 instead, don't forget to include a 2015/v140 target!

Tip: Use nmake VERBOSE=1 when in need of help during the build phase.

You have to run "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 to set up the vars needed by the MS C++ compiler.

NOTE: You (may?) really need this version, even if you installed vs2017. If it doesn't show up, modify the installation (with Visual Studio Installer) with more backwards compatible items towards the 2015 version.

[...]

NOTE: From this point onwards, make sure you're running the VS2015 console (not cmd or PowerShell), it should be installed either when installing VS2015 or selecting some backward compatible items in the VS2017 installer.

[...]

Visual C++ libArcus and Python bindings build

  • Git clone down libArcus: git clone https://github.com/Ultimaker/libArcus.git
  • cd ./libArcus
  • mkdir build
  • cd build
  • set PROTOBUF_SRC=C:/dev/protobuf-3.0.0/
  • set PROTOBUF_INSTALL=%PROTOBUF_SRC%/install_dir/
  • cmake -DPROTOBUF_SRC_ROOT_FOLDER=%PROTOBUF_SRC% -DPROTOBUF_LIBRARY=%PROTOBUF_INSTALL%/lib/libprotobuf.lib -DPROTOBUF_INCLUDE_DIR=%PROTOBUF_INSTALL%/include -DPROTOBUF_PROTOC_EXECUTABLE=%PROTOBUF_INSTALL%/bin/protoc.exe -DBUILD_EXAMPLES=OFF -DBUILD_STATIC=ON -DMSVC_STATIC_RUNTIME=ON -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" ..
  • nmake
  • Copy Arcus.pyd to your "\AppData\Local\Programs\Python\Python35\Lib\site-packages" dir.

cheers,
Remco.

i had solved the problem. The error appeared that the version of sip that was 4.20 was not suitable. When i uninstalled sip and installed it with 4.19.8, the libArcus was built successfully.

Hi @JockJo , AFAIK, sip 4.19.8 definitely works. Since sip 4.19.9, there is a notation of creating a private copy of sip module (see http://pyqt.sourceforge.net/Docs/sip4/using.html#ref-private-sip). In essence, if you are using PyQt5 with sip 4.19.9+, you need to compile a sip specifically for PyQt5 with the argument --sip-module. I just saw in the documentation that in 4.19.12, there is a new flag called --no-module. Maybe you can try that.

@LipuFei thanks