Re: [PATCH, libstdc++] Fix detection of posix_memalig for cross-builds

2016-11-30 Thread Christophe Lyon
On 1 December 2016 at 01:18, Bernd Edlinger  wrote:
> On 12/01/16 00:10, Jonathan Wakely wrote:
>> On 30/11/16 23:06 +0100, Christophe Lyon wrote:
>>> On 30 November 2016 at 22:51, Jonathan Wakely  wrote:
 On 30/11/16 22:32 +0100, Christophe Lyon wrote:
>
> On 30 November 2016 at 20:00, Bernd Edlinger
> 
> wrote:
>>
>> Hi,
>>
>> I noticed that a cross-compiler produces an unusable libstdc++.so
>> that contains an unresolved reference to aligned_alloc instead of
>> posix_memalign, or whatever is actually available.
>>
>> Therefore it is impossible to link any C++ programs against the
>> libstdc++.so that comes with the cross-compiler.
>>
>> That happens for instance in the following configuration:
>> --target=arm-linux-gnueabihf.
>>
>
> How could this be unnoticed so far?


 I did wonder that.

 The newlib config is hardcoded, which probably covers a lot of the
 cross builds in regular use.

>>> The config mentioned by Bernd (arm-linux-gnueabihf) does not use newlib.
>>> I checked my libstdc++.log files, there's no -static option in use, I
>>> don't
>>> use --disable-shared, so I'm not sure why there's a problem?
>>
>> Then you probably have a newer glibc that defines aligned_alloc, and
>> Bernd is using an older one that doesn't define it. Bernd?
>>
>
> Yes.
>
> It is from 2011, glibc-2.15 as it looks like.
>
> I never had any issues with that, because it is supposed to be upward
> compatible with newer glibc, I did update the glibc on the target
> system recently to glibc-2.23, though, and had not noticed any issues,
> before.
>

OK, it makes sense: I'm using glibc-2.20.

>
> Thanks
> Bernd.


Re: [PATCH, libstdc++] Fix detection of posix_memalig for cross-builds

2016-11-30 Thread Bernd Edlinger
On 12/01/16 00:10, Jonathan Wakely wrote:
> On 30/11/16 23:06 +0100, Christophe Lyon wrote:
>> On 30 November 2016 at 22:51, Jonathan Wakely  wrote:
>>> On 30/11/16 22:32 +0100, Christophe Lyon wrote:

 On 30 November 2016 at 20:00, Bernd Edlinger
 
 wrote:
>
> Hi,
>
> I noticed that a cross-compiler produces an unusable libstdc++.so
> that contains an unresolved reference to aligned_alloc instead of
> posix_memalign, or whatever is actually available.
>
> Therefore it is impossible to link any C++ programs against the
> libstdc++.so that comes with the cross-compiler.
>
> That happens for instance in the following configuration:
> --target=arm-linux-gnueabihf.
>

 How could this be unnoticed so far?
>>>
>>>
>>> I did wonder that.
>>>
>>> The newlib config is hardcoded, which probably covers a lot of the
>>> cross builds in regular use.
>>>
>> The config mentioned by Bernd (arm-linux-gnueabihf) does not use newlib.
>> I checked my libstdc++.log files, there's no -static option in use, I
>> don't
>> use --disable-shared, so I'm not sure why there's a problem?
>
> Then you probably have a newer glibc that defines aligned_alloc, and
> Bernd is using an older one that doesn't define it. Bernd?
>

Yes.

It is from 2011, glibc-2.15 as it looks like.

I never had any issues with that, because it is supposed to be upward
compatible with newer glibc, I did update the glibc on the target
system recently to glibc-2.23, though, and had not noticed any issues,
before.


Thanks
Bernd.


Re: [PATCH, libstdc++] Fix detection of posix_memalig for cross-builds

2016-11-30 Thread Jonathan Wakely

On 30/11/16 23:06 +0100, Christophe Lyon wrote:

On 30 November 2016 at 22:51, Jonathan Wakely  wrote:

On 30/11/16 22:32 +0100, Christophe Lyon wrote:


On 30 November 2016 at 20:00, Bernd Edlinger 
wrote:


Hi,

I noticed that a cross-compiler produces an unusable libstdc++.so
that contains an unresolved reference to aligned_alloc instead of
posix_memalign, or whatever is actually available.

Therefore it is impossible to link any C++ programs against the
libstdc++.so that comes with the cross-compiler.

