Multiple definition of functions when trying to use regex

zliudr
Posts: 360
Joined: Thu Oct 03, 2019 5:15 am

Multiple definition of functions when trying to use regex

Postby zliudr » Wed Apr 22, 2020 6:35 am

I "make clean" already. Code is minimal. It seems that I can't use

Code: Select all

In function `std::__throw_logic_error(char const*)':
functexcept.cc:(.text._ZSt19__throw_logic_errorPKc+0x0): multiple definition of `std::__throw_logic_error(char const*)'
My code: hello_world.cpp

Code: Select all

#include "esp_system.h"
#include <iostream>
#include <regex>


extern "C" void app_main()
{
	char char_array[]="12345678";
	//std::string str="12345678901234";
	std::regex reg1 ("^(\\d{8}|\\d{12,14})$");

   for (int i = 10; i >= 0; i--) 
	{
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }
    esp_restart();
}

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: Multiple definition of functions when trying to use regex

Postby ESP_Sprite » Wed Apr 22, 2020 8:08 am

If you haven't done this already, can you post this as an issue on Github as well? Makes it a bit easier for us to track it and give feedback.

zliudr
Posts: 360
Joined: Thu Oct 03, 2019 5:15 am

Re: Multiple definition of functions when trying to use regex

Postby zliudr » Wed Apr 22, 2020 1:45 pm

Thank you for your advice! I've not raised this issue on git yet. I'm using V3.3 so I'm not very up to date. I've read that the beta version of ESP-IDF 4.1 has included regex.h support for C. I'd rather use C support than the C++ std (ugly and probably costs unnecessarily large memory footprint with concats). But I'm in the middle of an important development and don't want to introduce any uncertainties by updating my tool chain. If I can get regex match with V3.3 that would be great. Thanks.

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Multiple definition of functions when trying to use regex

Postby ESP_igrr » Wed Apr 22, 2020 3:26 pm

Tracking this internally as IDFGH-3153.

zliudr
Posts: 360
Joined: Thu Oct 03, 2019 5:15 am

Re: Multiple definition of functions when trying to use regex

Postby zliudr » Thu Apr 23, 2020 3:18 am

Should I still post to git? Thanks.

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Multiple definition of functions when trying to use regex

Postby ESP_igrr » Thu Apr 23, 2020 8:36 am

No need, already have an issue logged for this. Will give you feedback once this is resolved.

nickname
Posts: 5
Joined: Sat Sep 28, 2019 2:37 am

Re: Multiple definition of functions when trying to use regex

Postby nickname » Thu May 21, 2020 6:46 am

Hi @zliudr,

Do you mind trying the attached patch? I could reproduce your problem on IDF v3.3 and the patch solves it.

Thanks!
Attachments
0001-Add-missing-regex_error-stub.zip
(990 Bytes) Downloaded 540 times

zliudr
Posts: 360
Joined: Thu Oct 03, 2019 5:15 am

Re: Multiple definition of functions when trying to use regex

Postby zliudr » Thu Jun 04, 2020 6:05 am

Hi sorry about the delay. Could you show me how to use that file please? I've never used this type of file before. I tried this under msys32:
diff --git a/components/cxx/cxx_exception_stubs.cpp b/components/cxx/cxx_exception_stubs.cpp index f09f946ddc..5e8f955a0b 100644

The shell doesn't under diff.

Can you please just give me a link to the new file? I don't know enough about git to make use of your solution. Also where is the link to the issue IDFGH-3153?

zliudr
Posts: 360
Joined: Thu Oct 03, 2019 5:15 am

Re: Multiple definition of functions when trying to use regex

Postby zliudr » Wed Jun 10, 2020 7:33 pm

Please! If I knew how to implement this patch I wouldn't be bugging you at all. If you helped me once, please don't let your effort go to waste. Show me how to make the change, or just attach the modified file. I don't care what git does. Thank you.

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: Multiple definition of functions when trying to use regex

Postby PeterR » Thu Jun 11, 2020 12:16 am

If I understand your question correctly then:
Expand zip into /esp-idf

Code: Select all

cd ./esp-idf
git apply 0001-Add-missing-regex_error-stub.patch
The main problem then is to make sure that you have checked out the correct version of the IDF to which this patch applies (basically a patch is a set of diffences and if your esp-idf is not the same as from which the .patch difference was generated then the patch process will fail).
Also note that if your lf/cr settings are different then Git patch will also complain. Typically an issue under Windows but if you clone from ming u should be ok (detail & detail excluded).

Its too late to dig deeper but thought I would throw in a quick little pointer as you seem in need of a hint!
& I also believe that IDF CAN should be fixed.

Who is online

Users browsing this forum: No registered users and 143 guests