Skip to contentSkip to conversation

package/quickjs: needs host gcc >= 4.9 (C11/stdatomic.h)

PATCH New Peter Seiderer 2 participants 5 messages Jan 3, 2021 – Jan 9, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/quickjs: needs host gcc >= 4.9 (C11/stdatomic.h)

Fixes:

- http://autobuild.buildroot.net/results/c7882cc2d66984350f54d619f39cfee5065d941a

gcc -g -Wall -MMD -MF .obj/libregexp.host.o.d -Wno-array-bounds -Wno-format-truncation -D_GNU_SOURCE -DCONFIG_VERSION=\"2020-11-08\" -DCONFIG_BIGNUM -O2 -flto -c -o .obj/libregexp.host.o libregexp.c quickjs.c:112:23: fatal error: stdatomic.h: No such file or directory

   #include <stdatomic.h>
                         ^

compilation terminated.

---
 package/quickjs/Config.in | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
package/quickjs/Config.in +4 -2
index 886cbd4db6..5c3b068c3a 100644
@@ -4,6 +4,7 @@ config BR2_PACKAGE_QUICKJS
 	# No way to check for fenv support.
 	depends on !BR2_TOOLCHAIN_USES_UCLIBC
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C11/stdatomic.h
+	depends on BR2_HOST_GCC_AT_LEAST_4_9 # C11/stdatomic.h
 	depends on BR2_USE_MMU # fork()
 	help
 	  QuickJS is a small and embeddable Javascript engine.
@@ -12,6 +13,7 @@ config BR2_PACKAGE_QUICKJS
 
 	  https://bellard.org/quickjs/
 
-comment "quickjs needs a glibc or musl toolchain w/ gcc >= 4.9, dynamic library"
+comment "quickjs needs a glibc or musl toolchain w/ gcc >= 4.9, host gcc >= 4.9, dynamic library"
 	depends on BR2_USE_MMU
-	depends on BR2_STATIC_LIBS || BR2_TOOLCHAIN_USES_UCLIBC || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
+	depends on BR2_STATIC_LIBS || BR2_TOOLCHAIN_USES_UCLIBC || \
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || !BR2_HOST_GCC_AT_LEAST_4_9
Signature · 1 line
2.29.2
#1 lore raw

PATCH 2/2 package/quickjs: link with libatomic

Link with libatomic if available.

Fixes:

- http://autobuild.buildroot.net/results/e0766eef95a2559d51e58d1a81a9c40df84ae509

.../build/quickjs-2020-11-08/quickjs.c:12229: undefined reference to `__atomic_fetch_xor_1'

---
 ...ile-add-optional-link-with-libatomic.patch | 30 +++++++++++++++++++
 package/quickjs/quickjs.mk                    |  6 +++-
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 package/quickjs/0001-Makefile-add-optional-link-with-libatomic.patch
package/quickjs/0001-Makefile-add-optional-link-with-libatomic.patch new file +30 -0
new file mode 100644
index 0000000000..12f4eb2338
@@ -0,0 +1,30 @@
+From 2cf2aa34d5d55a4eedb1aedd4d56d89d24870230 Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <[email protected]>
+Date: Sun, 3 Jan 2021 21:11:44 +0100
+Subject: [PATCH] Makefile: add optional link with libatomic
+
+Add optional libatomic linking if available to fix:
+
+  .../build/quickjs-2020-11-08/quickjs.c:12229: undefined reference to `__atomic_fetch_xor_1'
+
+Signed-off-by: Peter Seiderer <[email protected]>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index e6ae827..22ad496 100644
+--- a/Makefile
++++ b/Makefile
+@@ -177,7 +177,7 @@ endif
+ HOST_LIBS=-lm -ldl -lpthread
+ LIBS=-lm
+ ifndef CONFIG_WIN32
+-LIBS+=-ldl -lpthread
++LIBS+=-ldl -lpthread $(LIBATOMIC)
+ endif
+ 
+ $(OBJDIR):
+-- 
+2.29.2
+
package/quickjs/quickjs.mk +5 -1
index 1a2e63278f..389ed71133 100644
@@ -10,8 +10,12 @@ QUICKJS_SITE = https://bellard.org/quickjs
 QUICKJS_LICENSE = MIT
 QUICKJS_INSTALL_STAGING = YES
 
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+QUICKJS_LIBATOMIC += -latomic
+endif
+
 define QUICKJS_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+	$(TARGET_MAKE_ENV) LIBATOMIC=$(QUICKJS_LIBATOMIC) $(MAKE) -C $(@D) \
 		CROSS_PREFIX="$(TARGET_CROSS)" \
 		all
 endef