That happens for instance in the following configuration:
--target=arm-linux-gnueabihf.



How could this be unnoticed so far?



I did wonder that.

The newlib config is hardcoded, which probably covers a lot of the
cross builds in regular use.


The config mentioned by Bernd (arm-linux-gnueabihf) does not use newlib.
I checked my libstdc++.log files, there's no -static option in use, I don't
use --disable-shared, so I'm not sure why there's a problem?


Then you probably have a newer glibc that defines aligned_alloc, and
Bernd is using an older one that doesn't define it. Bernd?



Re: [PATCH, libstdc++] Fix detection of posix_memalig for cross-builds

2016-11-30 Thread Christophe Lyon
On 30 November 2016 at 22:51, Jonathan Wakely  wrote:
> On 30/11/16 22:32 +0100, Christophe Lyon wrote:
>>
>> On 30 November 2016 at 20:00, Bernd Edlinger 
>> wrote:
>>>
>>> Hi,
>>>
>>> I noticed that a cross-compiler produces an unusable libstdc++.so
>>> that contains an unresolved reference to aligned_alloc instead of
>>> posix_memalign, or whatever is actually available.
>>>
>>> Therefore it is impossible to link any C++ programs against the
>>> libstdc++.so that comes with the cross-compiler.
>>>
>>> That happens for instance in the following configuration:
>>> --target=arm-linux-gnueabihf.
>>>
>>
>> How could this be unnoticed so far?
>
>
> I did wonder that.
>
> The newlib config is hardcoded, which probably covers a lot of the
> cross builds in regular use.
>
The config mentioned by Bernd (arm-linux-gnueabihf) does not use newlib.
I checked my libstdc++.log files, there's no -static option in use, I don't
use --disable-shared, so I'm not sure why there's a problem?


>
>>> The attached patch adds a link test for the memalign function
>>> and fixes the cross-build for me.
>>>
>>> Is it OK for trunk?
>>>
>>>
>>> Thanks
>>> Bernd.


Re: [PATCH, libstdc++] Fix detection of posix_memalig for cross-builds

2016-11-30 Thread Jonathan Wakely

On 30/11/16 22:32 +0100, Christophe Lyon wrote:

On 30 November 2016 at 20:00, Bernd Edlinger  wrote:

Hi,

I noticed that a cross-compiler produces an unusable libstdc++.so
that contains an unresolved reference to aligned_alloc instead of
posix_memalign, or whatever is actually available.

Therefore it is impossible to link any C++ programs against the
libstdc++.so that comes with the cross-compiler.

That happens for instance in the following configuration:
--target=arm-linux-gnueabihf.



How could this be unnoticed so far?


I did wonder that.

The newlib config is hardcoded, which probably covers a lot of the
cross builds in regular use.


The attached patch adds a link test for the memalign function
and fixes the cross-build for me.

Is it OK for trunk?


Thanks
Bernd.


Re: [PATCH, libstdc++] Fix detection of posix_memalig for cross-builds

2016-11-30 Thread Christophe Lyon
On 30 November 2016 at 20:00, Bernd Edlinger  wrote:
> Hi,
>
> I noticed that a cross-compiler produces an unusable libstdc++.so
> that contains an unresolved reference to aligned_alloc instead of
> posix_memalign, or whatever is actually available.
>
> Therefore it is impossible to link any C++ programs against the
> libstdc++.so that comes with the cross-compiler.
>
> That happens for instance in the following configuration:
> --target=arm-linux-gnueabihf.
>

How could this be unnoticed so far?

> The attached patch adds a link test for the memalign function
> and fixes the cross-build for me.
>
> Is it OK for trunk?
>
>
> Thanks
> Bernd.


Re: [PATCH, libstdc++] Fix detection of posix_memalig for cross-builds

2016-11-30 Thread Jonathan Wakely

On 30/11/16 19:00 +, Bernd Edlinger wrote:

Hi,

I noticed that a cross-compiler produces an unusable libstdc++.so
that contains an unresolved reference to aligned_alloc instead of
posix_memalign, or whatever is actually available.

Therefore it is impossible to link any C++ programs against the
libstdc++.so that comes with the cross-compiler.

That happens for instance in the following configuration:
--target=arm-linux-gnueabihf.

The attached patch adds a link test for the memalign function
and fixes the cross-build for me.

Is it OK for trunk?


OK.

Presumably we should have this for other cross targets too.