Discussion:
[Gc] Compilation issue against musl
Brendan Heading
2015-07-28 23:31:56 UTC
Permalink
Hi guys,

There's a minor compilation issue when building bdwgc against musl. The
problem is observed on version 7.4.2. The compilation error is as follows :

=================

In file included from os_dep.c:44:0:
/home/peko/autobuild/instance-2/output/host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include/asm/sigcontext.h:9:8:
error: redefinition of 'struct sigcontext'
struct sigcontext {
^
In file included from
/home/peko/autobuild/instance-2/output/host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include/signal.h:243:0,
from ./include/private/../gc_pthread_redirects.h:42,
from ./include/private/../gc.h:1443,
from ./include/private/gc_priv.h:46,
from os_dep.c:17:
/home/peko/autobuild/instance-2/output/host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include/bits/signal.h:11:16:
note: originally defined here
typedef struct sigcontext

=================

The root cause is in the following excerpt from os_dep.c

=================

# if 2 <= __GLIBC__

# if 2 == __GLIBC__ && 0 == __GLIBC_MINOR__

/* glibc 2.1 no longer has sigcontext.h. But signal.h */

/* has the right declaration for glibc 2.1. */

# include <sigcontext.h>

# endif /* 0 == __GLIBC_MINOR__ */

# else /* __GLIBC__ < 2 */

/* libc5 doesn't have <sigcontext.h>: go directly with the kernel */

/* one. Check LINUX_VERSION_CODE to see which we should reference. */

# include <asm/sigcontext.h>

# endif /* __GLIBC__ < 2 */

=================

The logic here is intended to provide two special cases; one for
__GLIBC__ version 2.0, the other is a fall through case intended to be
reached if __GLIBC__ version is <2. However this fall through is also
reached if __GLIBC__ is undefined as is the case in musl. If the
__GLIBC__ version is 2.1 or greater no special action is taken.

musl, as a matter of policy, will never provide a macro to detect its
presence. Instead I propose that the above logic be wrapped in an
#ifdef __GLIBC__. I've tested that this allows the build to work on
musl, and should also work on uclibc and other C libraries.

I've attached a patch - I'm more than happy to update it if you feel
there is a better approach.

regards

Brendan
Brendan Heading
2015-07-31 12:44:07 UTC
Permalink
Ivan,

Thank you - my apologies, I should have checked the master branch on
github. I tested the changes from there and they appear to solve the
problem.

Do you have any plans to issue a new release in the near future ?

regards

Brendan
Hi,
Please check master branch. Issue should be solved.
Also, there are a couple of issues in github bdwgc bug tracker, please check
them.
--
среда, 29 июля 2015г., 02:31 +03:00 от Brendan Heading
Hi guys,
There's a minor compilation issue when building bdwgc against musl. The
=================
error: redefinition of 'struct sigcontext'
struct sigcontext {
^
In file included from
/home/peko/autobuild/instance-2/output/host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include/signal.h:243:0,
from ./include/private/../gc_pthread_redirects.h:42,
from ./include/private/../gc.h:1443,
from ./include/private/gc_priv.h:46,
note: originally defined here
typedef struct sigcontext
=================
The root cause is in the following excerpt from os_dep.c
=================
# if 2 <= __GLIBC__
# if 2 == __GLIBC__ && 0 == __GLIBC_MINOR__
/* glibc 2.1 no longer has sigcontext.h. But signal.h */
/* has the right declaration for glibc 2.1. */
# include <sigcontext.h>
# endif /* 0 == __GLIBC_MINOR__ */
# else /* __GLIBC__ < 2 */
/* libc5 doesn't have <sigcontext.h>: go directly with the kernel */
/* one. Check LINUX_VERSION_CODE to see which we should reference. */
# include <asm/sigcontext.h>
# endif /* __GLIBC__ < 2 */
=================
The logic here is intended to provide two special cases; one for __GLIBC__
version 2.0, the other is a fall through case intended to be reached if
__GLIBC__ version is <2. However this fall through is also reached if
__GLIBC__ is undefined as is the case in musl. If the __GLIBC__ version is
2.1 or greater no special action is taken.
musl, as a matter of policy, will never provide a macro to detect its
presence. Instead I propose that the above logic be wrapped in an #ifdef
__GLIBC__. I've tested that this allows the build to work on musl, and
should also work on uclibc and other C libraries.
I've attached a patch - I'm more than happy to update it if you feel there
is a better approach.
regards
Brendan
_______________________________________________
bdwgc mailing list
https://lists.opendylan.org/mailman/listinfo/bdwgc
Ivan Maidanski
2015-08-06 08:20:03 UTC
Permalink
Hi Brendan,
I think realistic schedule of gc 7.4.x, 7.6.0 release is Sept-Oct.
Post by Brendan Heading
Ivan,
Thank you - my apologies, I should have checked the master branch on
github. I tested the changes from there and they appear to solve the
problem.
Do you have any plans to issue a new release in the near future ?
regards
Brendan
Hi,
Please check master branch. Issue should be solved.
Also, there are a couple of issues in github bdwgc bug tracker, please check
them.
--
среЎа, 29 Оюля 2015г., 02:31 +03:00 Пт Brendan Heading
Hi guys,
There's a minor compilation issue when building bdwgc against musl. The
=================
error: redefinition of 'struct sigcontext'
struct sigcontext {
^
In file included from
/home/peko/autobuild/instance-2/output/host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include/signal.h:243:0,
from ./include/private/../gc_pthread_redirects.h:42,
from ./include/private/../gc.h:1443,
from ./include/private/gc_priv.h:46,
note: originally defined here
typedef struct sigcontext
=================
The root cause is in the following excerpt from os_dep.c
=================
# if 2 <= __GLIBC__
# if 2 == __GLIBC__ && 0 == __GLIBC_MINOR__
/* glibc 2.1 no longer has sigcontext.h. But signal.h */
/* has the right declaration for glibc 2.1. */
# include <sigcontext.h>
# endif /* 0 == __GLIBC_MINOR__ */
# else /* __GLIBC__ < 2 */
/* libc5 doesn't have <sigcontext.h>: go directly with the kernel */
/* one. Check LINUX_VERSION_CODE to see which we should reference. */
# include <asm/sigcontext.h>
# endif /* __GLIBC__ < 2 */
=================
The logic here is intended to provide two special cases; one for __GLIBC__
version 2.0, the other is a fall through case intended to be reached if
__GLIBC__ version is <2. However this fall through is also reached if
__GLIBC__ is undefined as is the case in musl. If the __GLIBC__ version is
2.1 or greater no special action is taken.
musl, as a matter of policy, will never provide a macro to detect its
presence. Instead I propose that the above logic be wrapped in an #ifdef
__GLIBC__. I've tested that this allows the build to work on musl, and
should also work on uclibc and other C libraries.
I've attached a patch - I'm more than happy to update it if you feel there
is a better approach.
regards
Brendan
_______________________________________________
bdwgc mailing list
https://lists.opendylan.org/mailman/listinfo/bdwgc
_______________________________________________
bdwgc mailing list
https://lists.opendylan.org/mailman/listinfo/bdwgc
Loading...