Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined reference to functions of regex.h library (IDFGH-372) #2407

Closed
gost-serb opened this issue Sep 14, 2018 · 4 comments
Closed

Undefined reference to functions of regex.h library (IDFGH-372) #2407

gost-serb opened this issue Sep 14, 2018 · 4 comments

Comments

@gost-serb
Copy link

Environment

  • Development Kit: ESP32-DevKitC
  • Kit version: v2
  • Core (if using chip or module): ESP-WROOM32
  • IDF version: master 31c14a5
  • Development Env: Make
  • Operating System: Ubuntu
  • Power Supply: USB

Problem Description

When building a project with C regex (#include <regex.h>) linker reports about undefined reference of regcomp/regexec functions

Expected Behavior

Project builds successfully.

Actual Behavior

Failed on linkage phase

Code to reproduce this issue

#include <regex.h>

void app_main()
{
    regex_t regex;
   
    regcomp(&regex, "^a[[:alnum:]]", 0);
}

Debug Logs

/home/esp/foo/build/main/libmain.a(main.o):(.literal.app_main+0x14): undefined reference to `regcomp'
/home/esp/foo/build/main/libmain.a(main.o): In function `app_main':
/home/esp/foo/main/main.c:388: undefined reference to `regcomp'
collect2: error: ld returned 1 exit status
@negativekelvin
Copy link
Contributor

I believe the supplied newlib does not provide regex support but you can use std::regex from libstdc++

@Alvin1Zhang Alvin1Zhang changed the title Undefined reference to functions of regex.h library [TW#26340] Undefined reference to functions of regex.h library Sep 18, 2018
@gost-serb
Copy link
Author

But if I use only C language there are no standard regex library?

@projectgus projectgus changed the title [TW#26340] Undefined reference to functions of regex.h library Undefined reference to functions of regex.h library (IDFGH-372) Mar 12, 2019
@HrMitrev
Copy link

HrMitrev commented May 8, 2019

Has anyone found any altrnative to POSIX's regex? I'm contemplating on using https://github.com/kokke/tiny-regex-c, but it lacks some features. Is there any way to add the source code to esp-idf in order to make /components/newlib/include/regex.h work?

@moefear85
Copy link

moefear85 commented Nov 4, 2022

bump. unless c++ regex is supported, then unbump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants