multiple definitions of 'operator|='

ppisljar
Posts: 19
Joined: Wed Feb 22, 2017 4:36 pm

multiple definitions of 'operator|='

Postby ppisljar » Sun Sep 15, 2019 1:50 pm

Recently i installed esp idf on new machine, thus upgraded to latest version with cmake and gcc 8.2.0
however my project now no longer builds. it compiled ok, but when linking i get the following errors:

Code: Select all

/home/user/.espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/user/esp/esp32ctrl/build/main/libmain.a(c004_timers.o): in function `operator|=':
/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: multiple definition of `operator|='; /home/user/esp/esp32ctrl/build/main/libmain.a(main.o):/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: first defined here
/home/user/.espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/user/esp/esp32ctrl/build/main/libmain.a(c004_timers.o): in function `operator&=':
/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: multiple definition of `operator&='; /home/user/esp/esp32ctrl/build/main/libmain.a(main.o):/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: first defined here
/home/user/.espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/user/esp/esp32ctrl/build/main/libmain.a(c004_timers.o): in function `operator^=':
/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: multiple definition of `operator^='; /home/user/esp/esp32ctrl/build/main/libmain.a(main.o):/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: first defined here
/home/user/.espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/user/esp/esp32ctrl/build/main/libmain.a(c004_timers.o): in function `operator>>=':
/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: multiple definition of `operator>>='; /home/user/esp/esp32ctrl/build/main/libmain.a(main.o):/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: first defined here
/home/user/.espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/user/esp/esp32ctrl/build/main/libmain.a(c004_timers.o): in function `operator<<=':
/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: multiple definition of `operator<<='; /home/user/esp/esp32ctrl/build/main/libmain.a(main.o):/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: first defined here
/home/user/.espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/user/esp/esp32ctrl/build/main/libmain.a(p015_dimmer.o): in function `operator|=':
/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: multiple definition of `operator|='; /home/user/esp/esp32ctrl/build/main/libmain.a(main.o):/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: first defined here
/home/user/.espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/user/esp/esp32ctrl/build/main/libmain.a(p015_dimmer.o): in function `operator&=':
/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: multiple definition of `operator&='; /home/user/esp/esp32ctrl/build/main/libmain.a(main.o):/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: first defined here
/home/user/.espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/user/esp/esp32ctrl/build/main/libmain.a(p015_dimmer.o): in function `operator^=':
/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: multiple definition of `operator^='; /home/user/esp/esp32ctrl/build/main/libmain.a(main.o):/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: first defined here
/home/user/.espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/user/esp/esp32ctrl/build/main/libmain.a(p015_dimmer.o): in function `operator>>=':
/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: multiple definition of `operator>>='; /home/user/esp/esp32ctrl/build/main/libmain.a(main.o):/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: first defined here
/home/user/.espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/user/esp/esp32ctrl/build/main/libmain.a(p015_dimmer.o): in function `operator<<=':
/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: multiple definition of `operator<<='; /home/user/esp/esp32ctrl/build/main/libmain.a(main.o):/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: first defined here
/home/user/.espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/user/esp/esp32ctrl/build/main/libmain.a(rule_engine.o): in function `operator|=':
/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: multiple definition of `operator|='; /home/user/esp/esp32ctrl/build/main/libmain.a(main.o):/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: first defined here
/home/user/.espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/user/esp/esp32ctrl/build/main/libmain.a(rule_engine.o): in function `operator&=':
/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: multiple definition of `operator&='; /home/user/esp/esp32ctrl/build/main/libmain.a(main.o):/home/user/esp/esp-idf/components/soc/include/hal/timer_types.h:52: first defined here

i tried googling but couldnt find any relevant information. any idea whats going on ?

ppisljar
Posts: 19
Joined: Wed Feb 22, 2017 4:36 pm

Re: multiple definitions of 'operator|='

Postby ppisljar » Sun Sep 15, 2019 6:22 pm

the code was working with esp-idf 4.0 (with gcc 4.2.0) .... latest version is 4.1 with gcc 8.2.0

ppisljar
Posts: 19
Joined: Wed Feb 22, 2017 4:36 pm

Re: multiple definitions of 'operator|='

Postby ppisljar » Sun Sep 15, 2019 6:23 pm

the code can be seen here https://github.com/ppisljar/esp32ctrl

ESP_michael
Posts: 37
Joined: Mon Aug 28, 2017 10:25 am

Re: multiple definitions of 'operator|='

Postby ESP_michael » Wed Oct 23, 2019 7:46 am

Hi ppisljar,

We forgot to add static when defining quick helper function in the header.

Could you please add `static ` at the begining of operator function lines in `esp_attr.h` and have a try? i.e.

https://github.com/espressif/esp-idf/bl ... .h#L84-L94

markbt
Posts: 1
Joined: Sun Nov 17, 2019 8:27 pm

Re: multiple definitions of 'operator|='

Postby markbt » Sun Nov 17, 2019 8:29 pm

Just wanted to say I was having the same problem with the 4.0 release docker image. Adding the static definitions sorted this out.

Who is online

Users browsing this forum: No registered users and 100 guests