Azure IOT SDK:在创建共享库时,不能使用针对“ _Py_NotImplementedStruct”的重定位R_X86_64_32S

时间:2019-05-21 07:19:27

标签: python python-3.x python-3.5 azure-iot-hub azure-iot-sdk

我正在尝试为Linux建立Azure Iot Hub SDK,请参考以下链接: Azure-Python-SDK

我正在使用python 3.5。

Azure-sdk-python Github文档说

  

Ubuntu 16:04 + Python 3.5(或2.7)+ libboost-python-dev +   libcurl4-openssl-dev + python3-dev(或python-dev为2.7)

我按照以下步骤操作。

1)ubuntu-xenial作为基本docker映像。
2)在映像上安装了Python 3.5。
3)按照安装说明安装先决条件。
4)执行./setup.sh --python-version 3.5。效果很好。
5)执行./build.sh --build-python 3.5

构建失败,并出现以下错误。

root@162f8b72c4aa:/usr/src/app/azure-iot-sdk-python/build_all/linux# ./build.sh --build-python 3.5
/usr/src/app/azure-iot-sdk-python/c/cmake/iotsdk_linux /usr/src/app/azure-iot-sdk-python
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- IoT Client SDK Version = 1.2.12
-- Provisioning SDK Version = 1.2.12
-- Looking for include file stdint.h
-- Looking for include file stdint.h - found
-- Looking for include file stdbool.h
-- Looking for include file stdbool.h - found
-- target architecture: x86_64
-- Performing Test CXX_FLAG_CXX11
-- Performing Test CXX_FLAG_CXX11 - Success
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.0.2g")
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'libcurl'
--   Found libcurl, version 7.47.0
-- Found CURL: curl
-- target architecture: x86_64
-- target architecture: x86_64
-- target architecture: x86_64
-- target architecture: x86_64
-- iothub architecture: x86_64
-- target architecture: x86_64
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   python-py35
-- Found PythonLibs: /usr/local/lib/libpython3.5m.a (found suitable version "3.5.5", minimum required is "3.5")
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   python-py35
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   python-py35
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    run_valgrind


