[SOLVED] Cannot link precompiled libraries

I’m try to link with precompiled cryptographic library, but got this error

…arm-none-eabi/bin/ld.exe: cannot find -lM3_CryptoFW_2_0_6
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\mytest\firmware.elf] Error 1

seems the linker can’t find the library but the file M3_CryptoFW_2_0_6.a is exist and located at
src\STM32_Cryptographic_Library\binary\EWARM\M3_CryptoFW_2_0_6.a

PlatformIO Project Configuration File
[env:mytest]
platform = ststm32
board = genericSTM32F103RC
framework = stm32cube
upload_protocol = stlink
build_flags =
-I src/STM32_Cryptographic_Library/inc
-L src/STM32_Cryptographic_Library/binary/EWARM
-l M3_CryptoFW_2_0_6

also i have try the basic example and make mock of foo.a located at /opt/lib but
[env:specific_inclibs]
build_flags = -I/opt/include -L/opt/lib -lfoo

got the same error cannot find -lfoo

SOLVED

the library file name must start with lib…
so finally libM3_CryptoFW_2_0_6.a is working

3 Likes