Ошибка связывания в mbed-crypto на NUCLEO_L152RE - PullRequest
0 голосов
/ 13 марта 2020

Я использую пример кода шифрования (https://github.com/ARMmbed/mbed-os-example-mbed-crypto) на NUCLEO-L152RE. Программа скомпилирована правильно, но при компоновке есть ошибки. Журнал ошибок приведен ниже. Я пытался выполнить несколько раз, но та же проблема сохраняется. Я установил GNU Tools ARM Embedded на диск C и мои программы находятся на диске D, будет ли это иметь значение? Я предполагаю, что нет, так как компиляция верна.

**Error Log** 
--

D:\MbedWorkSpace\mbedCrypto>mbed compile --target NUCLEO_L152RE --toolchain GCC_ARM --profile=mbed-os\tools\profiles\debug.json
[mbed] Working path "D:\MbedWorkSpace\mbedCrypto" (program)
Building project mbedCrypto (NUCLEO_L152RE, GCC_ARM)
Scan: mbedCrypto
Compile [  0.1%]: mbed_tz_context.c
Compile [  0.2%]: MCR20Drv.c
Compile [  0.3%]: rf_configuration.c
Compile [  0.5%]: main.cpp
Compile [  0.6%]: ESP8266.cpp
Compile [  0.7%]: at24mac_s2lp.cpp
Compile [  0.8%]: at24mac.cpp
Compile [  0.9%]: AnalogIn.cpp
Compile [  1.0%]: NanostackRfPhyMcr20a.cpp
Compile [  1.1%]: NanostackRfPhyAtmel.cpp
Compile [  1.3%]: ESP8266Interface.cpp
[Warning] ESP8266Interface.cpp@522,1: 'virtual const char* ESP8266Interface::get_ip_address()' is deprecated: String-based APIs are deprecated [since mbed-os-5.15] [-Wdeprecated-declarations]
[Warning] ESP8266Interface.cpp@576,1: 'virtual const char* ESP8266Interface::get_gateway()' is deprecated: String-based APIs are deprecated [since mbed-os-5.15] [-Wdeprecated-declarations]
[Warning] ESP8266Interface.cpp@597,1: 'virtual const char* ESP8266Interface::get_netmask()' is deprecated: String-based APIs are deprecated [since mbed-os-5.15] [-Wdeprecated-declarations]
Compile [  1.4%]: NanostackRfPhys2lp.cpp
Compile [  1.5%]: AnalogOut.cpp
Compile [  1.6%]: BusInOut.cpp
Compile [  1.7%]: CAN.cpp
Compile [  1.8%]: BusIn.cpp
Compile [  1.9%]: DigitalIn.cpp
Compile [  2.1%]: BusOut.cpp
Compile [  2.2%]: DigitalInOut.cpp
Compile [  2.3%]: DigitalOut.cpp
Compile [  2.4%]: Ethernet.cpp
Compile [  2.5%]: InterruptManager.cpp
[Warning] InterruptManager.h@204,40: 'CallChain' is deprecated: CallChain has been deprecated and will be removed. [-Wdeprecated-declarations]
[Warning] InterruptManager.cpp@63,60: 'CallChain' is deprecated: CallChain has been deprecated and will be removed. [-Wdeprecated-declarations]
[Warning] InterruptManager.cpp@92,32: 'CallChain' is deprecated: CallChain has been deprecated and will be removed. [-Wdeprecated-declarations]
Compile [  2.6%]: I2CSlave.cpp
Compile [  2.7%]: PortIn.cpp
Compile [  2.9%]: PortInOut.cpp
Compile [  3.0%]: InterruptIn.cpp
Compile [  3.1%]: ResetReason.cpp
Compile [  3.2%]: MbedCRC.cpp
Compile [  3.3%]: I2C.cpp
Compile [  3.4%]: PortOut.cpp
Compile [  3.5%]: PwmOut.cpp
Compile [  3.6%]: FlashIAP.cpp
Compile [  3.8%]: QSPI.cpp
Compile [  3.9%]: RawSerial.cpp
Compile [  4.0%]: TableCRC.cpp
Compile [  4.1%]: SPISlave.cpp
Compile [  4.2%]: SerialWireOutput.cpp
Compile [  4.3%]: Ticker.cpp
Compile [  4.4%]: Timeout.cpp
Compile [  4.6%]: Timer.cpp
Compile [  4.7%]: SPI.cpp
Compile [  4.8%]: Serial.cpp
Compile [  4.9%]: ByteBuffer.cpp
Compile [  5.0%]: EndpointResolver.cpp
Compile [  5.1%]: TimerEvent.cpp
Compile [  5.2%]: SerialBase.cpp
[Warning] SerialBase.h@357,27: 'mbed::SerialBase::_rx_pin' will be initialized after [-Wreorder]
[Warning] SerialBase.h@335,24:   'void (mbed::SerialBase::* mbed::SerialBase::_init_func)()' [-Wreorder]
[Warning] SerialBase.cpp@26,1:   when initialized here [-Wreorder]
[Warning] SerialBase.h@358,28: 'mbed::SerialBase::_static_pinmap' will be initialized after [-Wreorder]
[Warning] SerialBase.h@335,24:   'void (mbed::SerialBase::* mbed::SerialBase::_init_func)()' [-Wreorder]
[Warning] SerialBase.cpp@44,1:   when initialized here [-Wreorder]
Compile [  5.4%]: Watchdog.cpp
Compile [  5.5%]: LinkedListBase.cpp
Compile [  5.6%]: OperationListBase.cpp
Compile [  5.7%]: AsyncOp.cpp
Compile [  5.8%]: UARTSerial.cpp
Compile [  5.9%]: USBCDC.cpp
Compile [  6.0%]: USBAudio.cpp
Compile [  6.2%]: USBHID.cpp
Compile [  6.3%]: USBMIDI.cpp
Compile [  6.4%]: USBDevice.cpp
Compile [  6.5%]: PolledQueue.cpp
Compile [  6.6%]: TaskBase.cpp
Compile [  6.7%]: USBCDC_ECM.cpp
Compile [  6.8%]: USBMSD.cpp
[Warning] USBMSD.h@266,18: 'USBMSD::_bd' will be initialized after [-Wreorder]
[Warning] USBMSD.h@234,14:   'uint32_t USBMSD::_addr' [-Wreorder]
[Warning] USBMSD.cpp@67,1:   when initialized here [-Wreorder]
[Warning] USBMSD.h@266,18: 'USBMSD::_bd' will be initialized after [-Wreorder]
[Warning] USBMSD.h@234,14:   'uint32_t USBMSD::_addr' [-Wreorder]
[Warning] USBMSD.cpp@80,1:   when initialized here [-Wreorder]
Compile [  7.0%]: USBMouse.cpp
Compile [  7.1%]: equeue_posix.c
Compile [  7.2%]: equeue.c
Compile [  7.3%]: USBKeyboard.cpp
Compile [  7.4%]: mbed_shared_queues.cpp
Compile [  7.5%]: USBSerial.cpp
Compile [  7.6%]: EventQueue.cpp
Compile [  7.8%]: USBMouseKeyboard.cpp
Compile [  7.9%]: AT_CellularBase.cpp
Compile [  8.0%]: equeue_mbed.cpp
Compile [  8.1%]: AT_CellularContext.cpp
[Warning] AT_CellularContext.cpp@266,39: 'virtual const char* NetworkStack::get_ip_address()' is deprecated: String-based APIs are deprecated [since mbed-os-5.15] [-Wdeprecated-declarations]
[Warning] AT_CellularContext.cpp@935,35: 'void mbed::CellularDevice::stop()' is deprecated: Use CellularDevice::shutdown() instead. [since mbed-os-5.15] [-Wdeprecated-declarations]
Compile [  8.2%]: ATHandler.cpp
Compile [  8.3%]: AT_CellularDevice.cpp
Compile [  8.4%]: APN_db.cpp
Compile [  8.6%]: CellularLog.cpp
Compile [  8.7%]: AT_CellularInformation.cpp
Compile [  8.8%]: CellularUtil.cpp
Compile [  8.9%]: AT_CellularNetwork.cpp
Compile [  9.0%]: AT_CellularStack.cpp
Compile [  9.1%]: AT_ControlPlane_netif.cpp
Compile [  9.2%]: AT_CellularSMS.cpp
Compile [  9.4%]: CellularContext.cpp
Compile [  9.5%]: CellularDevice.cpp
Compile [  9.6%]: GEMALTO_CINTERION_CellularInformation.cpp
Compile [  9.7%]: CellularStateMachine.cpp
Compile [  9.8%]: GENERIC_AT3GPP.cpp
Compile [  9.9%]: GEMALTO_CINTERION_CellularContext.cpp
Compile [ 10.0%]: GEMALTO_CINTERION.cpp
Compile [ 10.1%]: GEMALTO_CINTERION_CellularStack.cpp
[Warning] GEMALTO_CINTERION_CellularStack.cpp@468,27: 'port_start' may be used uninitialized in this function [-Wmaybe-uninitialized]
Compile [ 90.0%]: analogin_device.c
Compile [ 90.1%]: analogout_device.c
Compile [ 90.2%]: stm32l1xx_hal_adc_ex.c
Compile [ 90.3%]: ThisThread.cpp
Compile [ 90.4%]: stm32l1xx_hal_comp.c
Compile [ 90.5%]: stm32l1xx_hal_cortex.c
Compile [ 90.6%]: stm32l1xx_hal_crc.c
Compile [ 90.8%]: stm32l1xx_hal_cryp.c
Compile [ 90.9%]: stm32l1xx_hal_cryp_ex.c
Compile [ 91.0%]: stm32l1xx_hal_dac.c
Compile [ 91.1%]: stm32l1xx_hal_dac_ex.c
Compile [ 91.2%]: stm32l1xx_hal_dma.c
Compile [ 91.3%]: stm32l1xx_hal_flash.c
Compile [ 91.4%]: stm32l1xx_hal_flash_ex.c
Compile [ 91.6%]: stm32l1xx_hal_flash_ramfunc.c
Compile [ 91.7%]: stm32l1xx_hal_gpio.c
Compile [ 91.8%]: stm32l1xx_hal_i2s.c
Compile [ 91.9%]: stm32l1xx_hal_iwdg.c
Compile [ 92.0%]: stm32l1xx_hal_i2c.c
Compile [ 92.1%]: stm32l1xx_hal_lcd.c
Compile [ 92.2%]: stm32l1xx_hal_nor.c
Compile [ 92.4%]: stm32l1xx_hal_opamp.c
Compile [ 92.5%]: stm32l1xx_hal_irda.c
Compile [ 92.6%]: stm32l1xx_hal_opamp_ex.c
Compile [ 92.7%]: stm32l1xx_hal_pcd_ex.c
Compile [ 92.8%]: stm32l1xx_hal_pwr.c
Compile [ 92.9%]: stm32l1xx_hal_pcd.c
Compile [ 93.0%]: stm32l1xx_hal_pwr_ex.c
Compile [ 93.2%]: stm32l1xx_hal_rcc_ex.c
Compile [ 93.3%]: stm32l1xx_hal_rtc.c
Compile [ 93.4%]: stm32l1xx_hal_rcc.c
Compile [ 93.5%]: stm32l1xx_hal_sd.c
Compile [ 93.6%]: stm32l1xx_hal_rtc_ex.c
Compile [ 93.7%]: stm32l1xx_hal_smartcard.c
Compile [ 93.8%]: stm32l1xx_hal_spi.c
Compile [ 94.0%]: stm32l1xx_hal_spi_ex.c
Compile [ 94.1%]: stm32l1xx_hal_sram.c
Compile [ 94.2%]: stm32l1xx_hal_tim_ex.c
Compile [ 94.3%]: stm32l1xx_hal_tim.c
Compile [ 94.4%]: stm32l1xx_hal_usart.c
Compile [ 94.5%]: stm32l1xx_hal_wwdg.c
Compile [ 94.6%]: stm32l1xx_hal_uart.c
Compile [ 94.8%]: stm32l1xx_ll_adc.c
Compile [ 94.9%]: stm32l1xx_ll_comp.c
Compile [ 95.0%]: stm32l1xx_ll_crc.c
Compile [ 95.1%]: stm32l1xx_ll_dac.c
Compile [ 95.2%]: stm32l1xx_ll_fsmc.c
Compile [ 95.3%]: stm32l1xx_ll_gpio.c
Compile [ 95.4%]: stm32l1xx_ll_dma.c
Compile [ 95.6%]: stm32l1xx_ll_exti.c
Compile [ 95.7%]: stm32l1xx_ll_opamp.c
Compile [ 95.8%]: stm32l1xx_ll_i2c.c
Compile [ 95.9%]: stm32l1xx_ll_pwr.c
Compile [ 96.0%]: stm32l1xx_ll_rcc.c
Compile [ 96.1%]: stm32l1xx_ll_sdmmc.c
Compile [ 96.2%]: stm32l1xx_ll_tim.c
Compile [ 96.4%]: stm32l1xx_ll_spi.c
Compile [ 96.5%]: stm32l1xx_ll_rtc.c
Compile [ 96.6%]: stm32l1xx_ll_usart.c
Compile [ 96.7%]: stm32l1xx_ll_utils.c
Compile [ 96.8%]: system_stm32l1xx.c
Compile [ 96.9%]: USBPhy_STM32.cpp
Compile [ 97.0%]: gpio_irq_device.c
Compile [ 97.1%]: flash_api.c
Compile [ 97.3%]: pwmout_device.c
Compile [ 97.4%]: spi_api.c
Compile [ 97.5%]: analogin_api.c
Compile [ 97.6%]: serial_device.c
Compile [ 97.7%]: analogout_api.c
Compile [ 97.8%]: can_api.c
Compile [ 97.9%]: gpio_irq_api.c
Compile [ 98.1%]: hal_tick_overrides.c
Compile [ 98.2%]: gpio_api.c
Compile [ 98.3%]: mbed_crc_api.c
Compile [ 98.4%]: i2c_api.c
[Warning] i2c_api.c@518,19: unused variable 'obj_s' [-Wunused-variable]
Compile [ 98.5%]: qspi_api.c
Compile [ 98.6%]: pinmap.c
Compile [ 98.7%]: lp_ticker.c
Compile [ 98.9%]: mbed_overrides.c
Compile [ 99.0%]: trng_api.c
Compile [ 99.1%]: port_api.c
Compile [ 99.2%]: reset_reason.c
Compile [ 99.3%]: pwmout_api.c
Compile [ 99.4%]: rtc_api.c
Compile [ 99.5%]: serial_api.c
Compile [ 99.7%]: sleep.c
Compile [ 99.8%]: us_ticker.c
Compile [ 99.9%]: stm_spi_api.c
Compile [100.0%]: watchdog_api.c

Link: mbedCrypto
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `psa_import_ec_private_key':
D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:654: undefined reference to `mbedtls_ctr_drbg_random'

c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `psa_rsa_sign':
D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3148: undefined reference to `mbedtls_ctr_drbg_random'

c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `psa_ecdsa_sign':
D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3277: undefined reference to `mbedtls_ctr_drbg_random'

c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `psa_cipher_generate_iv':
D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3810: undefined reference to `mbedtls_ctr_drbg_random'

c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `psa_generate_random':
D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5375: undefined reference to `mbedtls_ctr_drbg_random'

c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o:D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5384: more undefined references to `mbedtls_ctr_drbg_random' follow

c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `mbedtls_psa_crypto_free':
D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5611: undefined reference to `mbedtls_ctr_drbg_free'

c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `psa_crypto_init':
D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5678: undefined reference to `mbedtls_ctr_drbg_init'

c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5680: undefined reference to `mbedtls_ctr_drbg_seed'

c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5658: undefined reference to `mbedtls_entropy_func'

c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5658: undefined reference to `mbedtls_entropy_init'

c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5658: undefined reference to `mbedtls_entropy_free'
collect2.exe: error: ld returned 1 exit status
[ERROR] c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `psa_import_ec_private_key':
D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:654: undefined reference to `mbedtls_ctr_drbg_random'

c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `psa_rsa_sign':
D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3148: undefined reference to `mbedtls_ctr_drbg_random'

c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `psa_ecdsa_sign':
D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3277: undefined reference to `mbedtls_ctr_drbg_random'

c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `psa_cipher_generate_iv':
D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3810: undefined reference to `mbedtls_ctr_drbg_random'
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `psa_generate_random':
D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5375: undefined reference to `mbedtls_ctr_drbg_random'
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o:D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5384: more undefined references to `mbedtls_ctr_drbg_random' follow
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `mbedtls_psa_crypto_free':
D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5611: undefined reference to `mbedtls_ctr_drbg_free'
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `psa_crypto_init':
D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5678: undefined reference to `mbedtls_ctr_drbg_init'
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5680: undefined reference to `mbedtls_ctr_drbg_seed'
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5658: undefined reference to `mbedtls_entropy_func'
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5658: undefined reference to `mbedtls_entropy_init'
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbedCrypto/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5658: undefined reference to `mbedtls_entropy_free'
collect2.exe: error: ld returned 1 exit status

[mbed] ERROR: "C:\Python27\python.exe" returned error.
       Code: 1
       Path: "D:\MbedWorkSpace\mbedCrypto"
       Command: "C:\Python27\python.exe -u D:\MbedWorkSpace\mbedCrypto\mbed-os\tools\make.py -t GCC_ARM -m NUCLEO_L152RE --profile mbed-os\tools\profiles\debug.json --source . --build .\BUILD\NUCLEO_L152RE\GCC_ARM-DEBUG"
       Tip: You could retry the last command with "-v" flag for verbose output
---

CMake Output Errors

Я хочу компилировать без Visual Studio, так как я использую Ubuntu. Могу ли я просто скачать mbed TLS и сделать это, как это делается с другими библиотеками?

CMake

1 Ответ

0 голосов
/ 13 марта 2020

У вас ошибка ссылки, потому что ваш компилятор не может найти mbedtls_ctr_drbg_random реализацию функции, объявленную в ctr_drbg.h (см. Описание Здесь ):

Я проверяю библиотеку для вас. Это работает после этого:

1- Я загружаю код Mbedtls_crt_drbg здесь Здесь
2- Извлекаем zip-библиотеку в вашем каталоге (G: \ Cmake \ Sources \ mbedtls в моем случае)
3- Использование Cmake (доступно Здесь ) для генерации решения (Visual Studio 2010 в моем случае)

enter image description here

4- Открыть и скомпилировать сгенерированный проект (в моем случае "G:\Cmake\Build\Mbedtls\mbed TLS.sln")

5- После компиляции, смотрите вывод проекта mbedcrypto, он генерирует static lib (в моем случае G: \ Cmake \ Build \ Mbedtls \ library \ Debug \)

enter image description here

6- Вы можете проверить, экспортируется ли функция без ссылки mbedtls_ctr_drbg_random в лунку в static lib, используя командную строку Visual Studio (или другой вариант. .)

dumpbin /symbols /exports "G:\Cmake\Build\Mbedtls\library\Debug\mbedcrypto.lib" | findstr mbedtls_ctr_drbg_random  

Вы должны иметь это:
enter image description here

7- Ничего не делать для заголовка, так как вы можете включают crt_drbg.h (в моем случае: я добавляю G:\Cmake\Sources\mbedtls\include\mbedtls к дополнительному пути включения

8- Добавьте mbedcrypto.lib в вашу программу. В моем случае я делаю это:

Right click on my test project -> properties-> Common Properties-> Add New  Reference -> mbedcrypto  

9- Теперь я могу скомпилировать и связать с функцией mbedtls_ctr_drbg_random:
enter image description here

Вы должны сделать то же самое для вашей программы

...