From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1817 Path: news.gmane.org!not-for-mail From: Igmar Palsenberg Newsgroups: gmane.linux.lib.musl.general Subject: Re: 'Proper' software writing Date: Tue, 04 Sep 2012 11:41:18 +0200 Message-ID: <5045CCBE.7030709@palsenberg.com> References: <5044B6E3.70203@palsenberg.com> <20120904015004.GL27715@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1346751690 17675 80.91.229.3 (4 Sep 2012 09:41:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Sep 2012 09:41:30 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1818-gllmg-musl=m.gmane.org@lists.openwall.com Tue Sep 04 11:41:32 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1T8pdT-0004lR-Nh for gllmg-musl@plane.gmane.org; Tue, 04 Sep 2012 11:41:31 +0200 Original-Received: (qmail 7886 invoked by uid 550); 4 Sep 2012 09:41:27 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 7877 invoked from network); 4 Sep 2012 09:41:27 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20120824 Thunderbird/15.0 In-Reply-To: <20120904015004.GL27715@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:1817 Archived-At: On 9/4/12 3:50 AM, Rich Felker wrote: > On Mon, Sep 03, 2012 at 03:55:47PM +0200, Igmar Palsenberg wrote: >> Hi, >> >> When attempting to fix my own piece of software I've come to the >> conclusing that writing somewhat portable software (glibc vs musl) is a >> huge PITA. > Yes. Actually it's also a huge PITA between other implementations too, > but the breakage is all a lot more subtle. Basically the surest way to > write portable software is to use _POSIX_C_SOURCE or _XOPEN_SOURCE and > write purely to the standards, not using any extension functionality, > but often you want or even need at least some extensions that are > pretty much universally available, and then there's no well-defined > way to get them... This code is Linux only. I basically can use _GNU_SOURCE, but that pulls in way to much, and not to mention things you don't want in decent software. For now, I've settled for _XOPEN_SOURCE and _BSD_SOURCE, and redefine the stuff I need (dladdr(), some network related defines). That seems to work for me. I've broken my glibc build, but that's a fix for later :) >> - Why use _BSD_SOURCE and _GNU_SOURCE at all ? What is the argument of >> not exposing *ALL* stuff that is in musl ? > All is probably too much; there's a lot of ugly cruft (like lowercase > macros named major and minor getting exposed whenever you include > stdlib.h) in the "expose it all" _GNU_SOURCE profile. This is bad > enough if you're requesting it, but really bad if it's just there by > default. > > I'm well aware that your frustration is the first/biggest FAQ people > have when trying to use musl and that it's a bad first experience. I like clean software. Musl helps with that, so that you actually *think* before coding. Musl and -Werror are my best friends for now. I've had more bad experiences with GNU software then with Musl. Musl I can usually fix myself, GNU tools are usually a whole different story. > Right now there's a big ongoing thread about what to do about it, and > we're doing some research on applications and the headers themselves > to figure out what a sane, clean, default profile to expose would be. > >> - Is there a way to do proper feature detection ? I tried autoscan from >> autotools, but the outcome wanted to make me cry. It missed about all >> that is important. > Gregor has a really good guide to using autotools properly, and some > tricks to make generated autoconf scripts lighter/faster by > dummying-out useless ones: > > https://bitbucket.org/GregorR/autoconf-lean > Thanks. I'll look into that. Regards, Igmar