Skip to contentSkip to conversation

package/gerbera: fix build with -Os and gcc 9 or 10

PATCH New Fabrice Fontaine 2 participants 2 messages May 13, 2021 – May 18, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/gerbera: fix build with -Os and gcc 9 or 10

For an unknown reason, gerbera fails to build with -Os and gcc 9 or 10 since bump to version 1.8.0 in commit 8974596836945eada8e162844fb87f88adec9100:

[100%] Linking CXX executable gerbera
/home/giuliobenetti/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-gnu/10.2.0/../../../../x86_64-buildroot-linux-gnu/bin/ld: liblibgerbera.a(content_manager.cc.o): in function `ContentManager::_rescanDirectory(std::shared_ptr<AutoscanDirectory>&, int, std::shared_ptr<GenericTask> const&)':
content_manager.cc:(.text+0xb53b): undefined reference to `std::__shared_ptr<std::filesystem::__cxx11::_Dir, (__gnu_cxx::_Lock_policy)2>::swap(std::__shared_ptr<std::filesystem::__cxx11::_Dir, (__gnu_cxx::_Lock_policy)2>&)'
collect2: error: ld returned 1 exit status

A similar build failure has been reported as gcc bug 91067:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91067

But this bug has been fixed since gcc 9.3 and 10.1 and build failures are raised with gcc 10.2

To fix this build failure, set optimisation to -O2 if needed

Fixes:
- http://autobuild.buildroot.org/results/a4ee8ad7ff93939716673b611c7cc3f68dafa3d0

---
 package/gerbera/gerbera.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/gerbera/gerbera.mk +4 -0
index 73917c7721..9627209d60 100644
@@ -18,6 +18,10 @@ GERBERA_DEPENDENCIES = \
 	zlib
 GERBERA_CONF_OPTS = -DWITH_DEBUG=OFF
 
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_9)$(BR2_OPTIMIZE_S),yy)
+GERBERA_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -O2"
+endif
+
 # Uses __atomic_fetch_add_4
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
 GERBERA_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/1 package/gerbera: fix build with -Os and gcc 9 or 10

Fabrice, All,

On 2021-05-13 13:46 +0200, Fabrice Fontaine spake thusly:

Quoted 14 lines

For an unknown reason, gerbera fails to build with -Os and gcc 9 or 10 since bump to version 1.8.0 in commit 8974596836945eada8e162844fb87f88adec9100:

[100%] Linking CXX executable gerbera
/home/giuliobenetti/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-gnu/10.2.0/../../../../x86_64-buildroot-linux-gnu/bin/ld: liblibgerbera.a(content_manager.cc.o): in function `ContentManager::_rescanDirectory(std::shared_ptr<AutoscanDirectory>&, int, std::shared_ptr<GenericTask> const&)':
content_manager.cc:(.text+0xb53b): undefined reference to `std::__shared_ptr<std::filesystem::__cxx11::_Dir, (__gnu_cxx::_Lock_policy)2>::swap(std::__shared_ptr<std::filesystem::__cxx11::_Dir, (__gnu_cxx::_Lock_policy)2>&)'
collect2: error: ld returned 1 exit status

A similar build failure has been reported as gcc bug 91067:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91067

But this bug has been fixed since gcc 9.3 and 10.1 and build failures are raised with gcc 10.2

Quoted 6 lines

To fix this build failure, set optimisation to -O2 if needed

Fixes:
- http://autobuild.buildroot.org/results/a4ee8ad7ff93939716673b611c7cc3f68dafa3d0

Applied to master, thanks.

Regards,
Yann E. MORIN.

Quoted 26 lines
---
 package/gerbera/gerbera.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/gerbera/gerbera.mk +4 -0
index 73917c7721..9627209d60 100644
@@ -18,6 +18,10 @@ GERBERA_DEPENDENCIES = \
 	zlib
 GERBERA_CONF_OPTS = -DWITH_DEBUG=OFF
 
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_9)$(BR2_OPTIMIZE_S),yy)
+GERBERA_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -O2"
+endif
+
 # Uses __atomic_fetch_add_4
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
 GERBERA_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
Signature · 6 lines
2.30.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'