Signature · 1 line
2.29.2
#2 lore raw

PATCH 2/2 package/quickjs: link with libatomic

Peter, All,

On 2021-01-03 21:19 +0100, Peter Seiderer spake thusly:

Quoted 9 lines

Link with libatomic if available.

Fixes:

- http://autobuild.buildroot.net/results/e0766eef95a2559d51e58d1a81a9c40df84ae509

.../build/quickjs-2020-11-08/quickjs.c:12229: undefined reference to `__atomic_fetch_xor_1'

Applied to master, thanks.

But see below for a small nit...

Quoted 27 lines
---
 ...ile-add-optional-link-with-libatomic.patch | 30 +++++++++++++++++++
 package/quickjs/quickjs.mk                    |  6 +++-
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 package/quickjs/0001-Makefile-add-optional-link-with-libatomic.patch
package/quickjs/0001-Makefile-add-optional-link-with-libatomic.patch new file +15 -0
new file mode 100644
index 0000000000..12f4eb2338
@@ -0,0 +1,30 @@
+From 2cf2aa34d5d55a4eedb1aedd4d56d89d24870230 Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <[email protected]>
+Date: Sun, 3 Jan 2021 21:11:44 +0100
+Subject: [PATCH] Makefile: add optional link with libatomic
+
+Add optional libatomic linking if available to fix:
+
+  .../build/quickjs-2020-11-08/quickjs.c:12229: undefined reference to `__atomic_fetch_xor_1'
+
+Signed-off-by: Peter Seiderer <[email protected]>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile

package/quickjs/0001-Makefile-add-optional-link-with-libatomic.patch line 25

Quoted 10 lines
package/quickjs/0001-Makefile-add-optional-link-with-libatomic.patch new file +10 -0
+index e6ae827..22ad496 100644
+--- a/Makefile
++++ b/Makefile
+@@ -177,7 +177,7 @@ endif
+ HOST_LIBS=-lm -ldl -lpthread
+ LIBS=-lm
+ ifndef CONFIG_WIN32
+-LIBS+=-ldl -lpthread
++LIBS+=-ldl -lpthread $(LIBATOMIC)
+ endif

I've changed that to be a generic variable, not tied to -latomic:

    LIBS+=$(EXTRA_LIBS)

Do not forget to send the patch upstream. ;-)

Regards,
Yann E. MORIN.

Quoted 29 lines
package/quickjs/0001-Makefile-add-optional-link-with-libatomic.patch new file +4 -0
+ $(OBJDIR):
+-- 
+2.29.2
+
package/quickjs/quickjs.mk +5 -1
index 1a2e63278f..389ed71133 100644
@@ -10,8 +10,12 @@ QUICKJS_SITE = https://bellard.org/quickjs
 QUICKJS_LICENSE = MIT
 QUICKJS_INSTALL_STAGING = YES
 
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+QUICKJS_LIBATOMIC += -latomic
+endif
+
 define QUICKJS_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+	$(TARGET_MAKE_ENV) LIBATOMIC=$(QUICKJS_LIBATOMIC) $(MAKE) -C $(@D) \
 		CROSS_PREFIX="$(TARGET_CROSS)" \
 		all
 endef
Signature · 6 lines
2.29.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.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 2/2 package/quickjs: link with libatomic

Hello Yann,

Quoted 57 lines · Yann E. MORIN

Peter, All,

On 2021-01-03 21:19 +0100, Peter Seiderer spake thusly:

Quoted 9 lines

Link with libatomic if available.

Fixes:

- http://autobuild.buildroot.net/results/e0766eef95a2559d51e58d1a81a9c40df84ae509

.../build/quickjs-2020-11-08/quickjs.c:12229: undefined reference to `__atomic_fetch_xor_1'

Applied to master, thanks.

But see below for a small nit...

Quoted 27 lines
---
 ...ile-add-optional-link-with-libatomic.patch | 30 +++++++++++++++++++
 package/quickjs/quickjs.mk                    |  6 +++-
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 package/quickjs/0001-Makefile-add-optional-link-with-libatomic.patch
package/quickjs/0001-Makefile-add-optional-link-with-libatomic.patch new file +15 -0
new file mode 100644
index 0000000000..12f4eb2338
@@ -0,0 +1,30 @@
+From 2cf2aa34d5d55a4eedb1aedd4d56d89d24870230 Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <[email protected]>
+Date: Sun, 3 Jan 2021 21:11:44 +0100
+Subject: [PATCH] Makefile: add optional link with libatomic
+
+Add optional libatomic linking if available to fix:
+
+  .../build/quickjs-2020-11-08/quickjs.c:12229: undefined reference to `__atomic_fetch_xor_1'
+
+Signed-off-by: Peter Seiderer <[email protected]>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile

package/quickjs/0001-Makefile-add-optional-link-with-libatomic.patch line 25

Quoted 10 lines
package/quickjs/0001-Makefile-add-optional-link-with-libatomic.patch new file +10 -0
+index e6ae827..22ad496 100644
+--- a/Makefile
++++ b/Makefile
+@@ -177,7 +177,7 @@ endif
+ HOST_LIBS=-lm -ldl -lpthread
+ LIBS=-lm
+ ifndef CONFIG_WIN32
+-LIBS+=-ldl -lpthread
++LIBS+=-ldl -lpthread $(LIBATOMIC)
+ endif

I've changed that to be a generic variable, not tied to -latomic:

Quoted 1 line
    LIBS+=$(EXTRA_LIBS)

Thanks for improvement, definitely better...

Quoted 2 lines

Do not forget to send the patch upstream. ;-)

Finally done, see [1]...

Regards,
Peter

[1] https://www.freelists.org/post/quickjs-devel/PATCH-Makefile-allow-linking-with-extra-libraries

Quoted 34 lines

Regards,
Yann E. MORIN.

Quoted 29 lines
package/quickjs/0001-Makefile-add-optional-link-with-libatomic.patch new file +4 -0
+ $(OBJDIR):
+--
+2.29.2
+
package/quickjs/quickjs.mk +5 -2
index 1a2e63278f..389ed71133 100644
@@ -10,8 +10,12 @@ QUICKJS_SITE = https://bellard.org/quickjs
 QUICKJS_LICENSE = MIT
 QUICKJS_INSTALL_STAGING = YES
 
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+QUICKJS_LIBATOMIC += -latomic
+endif
+
 define QUICKJS_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+	$(TARGET_MAKE_ENV) LIBATOMIC=$(QUICKJS_LIBATOMIC) $(MAKE) -C $(@D) \
 		CROSS_PREFIX="$(TARGET_CROSS)" \
 		all
 endef
--

2.29.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#4 lore raw

PATCH 1/2 package/quickjs: needs host gcc >= 4.9 (C11/stdatomic.h)

In reply to Peter Seiderer

Peter, All,

On 2021-01-03 21:19 +0100, Peter Seiderer spake thusly:

Quoted 11 lines

Fixes:

- http://autobuild.buildroot.net/results/c7882cc2d66984350f54d619f39cfee5065d941a

gcc -g -Wall -MMD -MF .obj/libregexp.host.o.d -Wno-array-bounds -Wno-format-truncation -D_GNU_SOURCE -DCONFIG_VERSION=\"2020-11-08\" -DCONFIG_BIGNUM -O2 -flto -c -o .obj/libregexp.host.o libregexp.c quickjs.c:112:23: fatal error: stdatomic.h: No such file or directory

   #include <stdatomic.h>
                         ^

compilation terminated.

Applied to master, thanks.

Regards,
Yann E. MORIN.

Quoted 33 lines
---
 package/quickjs/Config.in | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
package/quickjs/Config.in +4 -2
index 886cbd4db6..5c3b068c3a 100644
@@ -4,6 +4,7 @@ config BR2_PACKAGE_QUICKJS
 	# No way to check for fenv support.
 	depends on !BR2_TOOLCHAIN_USES_UCLIBC
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C11/stdatomic.h
+	depends on BR2_HOST_GCC_AT_LEAST_4_9 # C11/stdatomic.h
 	depends on BR2_USE_MMU # fork()
 	help
 	  QuickJS is a small and embeddable Javascript engine.
@@ -12,6 +13,7 @@ config BR2_PACKAGE_QUICKJS
 
 	  https://bellard.org/quickjs/
 
-comment "quickjs needs a glibc or musl toolchain w/ gcc >= 4.9, dynamic library"
+comment "quickjs needs a glibc or musl toolchain w/ gcc >= 4.9, host gcc >= 4.9, dynamic library"
 	depends on BR2_USE_MMU
-	depends on BR2_STATIC_LIBS || BR2_TOOLCHAIN_USES_UCLIBC || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
+	depends on BR2_STATIC_LIBS || BR2_TOOLCHAIN_USES_UCLIBC || \
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || !BR2_HOST_GCC_AT_LEAST_4_9
Signature · 6 lines
2.29.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.  |
'------------------------------^-------^------------------^--------------------'