We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
currently i use the following hack so mir works on my musl-libc based linux distro:
diff --git a/c2mir/c2mir.c b/c2mir/c2mir.c index 6659bf6..483b4d2 100644 --- a/c2mir/c2mir.c +++ b/c2mir/c2mir.c @@ -11877,7 +11877,13 @@ static int fancy_printf (const char *fmt, ...) { abort (); } static struct lib { char *name; void *handler; -} libs[] = {{"/lib64/libc.so.6", NULL}, {"/lib64/libm.so.6", NULL}}; +} libs[] = { +#ifdef __GLIBC__ +{"/lib64/libc.so.6", NULL}, {"/lib64/libm.so.6", NULL} +#else +{"/lib/libc.so", NULL}, +#endif +}; static void close_libs (void) { for (int i = 0; i < sizeof (libs) / sizeof (struct lib); i++) diff --git a/mir-bin-driver.c b/mir-bin-driver.c index 9f86915..6abb3f8 100644 --- a/mir-bin-driver.c +++ b/mir-bin-driver.c @@ -20,7 +20,13 @@ static int read_byte (MIR_context_t ctx) { static struct lib { char *name; void *handler; -} libs[] = {{"/lib64/libc.so.6", NULL}, {"/lib64/libm.so.6", NULL}}; +} libs[] = { +#ifdef __GLIBC__ +{"/lib64/libc.so.6", NULL}, {"/lib64/libm.so.6", NULL} +#else +{"/lib/libc.so", NULL}, +#endif +}; static void close_libs (void) { for (int i = 0; i < sizeof (libs) / sizeof (struct lib); i++)
not trying to push for anything, just raising this for consideration purposes.
unrelated, the following hunk removes dependency on LLVM
diff --git a/Makefile b/Makefile index 0dd847b..da9bb5d 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ CFLAGS=-O3 -g -DNDEBUG TARGET=x86_64 MIR_DEPS=mir.h mir-varr.h mir-dlist.h mir-htab.h mir-hash.h mir-interp.c mir-x86_64.c MIR_GEN_DEPS=$(MIR_DEPS) mir-bitmap.h mir-gen-$(TARGET).c -OBJS=mir.o mir-gen.o c2m l2m m2b b2m b2ctab +OBJS=mir.o mir-gen.o c2m m2b b2m b2ctab Q=@ all: $(OBJS)
The text was updated successfully, but these errors were encountered:
Thank you. I changed libs in c2mir-driver.c and l2mir-driver.c.
Sorry, something went wrong.
thank you, but i don't think the solution is good. afaik musl libc is the only libc which has libm integrated in libc.so. the following works for me:
#define _GNU_SOURCE #include <dlfcn.h> #include <stdio.h> int main(int a, char**b) { Dl_info dli; void *printf_ptr = dlsym(RTLD_NEXT, "printf"); dladdr(printf_ptr, &dli); printf("%s\n", dli.dli_fname); void *sinf_ptr = dlsym(RTLD_NEXT, "sinf"); dladdr(sinf_ptr, &dli); printf("%s\n", dli.dli_fname); }
in my case it prints /lib/ld-musl-x86_64.so.1 twice. (ld-musl.....so is a symlink to /lib/libc.so, so that's ok)
/lib/ld-musl-x86_64.so.1
on ubuntu 16.04. it prints:
/lib/x86_64-linux-gnu/libc.so.6 /lib/x86_64-linux-gnu/libc.so.6
it seems there libc.so contains libm as well.
No branches or pull requests
currently i use the following hack so mir works on my musl-libc based linux distro:
not trying to push for anything, just raising this for consideration purposes.
unrelated, the following hunk removes dependency on LLVM
The text was updated successfully, but these errors were encountered: