Re: some problems when build gcc from source

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11 May 2018 at 03:03,  <ytw@xxxxxxxxxxx> wrote:
> I build gcc from source sometime yesterday. Everything seem OK during the build process and I install it in my /home/xxx/opt/   without root.
>
> But when I try to use it to compile my function, an error was told like:
>
>      'aligned_alloc' was not defined in this scope

It's not very useful to tell us you got an error *like* that. You
should tell us the actual error you got. Show us the complete error,
including the file and line it happens on. That way we know if it's
coming from your code, or from GCC's headers, or from somewhere else.


> After some search on the Internet I find it is a new feature in C++11 and may be in 'stdlib.h'.

It's a new feature in C11 and C++14. It's not part of C++11, and it's
not supported by G++ 5.

> I'm quite sure I included this  in my cpp file. and of course get the -std=c++14 option when build my code.
>
> Curiously I searched my /home/xxx/opt directory and find few 'stdlib.h' file but all not contain useful code, there are just some usings. I think it's not right.

It's right.

<stdlib.h> is provided by the C library and GCC does not include a C
library. On GNU/Linux it uses the GNU C Library, which will be already
installed under /usr


> So I am confused that if there are some operations I missed for this or I just didnt use it in appropriate way. and how I get an 'stdlib.h' that contains 'aligned_alloc'.

aligned_alloc was added to version 2.16 of the GNU C Library, releaed
in 2012: https://sourceware.org/ml/libc-alpha/2012-06/msg00807.html

CentOS 6 uses version 2.12 of the GNU C Library, which was released in
2010, so your OS is too old and doesn't support aligned_alloc.

>
>
>
> my info:
>
> centOS 6 (no root privillage)
>
> previous GCC : 4.4.7
>
> target GCC : 5.3.0/5.5.0 (I tried both and get same situation)
>
> I installed gmp mpfr mpc all from source in the same directory above. and no error reported
>
> LD_LIBRARY_PATH and some other path are set too.
>
> It seems my new GCC can be use in some place. I tried to build a python3 from source and get a success.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux