Skip to contentSkip to conversation

Fix -latomic for CMake packages

PATCH Superseded Gleb Mazovetskiy 4 participants 11 messages Apr 13, 2021 – May 7, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix -latomic for CMake packages

The poppler package failed to build for me with errors such as this one:

    host/aarch64-buildroot-linux-gnu/include/c++/10.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
       75 | #include_next <stdlib.h>
          |               ^~~~~~~~~~

Changing the CMake option to a link-specific one fixes the issue.

---
 package/cutelyst/cutelyst.mk                           | 2 +-
 package/gerbera/gerbera.mk                             | 2 +-
 package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk | 2 +-
 package/poppler/poppler.mk                             | 2 +-
 package/wampcc/wampcc.mk                               | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
package/cutelyst/cutelyst.mk +1 -1
index 9520922454..5313b003ad 100644
@@ -18,7 +18,7 @@ CUTELYST_CONF_OPTS += \
 
 # Qt 5.8 needs atomics, which on various architectures are in -latomic
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-CUTELYST_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+CUTELYST_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_LIBPWQUALITY),y)
package/gerbera/gerbera.mk +1 -1
index ccb3b2eeb5..f75595a46d 100644
@@ -20,7 +20,7 @@ GERBERA_CONF_OPTS = -DWITH_DEBUG=OFF
 
 # Uses __atomic_fetch_add_4
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-GERBERA_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+GERBERA_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_DUKTAPE),y)
package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk +1 -1
index 2a782b35e1..81617492c0 100644
@@ -15,7 +15,7 @@ KF5_MODEMMANAGER_QT_INSTALL_STAGING = YES
 
 # Uses __atomic_fetch_add_4
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-KF5_MODEMMANAGER_QT_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+KF5_MODEMMANAGER_QT_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 $(eval $(cmake-package))
package/poppler/poppler.mk +1 -1
index 44ad04bf7c..a5a97d974b 100644
@@ -21,7 +21,7 @@ POPPLER_CONF_OPTS = \
 	-DENABLE_GTK_DOC=OFF
 
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-POPPLER_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+POPPLER_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_BOOST),y)
package/wampcc/wampcc.mk +1 -1
index 5e7ee03651..11bb1f90b5 100644
@@ -13,7 +13,7 @@ WAMPCC_LICENSE_FILES = LICENSE
 
 # Uses __atomic_fetch_add_8
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-WAMPCC_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+WAMPCC_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 $(eval $(cmake-package))
Signature · 1 line
2.27.0
#1 lore raw

PATCH v2 1/1 Fix -latomic for CMake packages

The poppler package failed to build for me with errors such as this one:

    host/aarch64-buildroot-linux-gnu/include/c++/10.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
       75 | #include_next <stdlib.h>
          |               ^~~~~~~~~~

Changing the CMake option to a link-specific one fixes the issue.

---
Changes v1 -> v2
- Also fix kodi

---
 package/cutelyst/cutelyst.mk                           | 2 +-
 package/gerbera/gerbera.mk                             | 2 +-
 package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk | 2 +-
 package/kodi/kodi.mk                                   | 2 +-
 package/poppler/poppler.mk                             | 2 +-
 package/wampcc/wampcc.mk                               | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
package/cutelyst/cutelyst.mk +1 -1
index 9520922454..5313b003ad 100644
@@ -18,7 +18,7 @@ CUTELYST_CONF_OPTS += \
 
 # Qt 5.8 needs atomics, which on various architectures are in -latomic
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-CUTELYST_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+CUTELYST_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_LIBPWQUALITY),y)
package/gerbera/gerbera.mk +1 -1
index ccb3b2eeb5..f75595a46d 100644
@@ -20,7 +20,7 @@ GERBERA_CONF_OPTS = -DWITH_DEBUG=OFF
 
 # Uses __atomic_fetch_add_4
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-GERBERA_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+GERBERA_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_DUKTAPE),y)
package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk +1 -1
index 2a782b35e1..81617492c0 100644
@@ -15,7 +15,7 @@ KF5_MODEMMANAGER_QT_INSTALL_STAGING = YES
 
 # Uses __atomic_fetch_add_4
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-KF5_MODEMMANAGER_QT_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+KF5_MODEMMANAGER_QT_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 $(eval $(cmake-package))
package/kodi/kodi.mk +1 -1
index 6edb0b7fca..28fe4a6a92 100644
@@ -184,7 +184,7 @@ endif
 
 # mips: uses __atomic_load_8
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-KODI_CXX_FLAGS += -latomic
+KODI_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_5),)
package/poppler/poppler.mk +1 -1
index 44ad04bf7c..a5a97d974b 100644
@@ -21,7 +21,7 @@ POPPLER_CONF_OPTS = \
 	-DENABLE_GTK_DOC=OFF
 
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-POPPLER_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+POPPLER_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_BOOST),y)
package/wampcc/wampcc.mk +1 -1
index 5e7ee03651..11bb1f90b5 100644
@@ -13,7 +13,7 @@ WAMPCC_LICENSE_FILES = LICENSE
 
 # Uses __atomic_fetch_add_8
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-WAMPCC_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+WAMPCC_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 $(eval $(cmake-package))
Signature · 1 line
2.27.0
#2 lore raw

PATCH v2 1/1 Fix -latomic for CMake packages

Hello Gleb,

Quoted 7 lines · Gleb Mazovetskiy

The poppler package failed to build for me with errors such as this one:

    host/aarch64-buildroot-linux-gnu/include/c++/10.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
       75 | #include_next <stdlib.h>
          |               ^~~~~~~~~~

Changing the CMake option to a link-specific one fixes the issue.

Out of interest (as this is a compile not link failure), what is the actual change in the compile parameter set?

Can you provide a (failing) defconfig?

Regards,
Peter

Quoted 91 lines

---
Changes v1 -> v2
- Also fix kodi

---
 package/cutelyst/cutelyst.mk                           | 2 +-
 package/gerbera/gerbera.mk                             | 2 +-
 package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk | 2 +-
 package/kodi/kodi.mk                                   | 2 +-
 package/poppler/poppler.mk                             | 2 +-
 package/wampcc/wampcc.mk                               | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
package/cutelyst/cutelyst.mk +1 -1
index 9520922454..5313b003ad 100644
@@ -18,7 +18,7 @@ CUTELYST_CONF_OPTS += \
 
 # Qt 5.8 needs atomics, which on various architectures are in -latomic
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-CUTELYST_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+CUTELYST_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_LIBPWQUALITY),y)
package/gerbera/gerbera.mk +1 -1
index ccb3b2eeb5..f75595a46d 100644
@@ -20,7 +20,7 @@ GERBERA_CONF_OPTS = -DWITH_DEBUG=OFF
 
 # Uses __atomic_fetch_add_4
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-GERBERA_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+GERBERA_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_DUKTAPE),y)
package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk +1 -1
index 2a782b35e1..81617492c0 100644
@@ -15,7 +15,7 @@ KF5_MODEMMANAGER_QT_INSTALL_STAGING = YES
 
 # Uses __atomic_fetch_add_4
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-KF5_MODEMMANAGER_QT_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+KF5_MODEMMANAGER_QT_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 $(eval $(cmake-package))
package/kodi/kodi.mk +1 -1
index 6edb0b7fca..28fe4a6a92 100644
@@ -184,7 +184,7 @@ endif
 
 # mips: uses __atomic_load_8
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-KODI_CXX_FLAGS += -latomic
+KODI_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_5),)
package/poppler/poppler.mk +1 -1
index 44ad04bf7c..a5a97d974b 100644
@@ -21,7 +21,7 @@ POPPLER_CONF_OPTS = \
 	-DENABLE_GTK_DOC=OFF
 
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-POPPLER_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+POPPLER_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_BOOST),y)
package/wampcc/wampcc.mk +1 -1
index 5e7ee03651..11bb1f90b5 100644
@@ -13,7 +13,7 @@ WAMPCC_LICENSE_FILES = LICENSE
 
 # Uses __atomic_fetch_add_8
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-WAMPCC_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+WAMPCC_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 $(eval $(cmake-package))
#3 lore raw

