mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] Newbie problem with musl-gcc
@ 2021-10-08  0:14 Nat!
  2021-10-08  6:31 ` Markus Wichmann
  0 siblings, 1 reply; 4+ messages in thread
From: Nat! @ 2021-10-08  0:14 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1331 bytes --]

Hello

I got everything setup on ubuntu 21.04 and it's compiling and linking my 
small statically linked test executable, but I can't run it.

    $ ldd ./foo
         statically linked
    $ ls -l foo
    -rwxrwxr-x 1 nat develop 77224 Okt  8 02:05 foo
    $ sudo strace ./foo
    execve("./foo", ["./foo"], 0x7ffe245a03c0 /* 26 vars */) = -1 ENOENT
    (Datei oder Verzeichnis nicht gefunden)
    strace: exec: Datei oder Verzeichnis nicht gefunden
    +++ exited with 1 +++


I assume this is a common newbie problem, but in case not:

    Linux localhost 5.11.0-37-generic #41-Ubuntu SMP Mon Sep 20 16:39:20
    UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
    gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0
    musl is not installed


How I built musl-1.2.2 (this is basically non-negotiable, if I can't 
have it build "static only" outside of root, this is no use for me)

    CC='cc' CFLAGS='-g -O0' CXXFLAGS='-g -O0' ./configure 
    --disable-shared --prefix='/tmp/dependency'
    make  VERBOSE=1 -j 64 all
    make VERBOSE=1 -j 64 install


How I built "foo.c":

    cat <<EOF > foo.c
    #include <stdio.h>

    int  main( void)
    {
        printf( "VfL Bochum 1848\n");
        return( 0);
    }
    EOF

    PATH="/tmp/dependency/bin:$PATH"

    musl-gcc -o foo foo.c

Thanks for any help in advance
     Nat!









[-- Attachment #2: Type: text/html, Size: 3903 bytes --]

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

* Re: [musl] Newbie problem with musl-gcc
  2021-10-08  0:14 [musl] Newbie problem with musl-gcc Nat!
@ 2021-10-08  6:31 ` Markus Wichmann
  2021-10-08 19:00   ` Nat!
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Wichmann @ 2021-10-08  6:31 UTC (permalink / raw)
  To: musl

On Fri, Oct 08, 2021 at 02:14:00AM +0200, Nat! wrote:
> Hello
>
> I got everything setup on ubuntu 21.04 and it's compiling and linking my
> small statically linked test executable, but I can't run it.
>
>    $ ldd ./foo
>         statically linked
>    $ ls -l foo
>    -rwxrwxr-x 1 nat develop 77224 Okt  8 02:05 foo
>    $ sudo strace ./foo
>    execve("./foo", ["./foo"], 0x7ffe245a03c0 /* 26 vars */) = -1 ENOENT
>    (Datei oder Verzeichnis nicht gefunden)
>    strace: exec: Datei oder Verzeichnis nicht gefunden
>    +++ exited with 1 +++
>

I think I have seen this before. ldd sometimes returns the wrong info.
Try "readelf -l" on the program to verify it has no interpreter. I have
reason to believe that it does have musl's interpreter, and you have not
properly installed musl.

>    musl is not installed
>

Ha! Didn't I say it?

>        printf( "VfL Bochum 1848\n");

Was this really just an elaborate attempt to advertise your favourite
football club? Just kidding.

>    musl-gcc -o foo foo.c

This doesn't say -static in there. Try adding that and see was happens.
musl-gcc essentially just adds a different specs file to GCC, and that
file is not changed based on the choice to have the shared library or
not.

Ciao,
Markus

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

* Re: [musl] Newbie problem with musl-gcc
  2021-10-08  6:31 ` Markus Wichmann
@ 2021-10-08 19:00   ` Nat!
  2021-10-08 19:16     ` Parke
  0 siblings, 1 reply; 4+ messages in thread
From: Nat! @ 2021-10-08 19:00 UTC (permalink / raw)
  To: musl


Am 08.10.21 um 08:31 schrieb Markus Wichmann:
>     musl-gcc -o foo foo.c
> This doesn't say -static in there. Try adding that and see was happens.
Nice, now it works.
> musl-gcc essentially just adds a different specs file to GCC, and that
> file is not changed based on the choice to have the shared library or
> not.
But why not ? It would make sense, wouldn't it ?

Thanks for the help.

Ciao
    Nat!



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

* Re: [musl] Newbie problem with musl-gcc
  2021-10-08 19:00   ` Nat!
@ 2021-10-08 19:16     ` Parke
  0 siblings, 0 replies; 4+ messages in thread
From: Parke @ 2021-10-08 19:16 UTC (permalink / raw)
  To: musl

Nat! wrote:
> > >     musl-gcc -o foo foo.c

> Am 08.10.21 um 08:31 schrieb Markus Wichmann:
> > This doesn't say -static in there. Try adding that and see was happens.

On Fri, Oct 8, 2021 at 12:01 PM Nat! <nat@mulle-kybernetik.com> wrote:
> Nice, now it works.

> > musl-gcc essentially just adds a different specs file to GCC, and that
> > file is not changed based on the choice to have the shared library or
> > not.

> But why not ? It would make sense, wouldn't it ?

I believe the desired default, even with musl, is to use dynamic libraries.

So, IMO, the current behavior is expected and desired.

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

end of thread, other threads:[~2021-10-08 19:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-08  0:14 [musl] Newbie problem with musl-gcc Nat!
2021-10-08  6:31 ` Markus Wichmann
2021-10-08 19:00   ` Nat!
2021-10-08 19:16     ` Parke

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).