mailing list of musl libc
 help / color / mirror / code / Atom feed
* musl-gcc not working after installing
@ 2015-08-25  9:57 Nitin Singh
  2015-08-25 11:32 ` Szabolcs Nagy
  0 siblings, 1 reply; 2+ messages in thread
From: Nitin Singh @ 2015-08-25  9:57 UTC (permalink / raw)
  To: musl

I have linux installed in armv6 android phone in chrooted environment.

I have installed musl-libc from source for building static binary for
android. Here are the commands, I ran for building & installing in
debian ::

./configure --disable-shared
make
make install


Here is config.mak ::

# This version of config.mak was generated by:
# ./configure --disable-shared
# Any changes made here will be lost if configure is re-run
ARCH = arm
SUBARCH =
ASMSUBARCH = el
prefix = /usr/local/musl
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
libdir = $(prefix)/lib
includedir = $(prefix)/include
syslibdir = /lib
CC = gcc
CFLAGS = -Os -pipe -fomit-frame-pointer -fno-unwind-tables
-fno-asynchronous-unwind-tables -Wa,--noexecstack
-Werror=implicit-function-declaration -$
CFLAGS_C99FSE = -std=c99 -nostdinc -ffreestanding
-fexcess-precision=standard -frounding-math
CFLAGS_MEMOPS = -fno-tree-loop-distribute-patterns
CPPFLAGS =
LDFLAGS = -Wl,--hash-style=both
CROSS_COMPILE =
LIBCC = -lgcc -lgcc_eh
OPTIMIZE_GLOBS = internal/*.c malloc/*.c string/*.c
SHARED_LIBS =



It got built & installed fine without any errors.
But when I check for installation .



cat > hello.c <<EOF
#include <stdio.h>
int main()
{   printf("hello, world!\n");
return 0;
}
EOF

/usr/local/musl/bin/musl-gcc hello.c
./a.out



It shows this error ::


/usr/lib/gcc/arm-linux-gnueabi/4.6/libgcc.a(_dvmd_lnx.o): In function
   `__aeabi_ldiv0':
(.text+0x8): undefined reference to `raise'
collect2: ld returned 1 exit status




Please guide me , What's wrong with musl installation ?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: musl-gcc not working after installing
  2015-08-25  9:57 musl-gcc not working after installing Nitin Singh
@ 2015-08-25 11:32 ` Szabolcs Nagy
  0 siblings, 0 replies; 2+ messages in thread
From: Szabolcs Nagy @ 2015-08-25 11:32 UTC (permalink / raw)
  To: Nitin Singh; +Cc: musl

* Nitin Singh <acc4nitin@gmail.com> [2015-08-25 15:27:20 +0530]:
> I have linux installed in armv6 android phone in chrooted environment.
> 
> I have installed musl-libc from source for building static binary for
> android. Here are the commands, I ran for building & installing in
> debian ::
> 
> ./configure --disable-shared
> make
> make install
> 
...
> 
> cat > hello.c <<EOF
> #include <stdio.h>
> int main()
> {   printf("hello, world!\n");
> return 0;
> }
> EOF
> 
> /usr/local/musl/bin/musl-gcc hello.c
> ./a.out
> 

if you add -v, you should see

.. --start-group -lgcc -lgcc_eh -lc --end-group ..

which means all dependencies between libgcc and libc are resolved

i think gcc does not do the --start-group/--end-group without
explicit -static, so only musl-gcc -static hello.c would work.

> It shows this error ::
> 
> 
> /usr/lib/gcc/arm-linux-gnueabi/4.6/libgcc.a(_dvmd_lnx.o): In function
>    `__aeabi_ldiv0':
> (.text+0x8): undefined reference to `raise'
> collect2: ld returned 1 exit status
> 

raise is in libc, referenced from libgcc
__aebi_ldiv0 is in libgcc, referenced from libc

with static linking, undefined symbol resolution
happens in the order the libraries are listed on
the command line (so you need -lgcc -lc -lgcc -lc or
the --*-group linker flags to resolve circular deps)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-25 11:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-25  9:57 musl-gcc not working after installing Nitin Singh
2015-08-25 11:32 ` Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).