Skip to main content
MrSzymonello
Associate
July 26, 2021
Question

In main.c I have #include and calls to regcomp and regexec. In the build output, I receive undefined reference to `regcomp'. Is it an error in the linker stage? What linker setting I should change?

  • July 26, 2021
  • 4 replies
  • 3022 views

MCU GCC Linker options are

-mcpu=cortex-m3 -T"C:\Users\ssz\STM32CubeIDE\temp\edmr2\STM32F103VETX_FLASH.ld" --specs=nosys.specs -Wl,-Map="${BuildArtifactFileBaseName}.map" -Wl,--gc-sections -Wl,--verbose -static --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group

toolchain is GNU Tools for STM32 (9-2020-q2-update)

regex.h is in C:\ST\STM32CubeIDE_1.5.1\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_2.0.0.202105311346\tools\arm-none-eabi\include

This topic has been closed for replies.

4 replies

Cartu38 OpenDev
Graduate II
July 26, 2021

#include <sys/types.h>

#include <regex.h>

https://devel.rtems.org/ticket/3631

MrSzymonello
Associate
July 26, 2021

Yes, I also had a problem with off_t and solved it as you suggest. This however does not solve undefined reference to `regcomp'.

MrSzymonello
Associate
July 26, 2021

@Cartu38 OpenDev​ do you have working code with regex.h available? Could you show your MCU GCC Linker options? If you use CubeIDE go to project Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU GCC Linker.

Cartu38 OpenDev
Graduate II
July 26, 2021

Not functional neither. I guess answer is here: https://answers.launchpad.net/gcc-arm-embedded/+question/208555

I've got a look to all .a provided file as part of toolchain, none of them is promoting 'regcomp' implementation.

Maybe https://github.com/kokke/tiny-regex-c is good solution