-- Build files have been written to: /usr/src/app/azure-iot-sdk-python/c/cmake/iotsdk_linux
Initial MAKE_CORES=2
VSPACE=5323700
MAKE_CORES=2
Starting run...
Tue May 21 17:15:32 AEST 2019
Scanning dependencies of target parson
Scanning dependencies of target aziotsharedutil
[  1%] Building C object CMakeFiles/parson.dir/deps/parson/parson.c.o
[  1%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/base32.c.o
[  1%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/base64.c.o
[  1%] Linking C static library libparson.a
[  1%] Built target parson
[  1%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/buffer.c.o
[  2%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/constbuffer_array.c.o
[  2%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/connection_string_parser.c.o
[  2%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/constbuffer.c.o
[  3%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/consolelogger.c.o
[  3%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/crt_abstractions.c.o
[  3%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/constmap.c.o
[  3%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/doublylinkedlist.c.o
[  4%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/gballoc.c.o
[  4%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/gbnetwork.c.o
[  4%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/gb_stdio.c.o
[  5%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/gb_time.c.o
[  5%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/gb_rand.c.o
[  5%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/hmac.c.o
[  5%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/hmacsha256.c.o
[  6%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/xio.c.o
[  6%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/singlylinkedlist.c.o
[  6%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/map.c.o
[  7%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/sastoken.c.o
[  7%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/sha1.c.o
[  7%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/sha224.c.o
[  7%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/sha384-512.c.o
[  8%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/strings.c.o
[  8%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/string_token.c.o
[  8%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/string_tokenizer.c.o
[  9%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/uuid.c.o
[  9%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/urlencode.c.o
[  9%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/usha.c.o
[  9%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/vector.c.o
[ 10%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/xlogging.c.o
[ 10%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/optionhandler.c.o
[ 10%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/adapters/agenttime.c.o
[ 11%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/adapters/condition_pthreads.c.o
[ 11%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/adapters/lock_pthreads.c.o
[ 11%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/adapters/platform_linux.c.o
[ 11%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/adapters/socketio_berkeley.c.o
Scanning dependencies of target msr_riot
[ 11%] Building C object provisioning_client/deps/CMakeFiles/msr_riot.dir/RIoT/Emulator/DICE/DiceSha256.c.o
[ 12%] Building C object provisioning_client/deps/CMakeFiles/msr_riot.dir/RIoT/Emulator/RIoT/RIoTCrypt/RiotAes128.c.o
[ 13%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/adapters/tickcounter_linux.c.o
[ 13%] Building C object provisioning_client/deps/CMakeFiles/msr_riot.dir/RIoT/Emulator/RIoT/RIoTCrypt/RiotAesTables.c.o
[ 13%] Building C object provisioning_client/deps/CMakeFiles/msr_riot.dir/RIoT/Emulator/RIoT/RIoTCrypt/RiotCrypt.c.o
[ 13%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/adapters/threadapi_pthreads.c.o
[ 13%] Building C object provisioning_client/deps/CMakeFiles/msr_riot.dir/RIoT/Emulator/RIoT/RIoTCrypt/RiotDerEnc.c.o
[ 13%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/adapters/uniqueid_linux.c.o
[ 14%] Building C object provisioning_client/deps/CMakeFiles/msr_riot.dir/RIoT/Emulator/RIoT/RIoTCrypt/RiotEcc.c.o
[ 15%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/adapters/envvariable.c.o
[ 15%] Building C object provisioning_client/deps/CMakeFiles/msr_riot.dir/RIoT/Emulator/RIoT/RIoTCrypt/RiotHmac.c.o
[ 15%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/adapters/linux_time.c.o
[ 15%] Building C object provisioning_client/deps/CMakeFiles/msr_riot.dir/RIoT/Emulator/RIoT/RIoTCrypt/RiotKdf.c.o
[ 16%] Building C object provisioning_client/deps/CMakeFiles/msr_riot.dir/RIoT/Emulator/RIoT/RIoTCrypt/RiotSha256.c.o
[ 16%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/httpapiex.c.o
[ 16%] Building C object provisioning_client/deps/CMakeFiles/msr_riot.dir/RIoT/Emulator/RIoT/RIoTCrypt/RiotX509Bldr.c.o
[ 16%] Building C object provisioning_client/deps/CMakeFiles/msr_riot.dir/RIoT/Emulator/RIoT/RIoTCrypt/RiotBase64.c.o
[ 16%] Linking C static library libmsr_riot.a
[ 17%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/httpapiexsas.c.o
[ 17%] Built target msr_riot
[ 17%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/httpheaders.c.o
[ 17%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/adapters/httpapi_curl.c.o
Scanning dependencies of target serializer
[ 17%] Building C object serializer/CMakeFiles/serializer.dir/src/agenttypesystem.c.o
[ 17%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/http_proxy_io.c.o
[ 18%] Building C object serializer/CMakeFiles/serializer.dir/src/codefirst.c.o
[ 19%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/adapters/tlsio_openssl.c.o
[ 19%] Building C object serializer/CMakeFiles/serializer.dir/src/commanddecoder.c.o
[ 19%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/adapters/x509_openssl.c.o
[ 19%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/wsio.c.o
[ 20%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/uws_client.c.o
[ 20%] Building C object serializer/CMakeFiles/serializer.dir/src/datamarshaller.c.o
[ 20%] Building C object serializer/CMakeFiles/serializer.dir/src/datapublisher.c.o
[ 20%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/uws_frame_encoder.c.o
[ 20%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/utf8_checker.c.o
[ 20%] Building C object c-utility/CMakeFiles/aziotsharedutil.dir/src/ws_url.c.o
[ 21%] Building C object serializer/CMakeFiles/serializer.dir/src/dataserializer.c.o
[ 22%] Linking C static library libaziotsharedutil.a
[ 22%] Built target aziotsharedutil
[ 22%] Building C object serializer/CMakeFiles/serializer.dir/src/iotdevice.c.o
[ 22%] Building C object serializer/CMakeFiles/serializer.dir/src/jsondecoder.c.o
[ 23%] Building C object serializer/CMakeFiles/serializer.dir/src/jsonencoder.c.o
[ 23%] Building C object serializer/CMakeFiles/serializer.dir/src/multitree.c.o
[ 23%] Building C object serializer/CMakeFiles/serializer.dir/src/schema.c.o
Scanning dependencies of target custom_hsm_example
[ 23%] Building C object provisioning_client/samples/custom_hsm_example/CMakeFiles/custom_hsm_example.dir/custom_hsm_example.c.o
[ 23%] Linking C static library libcustom_hsm_example.a
[ 23%] Built target custom_hsm_example
[ 23%] Building C object serializer/CMakeFiles/serializer.dir/src/schemalib.c.o
[ 24%] Building C object serializer/CMakeFiles/serializer.dir/src/schemaserializer.c.o
[ 24%] Building C object serializer/CMakeFiles/serializer.dir/src/methodreturn.c.o
Scanning dependencies of target provisioning_device_client_mock
[ 24%] Building CXX object provisioning_device_client_python/tests/CMakeFiles/provisioning_device_client_mock.dir/provisioning_device_client_mock.cpp.o
[ 24%] Linking C static library libserializer.a
[ 24%] Built target serializer
Scanning dependencies of target iothub_client_mock
[ 24%] Building CXX object python/test/CMakeFiles/iothub_client_mock.dir/iothub_client_mock.cpp.o
[ 24%] Building CXX object provisioning_device_client_python/tests/CMakeFiles/provisioning_device_client_mock.dir/__/src/provisioning_device_client_python.cpp.o
[ 25%] Building CXX object python/test/CMakeFiles/iothub_client_mock.dir/__/src/iothub_client_python.cpp.o
[ 26%] Linking CXX shared library provisioning_device_client_mock.so
/usr/bin/ld: /usr/local/lib/libpython3.5m.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython3.5m.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
provisioning_device_client_python/tests/CMakeFiles/provisioning_device_client_mock.dir/build.make:122: recipe for target 'provisioning_device_client_python/tests/provisioning_device_client_mock.so' failed
make[2]: *** [provisioning_device_client_python/tests/provisioning_device_client_mock.so] Error 1
CMakeFiles/Makefile2:5224: recipe for target 'provisioning_device_client_python/tests/CMakeFiles/provisioning_device_client_mock.dir/all' failed
make[1]: *** [provisioning_device_client_python/tests/CMakeFiles/provisioning_device_client_mock.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 26%] Linking CXX shared library iothub_client_mock.so
/usr/bin/ld: /usr/local/lib/libpython3.5m.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython3.5m.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
python/test/CMakeFiles/iothub_client_mock.dir/build.make:122: recipe for target 'python/test/iothub_client_mock.so' failed
make[2]: *** [python/test/iothub_client_mock.so] Error 1
CMakeFiles/Makefile2:5369: recipe for target 'python/test/CMakeFiles/iothub_client_mock.dir/all' failed
make[1]: *** [python/test/CMakeFiles/iothub_client_mock.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

任何想法都出了什么问题。

0 个答案:

没有答案