mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jens <jensl@laas.mine.nu>
To: musl@lists.openwall.com
Subject: musl-gcc question
Date: Thu, 20 Sep 2012 16:50:13 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LNX.2.02.1209201640370.24985@laas.mine.nu> (raw)


Hello!

Looks like musl-gcc in my uclibc environment doesn't work correctly (for 
me):

bash-4.1# cat t.c
main()
{
 	printf("hejsan!\n");
}
bash-4.1# gcc -o t -static t.c
t.c: In function 'main':
t.c:3: warning: incompatible implicit declaration of built-in function 
'printf'
bash-4.1# musl-gcc -o m -static t.c
t.c: In function 'main':
t.c:3: warning: incompatible implicit declaration of built-in function 
'printf'
bash-4.1# ls -l t m
-rwxr-xr-x    1 0        0           17637 Sep 20 14:43 m
-rwxr-xr-x    1 0        0           17637 Sep 20 14:43 t
bash-4.1# cmp t m
bash-4.1#

If I try this:

bash-4.1# gcc -nostdinc -isystem /opt/musl/include -nostdlib 
-L/opt/musl/lib -o m /opt/musl/lib/crti.o  /opt/musl/lib/crtn.o 
/opt/musl/lib/Scrt1.o -lc -static t.c
t.c: In function 'main':
t.c:3: warning: incompatible implicit declaration of built-in function 
'printf'
bash-4.1# ls -l t m
-rwxr-xr-x    1 0        0           63217 Sep 20 14:44 m
-rwxr-xr-x    1 0        0           17637 Sep 20 14:43 t
bash-4.1# strip t m
bash-4.1# ls -l t m
-rwxr-xr-x    1 0        0            5152 Sep 20 14:44 m
-rwxr-xr-x    1 0        0            8424 Sep 20 14:44 t

Looks like 'm' is now actually build with musl.

If we look at the verbose output below it seems like -L/lib is a bad thing 
to have, since all the uclibc libs are there.

musl is installed under /opt/musl.

What have I missed?

I have tested musl-0.9.1 and musl-0.9.6.

Regards,
Jens

bash-4.1# musl-gcc -v -o m -static t.c
Invoked as gcc
Reference path: /bin/..
arg[ 0] = rawgcc
arg[ 1] = -nostdlib
arg[ 2] = -static
arg[ 3] = -Wl,-rpath-link,/bin/../lib
arg[ 4] = -L/bin/../lib
arg[ 5] = -L/bin/../gcc/lib
arg[ 6] = -nostdinc
arg[ 7] = -isystem
arg[ 8] = /bin/../include
arg[ 9] = -isystem
arg[10] = /bin/../gcc/include
arg[11] = -U__nptl__
arg[12] = /bin/../lib/crti.o
arg[13] = /bin/../gcc/lib/crtbeginT.o
arg[14] = /bin/../lib/crt1.o
arg[15] = -v
arg[16] = -o
arg[17] = m
arg[18] = -static
arg[19] = t.c
arg[20] = -specs
arg[21] = /opt/musl/lib/musl-gcc.specs
arg[22] = -lgcc
arg[23] = -lgcc_eh
arg[24] = -lc
arg[25] = -lgcc
arg[26] = -lgcc_eh
arg[27] = /bin/../gcc/lib/crtend.o
arg[28] = /bin/../lib/crtn.o
Using built-in specs.
Reading specs from /opt/musl/lib/musl-gcc.specs
rename spec cpp_options to old_cpp_options
Target: x86_64-unknown-linux
Configured with: 
/home/landley/firmware-0.9.6/build/temp-x86_64/gcc-core/configure 
--prefix=/home/landley/firmware-0.9.6/build/mini-native-x86_64/usr 
--disable-multilib --build=x86_64-walrus-linux --host=x86_64-unknown-linux 
--target=x86_64-unknown-linux --enable-long-long --enable-c99 
--enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-nls 
--enable-languages=c,c++ --disable-libstdcxx-pch --enable-sjlj-exceptions 
--program-prefix=
Thread model: posix
gcc version 4.1.2
  /usr/bin/../libexec/gcc/x86_64-unknown-linux/4.1.2/cc1 -quiet -nostdinc 
-v -iprefix /usr/bin/../lib/gcc/x86_64-unknown-linux/4.1.2/ -U__nptl__ 
-isystem /bin/../include -isystem /bin/../gcc/include t.c -nostdinc 
-isystem /opt/musl/include -quiet -dumpbase t.c -mtune=k8 -auxbase t 
-version -o /tmp/ccv5P4ov.s
#include "..." search starts here:
#include <...> search starts here:
  /bin/../include
  /bin/../gcc/include
  /opt/musl/include
End of search list.
GNU C version 4.1.2 (x86_64-unknown-linux)
 	compiled by GNU C version 4.1.2.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 02dced53fb1afdc2e565976e418928e8
t.c: In function 'main':
t.c:3: warning: incompatible implicit declaration of built-in function 
'printf'
  as --traditional-format -V -Qy -o /tmp/ccW901pW.o /tmp/ccv5P4ov.s
GNU assembler version 2.17 (x86_64-unknown-linux) using BFD version 2.17
  /usr/bin/../libexec/gcc/x86_64-unknown-linux/4.1.2/collect2 
-dynamic-linker /lib/ld-musl-x86_64.so.1 -nostdlib -static -o m 
-L/bin/../lib -L/bin/../gcc/lib -L/opt/musl/lib -L /lib/. -rpath-link 
/bin/../lib /bin/../lib/crti.o /bin/../gcc/lib/crtbeginT.o 
/bin/../lib/crt1.o /tmp/ccW901pW.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh 
/bin/../gcc/lib/crtend.o /bin/../lib/crtn.o



             reply	other threads:[~2012-09-20 14:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-20 14:50 Jens [this message]
2012-09-20 16:00 ` Szabolcs Nagy
2012-09-20 16:34   ` Jens
2012-09-20 17:52 ` Szabolcs Nagy
2012-09-20 18:14 ` Rich Felker
2012-09-20 21:53   ` idunham
2012-09-20 22:04     ` Rich Felker
2012-09-20 23:39       ` idunham
2012-09-21  4:54         ` Rich Felker
2012-09-21 10:51   ` Jens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.02.1209201640370.24985@laas.mine.nu \
    --to=jensl@laas.mine.nu \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).