PATCH v2 1/1 Fix -latomic for CMake packages

Hi Peter,

The failing defconfig is here (it's specific to this buildroot):
https://github.com/batocera-linux/batocera.linux/blob/8d8038a6ddaae03f0150fd28a2d23c371156ebf2/configs/batocera-odroidgoa_defconfig

Here is the compiler command without this change:

/usr/bin/ccache /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/bin/aarch64-buildroot-linux-gnu-g++ --sysroot=/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot -Dpoppler_EXPORTS
-I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0 -I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/fofi -I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/goo -I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/poppler
*-isystem /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot/usr/include* -isystem /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/freetype2 -isystem /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/nss -isystem /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/nspr -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wcast-align
-Wformat-security -Wframe-larger-than=65536 -Wlogical-op
-Wmissing-format-attribute -Wnon-virtual-dtor -Woverloaded-virtual
-Wmissing-declarations -Wundef -Wzero-as-null-pointer-constant -Wshadow
-Wsuggest-override -fno-exceptions -fno-check-new -fno-common
-D_DEFAULT_SOURCE -O2 -DNDEBUG -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 * -O3 -latomic -fPIC *-pthread -std=c++14 -MD -MT
CMakeFiles/poppler.dir/goo/gbase64.cc.o -MF
CMakeFiles/poppler.dir/goo/gbase64.cc.o.d -o
CMakeFiles/poppler.dir/goo/gbase64.cc.o -c /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/goo/gbase64.cc

With this change:

/usr/bin/ccache /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/bin/aarch64-buildroot-linux-gnu-g++ --sysroot=/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot -Dpoppler_EXPORTS
-I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0 -I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/fofi -I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/goo -I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/poppler
-isystem /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/freetype2 -isystem /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/nss -isystem /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/nspr -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wcast-align
-Wformat-security -Wframe-larger-than=65536 -Wlogical-op
-Wmissing-format-attribute -Wnon-virtual-dtor -Woverloaded-virtual
-Wmissing-declarations -Wundef -Wzero-as-null-pointer-constant -Wshadow
-Wsuggest-override -fno-exceptions -fno-check-new -fno-common
-D_DEFAULT_SOURCE -O2 -DNDEBUG -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 *-O3 -fPIC* -pthread -std=c++14 -MD -MT
CMakeFiles/poppler.dir/goo/gbase64.cc.o -MF
CMakeFiles/poppler.dir/goo/gbase64.cc.o.d -o
CMakeFiles/poppler.dir/goo/gbase64.cc.o -c /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/goo/gbase64.cc

Notice that the first command has an extra include statement

Quoted 108 lines · Peter Seiderer

Hello Gleb,

Quoted 3 lines · Gleb Mazovetskiy

The poppler package failed to build for me with errors such as this one:

    host/aarch64-buildroot-linux-gnu/include/c++/10.3.0/cstdlib:75:15:

fatal error: stdlib.h: No such file or directory

Quoted 4 lines
       75 | #include_next <stdlib.h>
          |               ^~~~~~~~~~

Changing the CMake option to a link-specific one fixes the issue.

Out of interest (as this is a compile not link failure), what is the actual change in the compile parameter set?

Can you provide a (failing) defconfig?

Regards,
Peter

Review

Quoted 40 lines

---
Changes v1 -> v2
- Also fix kodi

---
 package/cutelyst/cutelyst.mk                           | 2 +-
 package/gerbera/gerbera.mk                             | 2 +-
 package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk | 2 +-
 package/kodi/kodi.mk                                   | 2 +-
 package/poppler/poppler.mk                             | 2 +-
 package/wampcc/wampcc.mk                               | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
package/cutelyst/cutelyst.mk +1 -1
index 9520922454..5313b003ad 100644
@@ -18,7 +18,7 @@ CUTELYST_CONF_OPTS += \
 
 # Qt 5.8 needs atomics, which on various architectures are in -latomic
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-CUTELYST_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+CUTELYST_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_LIBPWQUALITY),y)
package/gerbera/gerbera.mk +1 -1
index ccb3b2eeb5..f75595a46d 100644
@@ -20,7 +20,7 @@ GERBERA_CONF_OPTS = -DWITH_DEBUG=OFF
 
 # Uses __atomic_fetch_add_4
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-GERBERA_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+GERBERA_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_DUKTAPE),y)
(quoted diff) +0 -0

b/package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk

package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk KF5_MODEMMANAGER_QT_INSTALL_STAGING = YES · line 18

Quoted 8 lines

index 2a782b35e1..81617492c0 100644

package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk +0 -1
@@ -15,7 +15,7 @@ KF5_MODEMMANAGER_QT_INSTALL_STAGING = YES
 
 # Uses __atomic_fetch_add_4
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-KF5_MODEMMANAGER_QT_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS)

-latomic"

Quoted 36 lines
package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk +1 -0
+KF5_MODEMMANAGER_QT_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 $(eval $(cmake-package))
package/kodi/kodi.mk +1 -1
index 6edb0b7fca..28fe4a6a92 100644
@@ -184,7 +184,7 @@ endif
 
 # mips: uses __atomic_load_8
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-KODI_CXX_FLAGS += -latomic
+KODI_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_5),)
package/poppler/poppler.mk +1 -1
index 44ad04bf7c..a5a97d974b 100644
@@ -21,7 +21,7 @@ POPPLER_CONF_OPTS = \
      -DENABLE_GTK_DOC=OFF
 
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-POPPLER_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+POPPLER_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_BOOST),y)
package/wampcc/wampcc.mk +0 -0
index 5e7ee03651..11bb1f90b5 100644
@@ -13,7 +13,7 @@ WAMPCC_LICENSE_FILES = LICENSE
 
Quoted 9 lines

package/wampcc/wampcc.mk WAMPCC_LICENSE_FILES = LICENSE · line 19

Quoted 7 lines
package/wampcc/wampcc.mk +1 -1
 # Uses __atomic_fetch_add_8
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-WAMPCC_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+WAMPCC_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 $(eval $(cmake-package))

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210415/2397cab2/attachment.html>

#4 lore raw

PATCH v2 1/1 Fix -latomic for CMake packages

Hello Gleb,

Quoted 4 lines · Gleb Mazovetskiy

Hi Peter,

The failing defconfig is here (it's specific to this buildroot):
https://github.com/batocera-linux/batocera.linux/blob/8d8038a6ddaae03f0150fd28a2d23c371156ebf2/configs/batocera-odroidgoa_defconfig

Thanks for providing the defconfig, as far as I can see nothing special (and no poppler enabled?), normal buildroot-glibc-gcc-10.x toolchain..., and I am not able to reproduce your problem (did only test without ccache)...

Quoted 59 lines

Here is the compiler command without this change:

/usr/bin/ccache /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/bin/aarch64-buildroot-linux-gnu-g++ --sysroot=/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot

(quoted diff) +0 -5
-Dpoppler_EXPORTS
-I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0
-I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/fofi
-I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/goo
-I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/poppler

*-isystem /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot/usr/include* -isystem /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/freetype2 -isystem /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/nss -isystem /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/nspr

(quoted diff) +0 -7
-Wall -Wextra -Wpedantic -Wno-unused-parameter -Wcast-align
-Wformat-security -Wframe-larger-than=65536 -Wlogical-op
-Wmissing-format-attribute -Wnon-virtual-dtor -Woverloaded-virtual
-Wmissing-declarations -Wundef -Wzero-as-null-pointer-constant -Wshadow
-Wsuggest-override -fno-exceptions -fno-check-new -fno-common
-D_DEFAULT_SOURCE -O2 -DNDEBUG -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 * -O3   -latomic -fPIC *-pthread -std=c++14 -MD -MT

CMakeFiles/poppler.dir/goo/gbase64.cc.o -MF CMakeFiles/poppler.dir/goo/gbase64.cc.o.d -o CMakeFiles/poppler.dir/goo/gbase64.cc.o -c /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/goo/gbase64.cc

With this change:

/usr/bin/ccache /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/bin/aarch64-buildroot-linux-gnu-g++ --sysroot=/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot

(quoted diff) +0 -6
-Dpoppler_EXPORTS
-I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0
-I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/fofi
-I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/goo
-I/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/poppler
-isystem

/home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/freetype2 -isystem /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/nss -isystem /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/nspr

(quoted diff) +0 -7
-Wall -Wextra -Wpedantic -Wno-unused-parameter -Wcast-align
-Wformat-security -Wframe-larger-than=65536 -Wlogical-op
-Wmissing-format-attribute -Wnon-virtual-dtor -Woverloaded-virtual
-Wmissing-declarations -Wundef -Wzero-as-null-pointer-constant -Wshadow
-Wsuggest-override -fno-exceptions -fno-check-new -fno-common
-D_DEFAULT_SOURCE -O2 -DNDEBUG -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 *-O3 -fPIC* -pthread -std=c++14 -MD -MT

CMakeFiles/poppler.dir/goo/gbase64.cc.o -MF CMakeFiles/poppler.dir/goo/gbase64.cc.o.d -o CMakeFiles/poppler.dir/goo/gbase64.cc.o -c /home/gleb/repos/glebm/batocera.linux/output/batocera-odroidgoa/build/poppler-0.84.0/goo/gbase64.cc

Quoted 1 line

Notice that the first command has an extra include statement

Here no unexpected difference in compile flags, only the expected -latomic difference (and both times only one -isystem for freetype2)....

Still +1 for the patch (as the CMAKE_EXE_LINKER_FLAGS usage is smarter than the '$(TARGET_CXXFLAGS) -latomic' dance...., but can not follow your reasoning/commit log...

Regards,
Peter

Quoted 120 lines · Peter Seiderer
Quoted 118 lines

Hello Gleb,

Quoted 3 lines · Gleb Mazovetskiy

The poppler package failed to build for me with errors such as this one:

    host/aarch64-buildroot-linux-gnu/include/c++/10.3.0/cstdlib:75:15:

fatal error: stdlib.h: No such file or directory

Quoted 4 lines
       75 | #include_next <stdlib.h>
          |               ^~~~~~~~~~

Changing the CMake option to a link-specific one fixes the issue.

Out of interest (as this is a compile not link failure), what is the actual change in the compile parameter set?

Can you provide a (failing) defconfig?

Regards,
Peter

Review

Quoted 40 lines

---
Changes v1 -> v2
- Also fix kodi

---
 package/cutelyst/cutelyst.mk                           | 2 +-
 package/gerbera/gerbera.mk                             | 2 +-
 package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk | 2 +-
 package/kodi/kodi.mk                                   | 2 +-
 package/poppler/poppler.mk                             | 2 +-
 package/wampcc/wampcc.mk                               | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
package/cutelyst/cutelyst.mk +1 -1
index 9520922454..5313b003ad 100644
@@ -18,7 +18,7 @@ CUTELYST_CONF_OPTS += \
 
 # Qt 5.8 needs atomics, which on various architectures are in -latomic
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-CUTELYST_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+CUTELYST_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_LIBPWQUALITY),y)
package/gerbera/gerbera.mk +1 -1
index ccb3b2eeb5..f75595a46d 100644
@@ -20,7 +20,7 @@ GERBERA_CONF_OPTS = -DWITH_DEBUG=OFF
 
 # Uses __atomic_fetch_add_4
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-GERBERA_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+GERBERA_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_DUKTAPE),y)
(quoted diff) +0 -0

b/package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk

package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk KF5_MODEMMANAGER_QT_INSTALL_STAGING = YES · line 18

Quoted 8 lines

index 2a782b35e1..81617492c0 100644

package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk +0 -1
@@ -15,7 +15,7 @@ KF5_MODEMMANAGER_QT_INSTALL_STAGING = YES
 
 # Uses __atomic_fetch_add_4
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-KF5_MODEMMANAGER_QT_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS)

-latomic"

Quoted 43 lines
package/kf5/kf5-modemmanager-qt/kf5-modemmanager-qt.mk +1 -0
+KF5_MODEMMANAGER_QT_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 $(eval $(cmake-package))
package/kodi/kodi.mk +1 -1
index 6edb0b7fca..28fe4a6a92 100644
@@ -184,7 +184,7 @@ endif
 
 # mips: uses __atomic_load_8
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-KODI_CXX_FLAGS += -latomic
+KODI_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_5),)
package/poppler/poppler.mk +1 -1
index 44ad04bf7c..a5a97d974b 100644
@@ -21,7 +21,7 @@ POPPLER_CONF_OPTS = \
      -DENABLE_GTK_DOC=OFF
 
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-POPPLER_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+POPPLER_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_BOOST),y)
package/wampcc/wampcc.mk +1 -1
index 5e7ee03651..11bb1f90b5 100644
@@ -13,7 +13,7 @@ WAMPCC_LICENSE_FILES = LICENSE
 
 # Uses __atomic_fetch_add_8
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-WAMPCC_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+WAMPCC_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 $(eval $(cmake-package))
#5 lore raw

PATCH v2 1/1 Fix -latomic for CMake packages

Quoted 4 lines · Peter Seiderer

Hello Gleb,

On Thu, 15 Apr 2021 04:49:29 +0100, Gleb Mazovetskiy <[email protected]> wrote:

Quoted 8 lines
Quoted 4 lines

Hi Peter,

The failing defconfig is here (it's specific to this buildroot):
https://github.com/batocera-linux/batocera.linux/blob/8d8038a6ddaae03f0150fd28a2d23c371156ebf2/configs/batocera-odroidgoa_defconfig

Thanks for providing the defconfig, as far as I can see nothing special (and no poppler enabled?), normal buildroot-glibc-gcc-10.x toolchain..., and I am not able to reproduce your problem (did only test without ccache)...

CMake is known to do weird things with -isystem, and this can change over cmake
versions, and we use the host cmake if sufficiently recent. So that could make a difference.

Regards,
Arnout

[snip]

#6 lore raw

PATCH v2 1/1 Fix -latomic for CMake packages

My host cmake is 3.20.0 from Ubuntu 20.10
It must be some environment / host cmake difference but I can't pinpoint it either, thus my vague commit message

If I run this in a Docker container with an older Ubuntu I can't reproduce it either

Quoted 26 lines · Arnout Vandecappelle
Quoted 3 lines · Peter Seiderer

Hello Gleb,

On Thu, 15 Apr 2021 04:49:29 +0100, Gleb Mazovetskiy <[email protected]>

Quoted 5 lines · wrote:
Quoted 5 lines

Hi Peter,

The failing defconfig is here (it's specific to this buildroot):

https://github.com/batocera-linux/batocera.linux/blob/8d8038a6ddaae03f0150fd28a2d23c371156ebf2/configs/batocera-odroidgoa_defconfig

Quoted 2 lines

Thanks for providing the defconfig, as far as I can see nothing special

(and no

Quoted 1 line

poppler enabled?), normal buildroot-glibc-gcc-10.x toolchain..., and I

am not

Quoted 1 line

able to reproduce your problem (did only test without ccache)...

CMake is known to do weird things with -isystem, and this can change over
cmake
versions, and we use the host cmake if sufficiently recent. So that could make a
difference.

Quoted 6 lines

Regards,
Arnout

[snip]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210415/b426bc77/attachment.html>

#7 lore raw

PATCH v2 1/1 Fix -latomic for CMake packages

Quoted 1 line

Thanks for providing the defconfig, as far as I can see nothing special

(and no poppler enabled?),

Poppler is a transitive dependency of another package (
https://github.com/batocera-linux/batocera.linux/blob/95f96803e04027b7996c73ae05b40a891dad0ca9/package/batocera/emulationstation/batocera-emulationstation/Config.in
)

Quoted 4 lines · Gleb Mazovetskiy

My host cmake is 3.20.0 from Ubuntu 20.10
It must be some environment / host cmake difference but I can't pinpoint it either, thus my vague commit message

Quoted 38 lines

If I run this in a Docker container with an older Ubuntu I can't reproduce it either

Quoted 32 lines · Arnout Vandecappelle
Quoted 3 lines · Peter Seiderer

Hello Gleb,

On Thu, 15 Apr 2021 04:49:29 +0100, Gleb Mazovetskiy <

Quoted 5 lines · glex.spb at gmail.com> wrote:
Quoted 5 lines

Hi Peter,

The failing defconfig is here (it's specific to this buildroot):

https://github.com/batocera-linux/batocera.linux/blob/8d8038a6ddaae03f0150fd28a2d23c371156ebf2/configs/batocera-odroidgoa_defconfig

Quoted 2 lines

Thanks for providing the defconfig, as far as I can see nothing special

(and no

Quoted 1 line

poppler enabled?), normal buildroot-glibc-gcc-10.x toolchain..., and I

am not

Quoted 1 line

able to reproduce your problem (did only test without ccache)...

CMake is known to do weird things with -isystem, and this can change
over cmake
versions, and we use the host cmake if sufficiently recent. So that could make a
difference.

Regards,
Arnout

[snip]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210415/8ccb86e7/attachment.html>

#8 lore raw

PATCH v2 1/1 Fix -latomic for CMake packages

Can the maintainers please merge this?

It's still a better way to do this, quoting Peter Seiderer:

Quoted 1 line

Still +1 for the patch (as the CMAKE_EXE_LINKER_FLAGS usage is smarter

than the '$(TARGET_CXXFLAGS) -latomic' dance....

Quoted 52 lines · Gleb Mazovetskiy
Quoted 1 line

Thanks for providing the defconfig, as far as I can see nothing special

(and no poppler enabled?),

Poppler is a transitive dependency of another package (
https://github.com/batocera-linux/batocera.linux/blob/95f96803e04027b7996c73ae05b40a891dad0ca9/package/batocera/emulationstation/batocera-emulationstation/Config.in
)

Quoted 42 lines · Gleb Mazovetskiy

My host cmake is 3.20.0 from Ubuntu 20.10
It must be some environment / host cmake difference but I can't pinpoint it either, thus my vague commit message

If I run this in a Docker container with an older Ubuntu I can't reproduce it either

Quoted 32 lines · Arnout Vandecappelle
Quoted 3 lines · Peter Seiderer

Hello Gleb,

On Thu, 15 Apr 2021 04:49:29 +0100, Gleb Mazovetskiy <

Quoted 5 lines · glex.spb at gmail.com> wrote:
Quoted 5 lines

Hi Peter,

The failing defconfig is here (it's specific to this buildroot):

https://github.com/batocera-linux/batocera.linux/blob/8d8038a6ddaae03f0150fd28a2d23c371156ebf2/configs/batocera-odroidgoa_defconfig

Quoted 2 lines

Thanks for providing the defconfig, as far as I can see nothing

special (and no

Quoted 1 line

poppler enabled?), normal buildroot-glibc-gcc-10.x toolchain..., and I

am not

Quoted 1 line

able to reproduce your problem (did only test without ccache)...

CMake is known to do weird things with -isystem, and this can change
over cmake
versions, and we use the host cmake if sufficiently recent. So that could make a
difference.

Regards,
Arnout

[snip]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210416/330f607f/attachment.html>

#9 lore raw

PATCH v2 1/1 Fix -latomic for CMake packages

In reply to Gleb Mazovetskiy
Quoted 7 lines · Gleb Mazovetskiy

The poppler package failed to build for me with errors such as this one:

    host/aarch64-buildroot-linux-gnu/include/c++/10.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
       75 | #include_next <stdlib.h>
          |               ^~~~~~~~~~

Changing the CMake option to a link-specific one fixes the issue.

Applied to master, thanks.

Your SoB was missing here, but it was on v1 so I re-added it.

Normally we expect to have one patch per package. This makes it easier to:
- port to the stable branch (only the packages that apply to the stable branch);
- partially revert.

In this case, I couldn't be bothered to change it though. Just for the future,
know that that's the preferred way. It also helps increase your ranking in the contribution statistics :-)

There are a few other packages that do something similar: bctoolbox with
-liconv, kf5-kcoreaddons with -latomic, libcpprestsdk with -latomic, mariadb with -latomic, ogre with -latomic, opencv3 with -latomic. Could you change (and test) those ones as well?

[snip]

package/kodi/kodi.mk endif · line 187

Quoted 9 lines
package/kodi/kodi.mk +0 -1
index 6edb0b7fca..28fe4a6a92 100644
@@ -184,7 +184,7 @@ endif
 
 # mips: uses __atomic_load_8
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-KODI_CXX_FLAGS += -latomic

KODI_CXX_FLAGS is no longer set after this change, so I removed its use as well.

Regards,
Arnout

Quoted 31 lines
package/kodi/kodi.mk +1 -0
+KODI_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_5),)
package/poppler/poppler.mk +1 -1
index 44ad04bf7c..a5a97d974b 100644
@@ -21,7 +21,7 @@ POPPLER_CONF_OPTS = \
 	-DENABLE_GTK_DOC=OFF
 
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-POPPLER_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+POPPLER_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 ifeq ($(BR2_PACKAGE_BOOST),y)
package/wampcc/wampcc.mk +1 -1
index 5e7ee03651..11bb1f90b5 100644
@@ -13,7 +13,7 @@ WAMPCC_LICENSE_FILES = LICENSE
 
 # Uses __atomic_fetch_add_8
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-WAMPCC_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+WAMPCC_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
 $(eval $(cmake-package))
#10 lore raw

PATCH v2 1/1 Fix -latomic for CMake packages

Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Quoted 7 lines · Gleb Mazovetskiy

The poppler package failed to build for me with errors such as this one:

host/aarch64-buildroot-linux-gnu/include/c++/10.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory 75 | #include_next <stdlib.h>
| ^~~~~~~~~~

Changing the CMake option to a link-specific one fixes the issue.

Applied to master, thanks.

Your SoB was missing here, but it was on v1 so I re-added it.

Normally we expect to have one patch per package. This makes it easier to:
- port to the stable branch (only the packages that apply to the stable branch);
- partially revert.

Quoted 8 lines

In this case, I couldn't be bothered to change it though. Just for the future,
know that that's the preferred way. It also helps increase your ranking in the contribution statistics :-)

There are a few other packages that do something similar: bctoolbox with
-liconv, kf5-kcoreaddons with -latomic, libcpprestsdk with -latomic, mariadb with -latomic, ogre with -latomic, opencv3 with -latomic. Could you change (and test) those ones as well?

Committed to 2021.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard