mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: Reinoud Koornstra <reinoudkoornstra@gmail.com>
Cc: musl@lists.openwall.com
Subject: Re: getting rid of some warnings
Date: Thu, 2 Mar 2017 19:27:38 -0500	[thread overview]
Message-ID: <20170303002738.GH1520@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAAA5faFrg4HhEd48zzXELQL=izwkeV5AwXpunropaiHJwpBcHw@mail.gmail.com>

On Thu, Mar 02, 2017 at 02:37:19PM -0800, Reinoud Koornstra wrote:
> Hello Rich,
> 
> I did compile against musl using the musl-gcc build from your scripts.
> 
> ->MUSL-GCC/bin/x86_64-linux-musl-gcc -nostdinc
> -I/users/koorstra/MUSL-GCC/x86_64-linux-musl/include/ -Wall -g -o
> split_buff split_buff.c
> In file included from
> /users/koorstra/MUSL-GCC/x86_64-linux-musl/include/sys/types.h:70:0,
>                  from split_buff.c:4:
> /users/koorstra/MUSL-GCC/x86_64-linux-musl/include/endian.h: In
> function '__bswap32':
> /users/koorstra/MUSL-GCC/x86_64-linux-musl/include/endian.h:32:25:
> warning: suggest parentheses around arithmetic in operand of '|'
> [-Wparentheses]
>   return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
>                    ~~~~~~^~~~~~~

This happened because you're not just using the musl-gcc wrapper
script, but passing -nostdinc and -I to get the system headers.
Instead either configure for the right include path so you don't need
to do this, or use -isystem instead of -I.

> /users/koorstra/MUSL-GCC/x86_64-linux-musl/include/endian.h:32:41:
> warning: suggest parentheses around arithmetic in operand of '|'
> [-Wparentheses]
>   return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
>                                    ~~~~~~^~~~~~~~~
> /users/koorstra/MUSL-GCC/x86_64-linux-musl/include/endian.h: In
> function '__bswap64':
> /users/koorstra/MUSL-GCC/x86_64-linux-musl/include/endian.h:37:23:
> warning: suggest parentheses around '+' inside  <<' [-Wparentheses]
>   return __bswap32(__x)+0ULL<<32 | __bswap32(__x>>32);
>          ~~~~~~~~~~~~~~^~~~~
>  koorstra@lnxpefer ~
> ->readelf -d split_buff | grep NEEDED
>  0x0000000000000001 (NEEDED)             Shared library: [libc.so]
> 
> 
>  koorstra@lnxpefer ~
> ->./split_buff
> -bash: ./split_buff: /lib/ld-musl-x86_64.so.1: bad ELF interpreter: No
> such file or directory
> 
> How can I get rid of these warnings?
> Also, I guess I need to set the default library paths different?
> Any advice for this?
> Thanks,

If you dynamic link, the dynamic linker ("ELF interpreter") has to be
present at runtime. Your options are:

1. Install it in /lib as above.
2. Static link.
3. Explicitly invoke it from another location to run the program:
   /path/to/ld-musl-x86_64.so.1 ./split_buff ...
4. Configure musl with a different --syslibdir. Note that if you do
   this, programs you link will only work with ld-musl installed in
   the location you have it on your system, and won't be portable to
   standard musl-based systems.

I would recommend option 1 if it's your own system and you can, option
2 or 3 for something you need to ship (you can wrap option 3 with a
script), and option 4 if this is just for testing or personal use (not
shipping) on a system you don't have root on.

Rich


       reply	other threads:[~2017-03-03  0:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAAA5faFrg4HhEd48zzXELQL=izwkeV5AwXpunropaiHJwpBcHw@mail.gmail.com>
2017-03-03  0:27 ` Rich Felker [this message]
2017-03-03  0:42   ` Reinoud Koornstra

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=20170303002738.GH1520@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    --cc=reinoudkoornstra@gmail.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).