From: Romain Naour <romain.naour@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] package/lshw: fix musl build
Date: Thu, 4 Aug 2016 22:34:35 +0200 [thread overview]
Message-ID: <424edffc-502e-c9f5-d5cb-b951b0c62832@gmail.com> (raw)
In-Reply-To: <20160804200947.64225ece@free-electrons.com>
Hi Thomas,
Le 04/08/2016 ? 20:09, Thomas Petazzoni a ?crit :
> Hello,
>
> On Thu, 4 Aug 2016 19:09:25 +0200, Romain Naour wrote:
>
>> Actually, I get an error on basename from sysfs.cc
>>
>> sysfs.cc: In function ?std::string sysfs_getbustype(const string&)?:
>> sysfs.cc:103:41: error: invalid conversion from ?const char*? to ?char*?
>> [-fpermissive]
>> "/devices/" + basename(path.c_str());
>>
>> The cast in dasd is not necessary.
>
> Are you sure it's musl related, and not gcc version related? A
> -fpermissive error typically indicates that the compiler has become
> stricter than it used to be.
It seems related to musl. lshw build fine with a toolchain with gcc 5.
I'm not a glibc expert but it seems that glibc accept a char * or const char *
as filename argument, see string.h from glibc:
# ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
extern "C++" char *basename (char *__filename)
__THROW __asm ("basename") __nonnull ((1));
extern "C++" const char *basename (const char *__filename)
__THROW __asm ("basename") __nonnull ((1));
# else
extern char *basename (const char *__filename) __THROW __nonnull ((1));
# endif
# endif
The musl version doesn't support the const char * prototype.
Also, the lshw code expect the GNU version of basename(). But this version is
not available from string.h when C++ is used.
See string.h from musl:
#ifndef __cplusplus
char *basename();
#endif
That's the issue reported by autobuilders, so the only way is to use the POSIX
basename() if we want to use lshw with musl.
Upstream fixed a similar issue in src/core/pci.cc using the POSIX basename() [1]
and a cast from const char * to char * to avoid invalid conversion.
Thought ?
Best regards,
Romain
[1] https://github.com/lyonel/lshw/commit/cd690bff1516b40fecd5ec4a7f6619e5bffc3cf0
>
> Thomas
>
next prev parent reply other threads:[~2016-08-04 20:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-04 16:24 [Buildroot] [PATCH] package/lshw: fix musl build Romain Naour
2016-08-04 16:37 ` Thomas Petazzoni
2016-08-04 17:09 ` Romain Naour
2016-08-04 18:09 ` Thomas Petazzoni
2016-08-04 20:34 ` Romain Naour [this message]
2016-08-05 4:25 ` Khem Raj
2016-08-12 22:41 ` Yann E. MORIN
2016-08-13 2:32 ` Khem Raj
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=424edffc-502e-c9f5-d5cb-b951b0c62832@gmail.com \
--to=romain.naour@gmail.com \
--cc=buildroot@busybox.net \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox