Problems when compiling with GCC 6.2.0 and musl #123
Comments
A little bit more info as I work through this. It seems musl does not define |
Linux-ism, but not a glib-ism )
Fixed.
Hm, don't see
Fixed |
Right, I'll try these out. Thank you. It seems musl does not define __GLIBC_PREREQ by policy, sadly: http://www.openwall.com/lists/musl/2012/10/20/10 |
Hmmm, |
OK, sorting that leaves:- In file included from ../../../libraries/libmdbx/mdbx.c:36:0:
../../../libraries/libmdbx/mdb.c:55:41: error: missing binary operator before token "("
#if !defined(__GNUC__) || !__GNUC_PREREQ(4,2)
^
../../../libraries/libmdbx/mdb.c:64:49: error: missing binary operator before token "("
#if !defined(__GNU_LIBRARY__) || !__GLIBC_PREREQ(2,12)
^
In file included from ../../../libraries/libmdbx/mdb.c:77:0,
from ../../../libraries/libmdbx/mdbx.c:36:
../../../libraries/libmdbx/./reopen.h:176:17: error: conflicting types for '__assert_fail'
__extern_C void __assert_fail(
^~~~~~~~~~~~~
In file included from ../../../libraries/libmdbx/./reopen.h:173:0,
from ../../../libraries/libmdbx/mdb.c:77,
from ../../../libraries/libmdbx/mdbx.c:36:
/home/montebianco/packages/montebianco/output/.package-cache/build_musl_cross_make_host/53ce4c84/build-sysroot/usr/include/assert.h:19:16: note: previous declaration of '__assert_fail' was here
_Noreturn void __assert_fail (const char *, const char *, int, const char *);
^~~~~~~~~~~~~
In file included from ../../../libraries/libmdbx/mdbx.c:36:0:
../../../libraries/libmdbx/mdb.c:195:19: error: missing binary operator before token "("
&& __GLIBC_PREREQ(2,10)
^
../../../libraries/libmdbx/mdb.c:4555:20: error: missing binary operator before token "("
# if __GLIBC_PREREQ(2,18)
^
In file included from ../../../libraries/libmdbx/mdbx.c:36:0:
../../../libraries/libmdbx/mdb.c: In function 'mdbx_pthread_crutch_dtor':
../../../libraries/libmdbx/mdb.c:4675:2: error: implicit declaration of function 'pthread_yield' [-Werror=implicit-function-declaration]
pthread_yield();
^~~~~~~~~~~~~
|
Also, |
Ok, seems a lot of small problems... Now I could spend more time, but in 2-3 days. |
I'm doing a build for Libertine Linux, which is my thing. It's rather alpha, but does work for core stuff. It should be possible to git clone https://github.com/libertine-linux/libertine.git on any modern Alpine Linux with docker installed - it then creates a docker image and builds a toolchain before building a linux image with ReOpenLDAP. I've not checked in the ReOpenLDAP recipe, yet, however as it's all a bit messy (unsurprisingly). I'm away the rest of the week for work, so happy to pick this up when I get back next week. Thank for all your help so far. |
I've got a bit further. Removing the definition of .libs/libmdbx.a(libmdbx_la-mdbx.o): In function `mdbx_rthc_add':
/home/montebianco/packages/montebianco/output/.package-cache/ReOpenLDAP/833fa089/copy/upstream/servers/slapd/back-mdb/../../../libraries/libmdbx/mdb.c:3498: undefined reference to `__cxa_thread_atexit_impl' I suspect this is another musl-ism... |
__cxa_thread_atexit_impl is a workaround for pthread_delete_key() bugs. Please see erthink/libmdbx@02de457 and erthink/libmdbx@9c02fad |
Quite possibly. For now, I've made an almighty hack to avoid using it. My aim to to get ReOpenLDAP to 'compile' with musl, and then at least most of the potential issues have been found. I'm also replacing the use of pthread_yield with sched_yield for now in the same vein, and trying to stub out backtrace.c in servers/slapd/backtrace.c because musl does not provide |
It might be worth asking on the musl mailing list. It's possible someone has a pending patch for musl. |
Good news! With some changes (possibly not correct) I've got things compiling with musl. |
|
Oh dear. I've had this problem too more than once. It occurred in the past because the libressl committers either git push --force or have a dodgy conversion from cvs. I recently switched to a private fork to try to snapshot. I'll do a fresh git checkout here to see if I got that right, which will probably take most of the afternoon... |
done, building now... |
@raphaelcohn , could you check current 'devel' branch and close all related issues? |
Assume fixed in the 'devel' branch, still waiting 72 hours to close issue. |
Sorry. Will take a look tomorrow.
…On 28 Mar 2017 7:57 p.m., "Leonid Yuriev" ***@***.***> wrote:
Assume fixed in the 'devel' branch, still waiting 72 hours to close issue.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#123 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABPx2WwnUaKzWQzheGVLQV6xcj9bGQ6yks5rqVgbgaJpZM4MM4xi>
.
|
Right, I kicked off a build tonight but it fails quite early on with something I think is Makefile:887: update target 'hipagut.lo' due to: hipagut.c
clibtool-static --tag=CC --mode=compile x86_64-linux-musl-cc -pipe -static --static -Wl,-Bstatic -static-libgcc -Werror=implicit-function-declaration -Wl,-z,relro,-z,now -fstack-protector-strong -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D__gnu_linux__ -O3 -fno-asynchronous-unwind-tables -fno-unwind-tables -ffunction-sections -fdata-sections -Wl,--gc-sections -fno-common -fomit-frame-pointer --sysroot=/home/montebianco/packages/montebianco/output/.package-cache/ReOpenLDAP/900a6f55/input-sysroot -DHAVE_CONFIG_H -I. -I../.. -I../../include -DRELDAP_LIBRARY -DLDAP_R_COMPILE -I../../include -g -O2 -D_GNU_SOURCE -I/home/montebianco/packages/montebianco/output/.package-cache/libressl/1b61c77a/host-sysroot/usr/include -c -o hipagut.lo hipagut.c
clibtool-static: compile: x86_64-linux-musl-cc -pipe --static -Wl,-Bstatic -static-libgcc -Werror=implicit-function-declaration -Wl,-z,relro,-z,now -fstack-protector-strong -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D__gnu_linux__ -O3 -fno-asynchronous-unwind-tables -fno-unwind-tables -ffunction-sections -fdata-sections -Wl,--gc-sections -fno-common -fomit-frame-pointer --sysroot=/home/montebianco/packages/montebianco/output/.package-cache/ReOpenLDAP/900a6f55/input-sysroot -DHAVE_CONFIG_H -I. -I../.. -I../../include -DRELDAP_LIBRARY -DLDAP_R_COMPILE -I../../include -g -O2 -D_GNU_SOURCE -I/home/montebianco/packages/montebianco/output/.package-cache/libressl/1b61c77a/host-sysroot/usr/include -c hipagut.c -USLIBTOOL_PLACEHOLDER_DPIC -USLIBTOOL_PLACEHOLDER_FPIC -c -USLIBTOOL_PLACEHOLDER_NO_UNDEFINED -USLIBTOOL_PLACEHOLDER_SONAME -USLIBTOOL_PLACEHOLDER_LSONAME -USLIBTOOL_PLACEHOLDER_SYMDEF_SWITCH -USLIBTOOL_PLACEHOLDER_SYMDEF_FILE -o hipagut.o -USLIBTOOL_PLACEHOLDER_RPATH_SWITCH -USLIBTOOL_PLACEHOLDER_RPATH_DIR
hipagut.c: In function 'ldap_timeval':
hipagut.c:782:4: error: dereferencing pointer to incomplete type 'struct timeval'
tv->tv_sec = us / 1000000u;
^~
clibtool-static: error logged in slbt_exec_compile(), line 132: No error information.
make[4]: *** [Makefile:887: hipagut.lo] Error 2
make[4]: Leaving directory '/home/montebianco/packages/montebianco/output/.package-cache/ReOpenLDAP/900a6f55/copy/upstream/libraries/libreldap' This is for the current |
Yeah, I thought I'd seen this before. The necessary change is |
Sorry, this was old copy-paste mistake. |
No problem, I've done that sort of thing many times myself. Taking the current clibtool-static: compile: x86_64-linux-musl-cc -pipe --static -Wl,-Bstatic -static-libgcc -Werror=implicit-function-declaration -Wl,-z,relro,-z,now -fstack-protector-strong -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D__gnu_linux__ -O3 -fno-asynchronous-unwind-tables -fno-unwind-tables -ffunction-sections -fdata-sections -Wl,--gc-sections -fno-common -fomit-frame-pointer --sysroot=/home/montebianco/packages/montebianco/output/.package-cache/ReOpenLDAP/900a6f55/input-sysroot -DHAVE_CONFIG_H -I. -I../../.. -I../../../include -DSLAPD_IMPORT -I./.. -I../../../include -DNDEBUG=1 -DMDB_DEBUG=0 -g -O2 -D_GNU_SOURCE -I/home/montebianco/packages/montebianco/output/.package-cache/libressl/1b61c77a/host-sysroot/usr/include -c ../../../libraries/libmdbx/mdbx.c -USLIBTOOL_PLACEHOLDER_DPIC -USLIBTOOL_PLACEHOLDER_FPIC -c -USLIBTOOL_PLACEHOLDER_NO_UNDEFINED -USLIBTOOL_PLACEHOLDER_SONAME -USLIBTOOL_PLACEHOLDER_LSONAME -USLIBTOOL_PLACEHOLDER_SYMDEF_SWITCH -USLIBTOOL_PLACEHOLDER_SYMDEF_FILE -o ../../../libraries/libmdbx/libmdbx_la-mdbx.o -USLIBTOOL_PLACEHOLDER_RPATH_SWITCH -USLIBTOOL_PLACEHOLDER_RPATH_DIR
In file included from ../../../libraries/libmdbx/mdbx.c:36:0:
../../../libraries/libmdbx/mdb.c:55:41: error: missing binary operator before token "("
#if !defined(__GNUC__) || !__GNUC_PREREQ(4,2)
^
../../../libraries/libmdbx/mdb.c:64:49: error: missing binary operator before token "("
#if !defined(__GNU_LIBRARY__) || !__GLIBC_PREREQ(2,12)
^
In file included from ../../../libraries/libmdbx/mdb.c:77:0,
from ../../../libraries/libmdbx/mdbx.c:36:
../../../libraries/libmdbx/./reopen.h:176:17: error: conflicting types for '__assert_fail'
__extern_C void __assert_fail(
^~~~~~~~~~~~~
In file included from ../../../libraries/libmdbx/./reopen.h:173:0,
from ../../../libraries/libmdbx/mdb.c:77,
from ../../../libraries/libmdbx/mdbx.c:36:
/home/montebianco/packages/montebianco/output/.package-cache/build_musl_cross_make_host/017b55b5/build-sysroot/usr/include/assert.h:19:16: note: previous declaration of '__assert_fail' was here
_Noreturn void __assert_fail (const char *, const char *, int, const char *);
^~~~~~~~~~~~~
In file included from ../../../libraries/libmdbx/mdbx.c:36:0:
../../../libraries/libmdbx/mdb.c:195:19: error: missing binary operator before token "("
&& __GLIBC_PREREQ(2,10)
^
../../../libraries/libmdbx/mdb.c:4555:20: error: missing binary operator before token "("
# if __GLIBC_PREREQ(2,18)
^
clibtool-static: error logged in slbt_exec_compile(), line 132: No error information.
make[6]: *** [Makefile:1017: ../../../libraries/libmdbx/libmdbx_la-mdbx.lo] Error 2
make[6]: Leaving directory '/home/montebianco/packages/montebianco/output/.package-cache/ReOpenLDAP/900a6f55/copy/upstream/servers/slapd/back-mdb' (BTW, I can fix the above error with sed -i \
-e 's;__GNUC_PREREQ(.*,.*);1;g' \
-e 's;__GLIBC_PREREQ(.*,.*);1;g' \
libraries/libmdbx/mdb.c I then get ../../../libraries/libmdbx/./reopen.h:176:17: error: conflicting types for '__assert_fail'
__extern_C void __assert_fail(
^~~~~~~~~~~~~
In file included from ../../../libraries/libmdbx/./reopen.h:173:0,
from ../../../libraries/libmdbx/mdb.c:77,
from ../../../libraries/libmdbx/mdbx.c:36:
/home/montebianco/packages/montebianco/output/.package-cache/build_musl_cross_make_host/017b55b5/build-sysroot/usr/include/assert.h:19:16: note: previous declaration of '__assert_fail' was here
_Noreturn void __assert_fail (const char *, const char *, int, const char *);
^~~~~~~~~~~~~
clibtool-static: error logged in slbt_exec_compile(), line 132: No error information. |
Thanks, I will re-check. |
Oops, I seem to have lost one commit ( |
@raphaelcohn, fixed now. Unfortunately, I couldn't verify build via libertine. So, it will be great if we could be provide a CI by https://travis-ci.org/ |
A CI solution is on my todo list - sadly libertine is my free-time project (:-(. The libressl commits are a pain in the neck. I've made some more changes this morning. Regularly rebuilding by git checkout on another machine should make this a thing of the past. Ah, yes, that'll need... CI. I'll do a local build tonight. |
I've found I have to change the following files as follows to get ReOpenLDAP to start to cross-compile:-
Cross compilation is to x86_64/musl with static PIE, fortified source and grsec.
The text was updated successfully, but these errors were encountered: