Skip to contentSkip to conversation

shadowsocks-libev: add dependency on BR2_TOOLCHAIN_HAS_SYNC_4

PATCH New Min Xu 2 participants 4 messages Jun 7, 2018 – Jun 18, 2018 1 message not in the archive

lore
Share & tools
lore

Min Xu

author
#0 lore raw

PATCH 1/1 shadowsocks-libev: add dependency on BR2_TOOLCHAIN_HAS_SYNC_4

To fixup linking errors:
"undefined reference to `__sync_val_compare_and_swap_4'" Fixes
http://autobuild.buildroot.net/results/d00c5f9e1e7a6a40fac5763a06977b351b7875da
http://autobuild.buildroot.net/results/0612f2dc09a8763fdf2111ee8d0c223c8531262a

reference: https://git.buildroot.org/buildroot/commit/?id=7c77d965bdcd301c2644004140faec613c1ee202

---
 package/shadowsocks-libev/Config.in | 2 ++
 1 file changed, 2 insertions(+)
package/shadowsocks-libev/Config.in +2 -0
index d02e5a93ef..c914ed778b 100644
@@ -1,5 +1,7 @@
 config BR2_PACKAGE_SHADOWSOCKS_LIBEV
 	bool "shadowsocks-libev"
+	# uses __sync_val_compare_and_swap_4
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on BR2_USE_MMU # fork()
 	select BR2_PACKAGE_C_ARES
 	select BR2_PACKAGE_LIBEV
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 shadowsocks-libev: add dependency on BR2_TOOLCHAIN_HAS_SYNC_4

Hi Min,

Thank you for your speedy reaction!

Quoted 7 lines · Min Xu

To fixup linking errors:
"undefined reference to `__sync_val_compare_and_swap_4'" Fixes
http://autobuild.buildroot.net/results/d00c5f9e1e7a6a40fac5763a06977b351b7875da
http://autobuild.buildroot.net/results/0612f2dc09a8763fdf2111ee8d0c223c8531262a

reference: https://git.buildroot.org/buildroot/commit/?id=7c77d965bdcd301c2644004140faec613c1ee202

No need for this - it's actually confusing, I thought you meant that the
dependency was indirect due to libuv (as is the case in that commit).

package/shadowsocks-libev/Config.in line 3

Quoted 13 lines
---
 package/shadowsocks-libev/Config.in | 2 ++
 1 file changed, 2 insertions(+)
package/shadowsocks-libev/Config.in +1 -0
index d02e5a93ef..c914ed778b 100644
@@ -1,5 +1,7 @@
 config BR2_PACKAGE_SHADOWSOCKS_LIBEV
 	bool "shadowsocks-libev"
+	# uses __sync_val_compare_and_swap_4

It actually uses the __sync_val_compare_and_swap macro, so the actual function
that is called depends on sizeof(int) and sizeof(void*)...

package/shadowsocks-libev/Config.in line 4

Quoted 1 line
package/shadowsocks-libev/Config.in +1 -0
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4

... so I think we also need

depends on BR2_TOOLCHAIN_HAS_SYNC_8 if BR2_ARCH_IS_64

although in practice of course all 64-bit arches have sync_8.

BTW I checked, it really needs sync, it can't use atomics.

Oh, and I also noticed that it seems to unconditionally require pthreads.

Regards,
Arnout

Quoted 4 lines
package/shadowsocks-libev/Config.in +0 -0
 	depends on BR2_USE_MMU # fork()
 	select BR2_PACKAGE_C_ARES
 	select BR2_PACKAGE_LIBEV
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

A message that is not in the archive (sent off-list or not yet received): CAMpS7mRvt1Mpt0faz7kMetV92XwYTojD_aFx1iZ-UGSJ8gbq1A@mail.gmail.com

#3 lore raw

PATCH 1/1 shadowsocks-libev: add dependency on BR2_TOOLCHAIN_HAS_SYNC_4

[Please keep the mailing list in Cc when replying.] [Please don't top-post, but reply in-line like I do below.]

Quoted 12 lines · xu min

Hi Arnout?Vandecappelle,

Thank ?you for your help. Shadowsocks doesn't depends on libuv. But I found libuv had the same linking error. It fixed by add?dependents on BR2_TOOLCHAIN_HAS_SYNC_4. So I add the link as reference. I already delete it from my the latest patch.?

I found?openal: fix atomic handling:?https://git.busybox.net/buildroot/tree/package/openal/Config.in. I did the similar way to fix the problems in my latest patch. Plus add?depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL.

Quoted 6 lines

Please review my last patch. https://patchwork.ozlabs.org/patch/927318/
Thank you.
MinXu
PS:
What's the difference between BR2_TOOLCHAIN_HAS_THREADS_NPTL and BR2_TOOLCHAIN_HAS_THREADS?

uClibc has several threads implementations. NPTL is "native threads", i.e. a
thread is a lightweigth Linux process. But it's not available on all platforms. Some code depends on this, e.g. it relies on threads having different PIDs. But this is not often the case. So usually, you just need BR2_TOOLCHAIN_HAS_THREADS.

Quoted 2 lines

What's the difference between?sync and?atomics? How did you find out?it really needs sync, it can't use atomics?

_SYNC_* are the atomics builtins in GCC (i.e. the __sync_* functions). Packages
can use either these functions, or the atomics library that is included in GCC (but which needs -latomic), or libatomic_ops. So it depends on the package which of these it uses. In the case of libcork, it only uses the sync functions.

Oh BTW, it would also be good to mention in the commit message and in the
comment in Config.in that it is libcork that needs this.

Regards,
Arnout

Quoted 80 lines

On Fri, Jun 8, 2018 at 2:45 AM Arnout Vandecappelle <[email protected] <mailto:[email protected]>> wrote:

    ?Hi Min,

    ?Thank you for your speedy reaction!

    On 08-06-18 01:01, Min Xu wrote:
    > To fixup linking errors:
    > "undefined reference to `__sync_val_compare_and_swap_4'"
    > Fixes
    >
    http://autobuild.buildroot.net/results/d00c5f9e1e7a6a40fac5763a06977b351b7875da
    >
    http://autobuild.buildroot.net/results/0612f2dc09a8763fdf2111ee8d0c223c8531262a
    >
    > reference:
    https://git.buildroot.org/buildroot/commit/?id=7c77d965bdcd301c2644004140faec613c1ee202

    ?No need for this - it's actually confusing, I thought you meant that the
    dependency was indirect due to libuv (as is the case in that commit).

    > Signed-off-by: Min Xu <xuminready at gmail.com <mailto:[email protected]>>
    > ---
    >? package/shadowsocks-libev/Config.in | 2 ++
    >? 1 file changed, 2 insertions(+)
    >
    > diff --git a/package/shadowsocks-libev/Config.in
    b/package/shadowsocks-libev/Config.in
    > index d02e5a93ef..c914ed778b 100644
    > --- a/package/shadowsocks-libev/Config.in
    > +++ b/package/shadowsocks-libev/Config.in
    > @@ -1,5 +1,7 @@
    >? config BR2_PACKAGE_SHADOWSOCKS_LIBEV
    >? ? ? ?bool "shadowsocks-libev"
    > +? ? ?# uses __sync_val_compare_and_swap_4

    ?It actually uses the __sync_val_compare_and_swap macro, so the actual function
    that is called depends on sizeof(int) and sizeof(void*)...

    > +? ? ?depends on BR2_TOOLCHAIN_HAS_SYNC_4

    ?... so I think we also need

    ? ? ? ? depends on BR2_TOOLCHAIN_HAS_SYNC_8 if BR2_ARCH_IS_64

    although in practice of course all 64-bit arches have sync_8.

    ?BTW I checked, it really needs sync, it can't use atomics.

    ?Oh, and I also noticed that it seems to unconditionally require pthreads.

    ?Regards,
    ?Arnout

    >? ? ? ?depends on BR2_USE_MMU # fork()
    >? ? ? ?select BR2_PACKAGE_C_ARES
    >? ? ? ?select BR2_PACKAGE_LIBEV
    >

    -- 
    Arnout Vandecappelle? ? ? ? ? ? ? ? ? ? ? ? ? arnout at mind be
    Senior Embedded Software Architect? ? ? ? ? ? +32-16-286500
    Essensium/Mind? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? http://www.mind.be
    G.Geenslaan 9, 3001 Leuven, Belgium? ? ? ? ? ?BE 872 984 063 RPR Leuven
    LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
    GPG fingerprint:? 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Signature · 6 lines
*
*
*Best Regards*
*
*
*XuMin's Ready?*
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
author
#4 lore raw

PATCH 1/1 shadowsocks-libev: add dependency on BR2_TOOLCHAIN_HAS_SYNC_4

Hi Arnout,

Thank you for you help. Your comment is very useful for me. I'll keep learning.

MinXu

Quoted 153 lines · Arnout Vandecappelle

[Please keep the mailing list in Cc when replying.] [Please don't top-post, but reply in-line like I do below.]

Quoted 3 lines · xu min

Hi Arnout Vandecappelle,

Thank you for your help. Shadowsocks doesn't depends on libuv. But I

found

Quoted 2 lines

libuv had the same linking error. It fixed by add dependents on BR2_TOOLCHAIN_HAS_SYNC_4. So I add the link as reference. I already

delete it

Quoted 4 lines

from my the latest patch.

I found openal: fix atomic
handling:

https://git.busybox.net/buildroot/tree/package/openal/Config.in. I did

Quoted 1 line

the similar way to fix the problems in my latest patch. Plus add depends

on

Quoted 8 lines

BR2_TOOLCHAIN_HAS_THREADS_NPTL.

Please review my last patch. https://patchwork.ozlabs.org/patch/927318/
Thank you.
MinXu
PS:
What's the difference between BR2_TOOLCHAIN_HAS_THREADS_NPTL and BR2_TOOLCHAIN_HAS_THREADS?

uClibc has several threads implementations. NPTL is "native threads",
i.e. a
thread is a lightweigth Linux process. But it's not available on all platforms.
Some code depends on this, e.g. it relies on threads having different PIDs. But
this is not often the case. So usually, you just need BR2_TOOLCHAIN_HAS_THREADS.

Quoted 1 line

What's the difference between sync and atomics? How did you find out it

really

Quoted 1 line

needs sync, it can't use atomics?

_SYNC_* are the atomics builtins in GCC (i.e. the __sync_* functions).
Packages
can use either these functions, or the atomics library that is included in GCC
(but which needs -latomic), or libatomic_ops. So it depends on the package which
of these it uses. In the case of libcork, it only uses the sync functions.

Oh BTW, it would also be good to mention in the commit message and in the
comment in Config.in that it is libcork that needs this.

Regards,
Arnout

Quoted 8 lines

On Fri, Jun 8, 2018 at 2:45 AM Arnout Vandecappelle <[email protected] <mailto:[email protected]>> wrote:

Hi Min,

Quoted 8 lines

Thank you for your speedy reaction!

On 08-06-18 01:01, Min Xu wrote:
> To fixup linking errors:
> "undefined reference to `__sync_val_compare_and_swap_4'" > Fixes
>

http://autobuild.buildroot.net/results/d00c5f9e1e7a6a40fac5763a06977b351b7875da

Quoted 2 lines
Quoted 1 line

http://autobuild.buildroot.net/results/0612f2dc09a8763fdf2111ee8d0c223c8531262a

Quoted 3 lines
Quoted 2 lines

reference:

https://git.buildroot.org/buildroot/commit/?id=7c77d965bdcd301c2644004140faec613c1ee202

Quoted 2 lines

No need for this - it's actually confusing, I thought you meant

that the

Quoted 3 lines

dependency was indirect due to libuv (as is the case in that commit).

> Signed-off-by: Min Xu <[email protected] <mailto:

xuminready at gmail.com>>

Quoted 14 lines

Review

Quoted 5 lines
---
 package/shadowsocks-libev/Config.in | 2 ++
 1 file changed, 2 insertions(+)
(quoted diff) +0 -0

b/package/shadowsocks-libev/Config.in
> index d02e5a93ef..c914ed778b 100644
> --- a/package/shadowsocks-libev/Config.in
> +++ b/package/shadowsocks-libev/Config.in
> @@ -1,5 +1,7 @@
> config BR2_PACKAGE_SHADOWSOCKS_LIBEV
> bool "shadowsocks-libev"
> + # uses __sync_val_compare_and_swap_4

Quoted 1 line

It actually uses the __sync_val_compare_and_swap macro, so the

actual function

Quoted 6 lines

that is called depends on sizeof(int) and sizeof(void*)...

> + depends on BR2_TOOLCHAIN_HAS_SYNC_4

... so I think we also need

Quoted 7 lines

depends on BR2_TOOLCHAIN_HAS_SYNC_8 if BR2_ARCH_IS_64

although in practice of course all 64-bit arches have sync_8.

BTW I checked, it really needs sync, it can't use atomics.

Oh, and I also noticed that it seems to unconditionally require

pthreads.

Quoted 9 lines

Regards,
Arnout

> depends on BR2_USE_MMU # fork()
> select BR2_PACKAGE_C_ARES
> select BR2_PACKAGE_LIBEV
>

Quoted 5 lines

--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR

Leuven

Quoted 5 lines

LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

Quoted 7 lines

--
*
*
*Best Regards*
*
*
*XuMin's Ready?*

--

Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Signature · 6 lines
*Best Regards*

*XuMin's Ready?*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180618/622d5224/attachment.html>