Library names aren't being found

Sysprogs forums Forums VisualGDB Library names aren't being found

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #22087
    MystikReasons
    Participant

    Im trying to use a library which my school made.

    The first problem was, it was compiled as a .lib and wasn’t compatible with gcc.

    Now I compiled the source code to a static library .a in Visual Studio with VisualGDB.

    I followed the instructions of this website for linking: https://visualgdb.com/support/linkerinputs/

    My library is in the same folder as I defined it in the “Library directories”

    See the images below.

    What am I doing wrong?

    Attachments:
    You must be logged in to view attached files.
    #22095
    support
    Keymaster

    Hi,

    Most likely some of the library directories/names settings are incorrect. Please try enabling verbose linker mode via VS project properties (not VisualGDB Project Properties) and check the build output. The linker will dump the full list of paths it checks when trying to locate the libraries.

    #22101
    MystikReasons
    Participant

    I enabled the verbose mode and got this message:

    1>VisualGDB/Debug/stm32f1xx_hal_usart.o
    1>c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/../../../../arm-eabi/bin/ld.exe: cannot find -lpthread
    1>c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/../../../../arm-eabi/bin/ld.exe: cannot find -lTouchP0P1.a
    1>collect2.exe : error : ld returned 1 exit status
    1>attempt to open VisualGDB/Debug/stm32f1xx_hal_wwdg.o succeeded
    1>VisualGDB/Debug/stm32f1xx_hal_wwdg.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_adc.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_adc.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_crc.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_crc.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_dac.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_dac.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_dma.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_dma.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_exti.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_exti.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_fsmc.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_fsmc.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_gpio.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_gpio.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_i2c.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_i2c.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_pwr.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_pwr.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_rcc.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_rcc.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_rtc.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_rtc.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_sdmmc.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_sdmmc.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_spi.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_spi.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_tim.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_tim.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_usart.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_usart.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_usb.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_usb.o
    1>attempt to open VisualGDB/Debug/stm32f1xx_ll_utils.o succeeded
    1>VisualGDB/Debug/stm32f1xx_ll_utils.o
    1>attempt to open ../../TouchP0P1.a succeeded
    1>(../../TouchP0P1.a)startup_stm32f107xc.o
    1>attempt to open C:/Elektronik Projekte/05_Bosch-Sensor I2C/06_Software/Visual Studio/libpthread.so failed
    1>attempt to open C:/Elektronik Projekte/05_Bosch-Sensor I2C/06_Software/Visual Studio\libpthread.a failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/thumb/cortex_m3/libpthread.so failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/thumb/cortex_m3\libpthread.a failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/../../../../arm-eabi/lib/thumb/cortex_m3/libpthread.so failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/../../../../arm-eabi/lib/thumb/cortex_m3\libpthread.a failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/libpthread.so failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0\libpthread.a failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/libpthread.so failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc\libpthread.a failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/../../../../arm-eabi/lib/libpthread.so failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/../../../../arm-eabi/lib\libpthread.a failed
    1>attempt to open C:/Elektronik Projekte/05_Bosch-Sensor I2C/06_Software/Visual Studio/libTouchP0P1.a.so failed
    1>attempt to open C:/Elektronik Projekte/05_Bosch-Sensor I2C/06_Software/Visual Studio\libTouchP0P1.a.a failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/thumb/cortex_m3/libTouchP0P1.a.so failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/thumb/cortex_m3\libTouchP0P1.a.a failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/../../../../arm-eabi/lib/thumb/cortex_m3/libTouchP0P1.a.so failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/../../../../arm-eabi/lib/thumb/cortex_m3\libTouchP0P1.a.a failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/libTouchP0P1.a.so failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0\libTouchP0P1.a.a failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/libTouchP0P1.a.so failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc\libTouchP0P1.a.a failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/../../../../arm-eabi/lib/libTouchP0P1.a.so failed
    1>attempt to open c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/7.2.0/../../../../arm-eabi/lib\libTouchP0P1.a.a failed

    Do I need to get the pthread file from somewhere? Nothing has been mentioned about this on this site (https://visualgdb.com/support/linkerinputs/)

    Cant he find the TouchP0P1.a lib because the pthread failed?

    In the images you will see my linker/ c,c++ settings and my files in the directory which I defined

    Attachments:
    You must be logged in to view attached files.
    #22105
    support
    Keymaster

    Hi,

    The pthread library is usually available on the Linux targets, but not on barebone embedded targets like STM32. If your project relies on the pthread library, it might require some specific STM32 port of it. We would advise confirming it with the party that provided you with the project and check what exact libraries they are using.

    The other library is likely not found due to the extra extension in the library name list (see the linker log – it’s automatically appending the extension to the name you specified resulting in libTouchP0P1.a.a).

    #22108
    MystikReasons
    Participant

    Hello

    I could fix the first error about the pthread because I didn’t need it.

    About the second one:

    The linker now finds the TouchP0P1.a but he still complains about not finding libTouchP0P1.a.so which I dont have.

    The only 2 files which VisualGDB created for me when I made the static lib was the “TouchP0P1.a” and the “TouchP0P1.ar.rsp”.

    Why is he searching for libTouchP0P1 instead of just TouchP0P1 which I defined in the settings?

    Is there something wrong with the lib which I created or what can I do to solve this problem?

    In the images down below you will see my settings for creating the lib and the files which the program created.

    • This reply was modified 5 years, 6 months ago by MystikReasons.
    Attachments:
    You must be logged in to view attached files.
    #22117
    support
    Keymaster

    Hi,

    The GNU linker indeed automatically prepends the “lib” suffix and the “.a” or “.so” extension for libraries specified via the “library names”. You can find an exhaustive description of this logic here: https://visualgdb.com/support/linkerinputs/.

    BTW, if both projects are built with VisualGDB, you can simply add the library project to the solution and then add it as a reference to the main executable project (via right-clicking in Solution Explorer) and VisualGDB will handle everything automatically, so you won’t need to worry about the GNU library naming rules.

     

    #22118
    MystikReasons
    Participant

    I added the library project to the solution and referenced it successfully (see screenshot).

    But now I get new errors and I really dont know why:

    1>------ Erstellen gestartet: Projekt: TouchP0P1, Konfiguration: Debug VisualGDB ------
     1>TouchGrafik.c
     2>------ Erstellen gestartet: Projekt: I2C_Driver, Konfiguration: Debug VisualGDB ------
     2>Linking ../VisualGDB/Debug/I2C_Driver...
     2>../../TouchP0P1.a(TouchGrafik.o): In function `Initial_GLCD_Hardware':
     2>C:\Users\jense\Desktop\TouchP0P1Lib_REVD_1738\TouchGrafik.c(324): error : undefined reference to `RCC_APB2PeriphClockCmd'
     2>C:\Users\jense\Desktop\TouchP0P1Lib_REVD_1738\TouchGrafik.c(330): error : undefined reference to `GPIO_Init'
     2>C:\Users\jense\Desktop\TouchP0P1Lib_REVD_1738\TouchGrafik.c(336): error : undefined reference to `GPIO_Init'
     2>C:\Users\jense\Desktop\TouchP0P1Lib_REVD_1738\TouchGrafik.c(342): error : undefined reference to `GPIO_Init'
     2>C:\Users\jense\Desktop\TouchP0P1Lib_REVD_1738\TouchGrafik.c(348): error : undefined reference to `GPIO_Init'
     2>C:\Users\jense\Desktop\TouchP0P1Lib_REVD_1738\TouchGrafik.c(355): error : undefined reference to `GPIO_WriteBit'
     2>C:\Users\jense\Desktop\TouchP0P1Lib_REVD_1738\TouchGrafik.c(357): error : undefined reference to `GPIO_WriteBit'

    I included the necessary header files a few lines above it

    #include “stm32f10x_gpio.h”
    #include “stm32f10x_rcc.h”
    #include “stm32f10x_spi.h”

    Intellisense also finds the functions and nothing is being underlined red.

    Never had this error before

    Attachments:
    You must be logged in to view attached files.
    #22120
    support
    Keymaster

    Hi,

    It looks like your project is missing implementations for some functions, so you would need to locate them and ensure they are added to the project.

    If you are not sure about the differences between the declarations and implementations, please try following this tutorial. It explains in detail how to diagnose a similar problem.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.