Re: [lfs-support] glibc compilation error (in chroo environmentt)

2017-07-22 Thread Michael Shell
On Fri, 21 Jul 2017 08:46:35 +0200
Pierre Labastie  wrote:

> I'd say it is enough to remove the "build" directory. But if you keep
> the "build" directory, i'd say you are calling for trouble.


   Pierre,

You are right, after all, being able to keep the source tree pristine
is main incentive to use a build directory.

> However, GCC source is written in C++, so GCC needs libstdc++.
.
.
> The compiler *code* does not use threads (because it was generated by
> GCC pass 1, which has no thread capabilities, but the compiler *can*
> generate code using threads.

That mostly clears it up for me. Although I would say it as "The gcc
*executable* does not use threads ...". (FWIW, several times I caught
myself saying it the exact same way you did in what I wrote below.)

So, gcc pass 1 is linked against the host's libstdc++; and the purpose
of pass 2 is simply so that the new binutils and gcc are linked against
the new glibc and libstdc++.

And at the end of the GCC stage 2 build, a new gcc and a libstdc++ are
created and installed; and when this new libstdc++ is created and installed
as part of the gcc build process, it will overwrite the (nonthreaded) one
installed in section 5.8 and then both gcc and libstdc++ will support
threads (internally, as well as externally as compiled output). 

So, even though gcc pass 2 was *compiled* against a libstdc++ that did not
support threads (as that was built with gcc pass1), it still will be able
to use threads when it (gcc pass 2) is actually run, right?


Doesn't this have ramifications for upgrading gcc? For example, instead
of merely compiling and installing a new gcc, we should first upgrade
libstdc++ by itself as in section 5.8 (but with the \usr --prefix and maybe
even with thread support) and then compile and install the new gcc.
Otherwise, the new gcc will remain linked against the old libstdc++ even
though the gcc build also installs a new libstdc++, right?

It seems to me that libstdc++ should now be separated from gcc just like
glibc is.

> That's why libstdcc++ compilation for pass1 is deferred to after glibc
> build. But note that the just built glibc *has* all the libraries for
> thread support. It is only GCC pass1 that does not have the ability to
> generate code supporting threads, so that --disable-threads needs to
> be passed to libstdc++ pass 1.

OK, but this suggests there is a mistake in the LFS book. Specifically
in the libstdc++ step:

http://www.linuxfromscratch.org/lfs/view/development/chapter05/gcc-libstdc++.html

" --disable-libstdcxx-threads
  Since we have not yet built the C threads library, the C++ one cannot
  be built either.
"
  
  
This is wrong, right? As you note above the reason we have to disable threads
for libstdc++ is because gcc (pass 1) cannot yet output C++ executables or
libraries that utilize threads. glibc (either from the host system or that
installed in section 5.7), however, *does* already have thread support.

From the GCC configure manual:

https://gcc.gnu.org/install/configure.html

"--enable-threads
Specify that the target supports threads. This affects the Objective-C
compiler and runtime library, and exception handling for other languages
like C++."

So, only libstdc++ or other C++/Objective-C code that is to be compiled by
gcc is affected by a gcc configured with --disable-threads. The option does
not affect gcc's ability with regard to compiling threaded C code.


  Cheers and thanks,
  
  Mike

-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] glibc compilation error (in chroo environmentt)

2017-07-20 Thread Michael Shell
On Thu, 20 Jul 2017 18:48:20 -0400
"Isaac D. Cohen"  wrote:

> But then I decided to try, just to make sure, and redo the second pass
> of gcc with --enable-threads. After doing that I redid the compilation of
> glibc and got the same error. So that doesn't seem to be the problem.


  Isaac,

That first URL:

https://www.mail-archive.com/gcc@gcc.gnu.org/msg81240.html

gives a test program for gcc's threads ability.

Create a file, thread.cc, which contains


#include 
int main(int, char **){
std::thread tt;
}


and then try compiling it with:

g++ -std=c++11 thread.cc -lpthread -o x

which should work without error and produce the executable "x".

If that fails, then your gcc (or should I say, libstdc++) does not have
the proper thread support.

I note that in section 5.8 for Libstdc++-7.1.0 there is:

 "--disable-libstdcxx-threads
Since we have not yet built the C threads library, the C++
one cannot be built either."

Also, note the "--with-gxx-include-dir"

This initial version of libstdc++ will/must be overwritten later by
a full version from gcc. If that does not happen and your gcc is
still using this earlier limited version of libstdc++, then it will
not have thread support from the libstdc++ library no matter how
gcc itself was configured and compiled.

And watch out that in GCC pass 2 you started with a fresh unpacking
of the gcc tarball. (We have to do this, right?) After all, in the
Libstdc++-7.1.0 a ../libstdc++-v3/configure --disable-libstdcxx-threads
had been done in the pass 1 tarball's libstdc++-v3 subdirectory. Does
anyone know if those libstdc++ configure settings will remain or be
properly overridden if gcc's main directory configure is run - e.g.,
what if the LFS builder attempts to start gcc pass 2 with the existing
unpacked gcc tar ball from pass 1?


A question I now have is: At what point in the build process can
the LFS system (i.e., gcc) be expected to be able to compile the
thread.cc test above?

Is it after GCC-7.1.0 Pass 2, or is it only after the final build
of GCC?

If the former is true, then how can GCC-7.1.0 Pass 2 have thread
support when Glibc-2.25+adc7e06 has not yet been rebuilt (since
just after Pass 1, and libstdc++ could not be enabled with thread
support under that glibc)? And if the latter is true, how can the
final build of glibc be expected to pass make check if doing so
requires thread support in gcc/libstdc++ ?


  Cheers,

  Mike




-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] glibc compilation error (in chroo environmentt)

2017-07-20 Thread Bruce Dubbs

Ken Moffat wrote:


Unless anyone has any easier suggestions, I'm going to suggest that
you start over.  If your lfs user still has the command history,
look at that before you restart, in case anything now jumps out and
says "whoops!".

For a restart, save all the sources and patches so that you don't
need to download them again. Then make a new filesystem for
/mnt/lfs.  If your distro insists on mounting the new filesystem
under /media, then get a root shell (you need that anyway during the
build, even on ubuntu which hates letting users get root shells) and
bind it to /mnt/lfs (mount --bind : man mount).


I agree with Ken.  Start over and follow the book closely.  If needed, 
install sudo on the host to help doing those commands that require root. 
We can help with the configuration if needed, but you should also be able 
to do everything needed with su.


If your distro is not cooperating, we can help overcome those issues.

One thing to keep in mind is that for testing we have automated extraction 
of the commands from the book.  The instructions in the book work without 
modification.  When you start changing things, you are likely to run into 
problems as documented in your requests for help.


  -- Bruce



--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] glibc compilation error (in chroo environmentt)

2017-07-20 Thread Ken Moffat
On Thu, Jul 20, 2017 at 06:48:20PM -0400, Isaac D. Cohen wrote:
> 
> But then I decided to try, just to make sure, and redo the second pass
> of gcc with --enable-threads. After doing that I redid the compilation of
> glibc and got the same error. So that doesn't seem to be the problem.
> 

That error is not at all common in LFS, so maybe nobody knows the
answer.

I think you said that gcc wasn't working when you went into chroot, so
you rebuilt pass2 binutils and gcc.  That destroyed any evidence
that might have been available (you didn't mention the error
message, or whatever led you to realise it wasn't working).  Your
current problems suggest that maybe there were other errors - my
first guess was that g++ had not been built correctly, but that is
just a guess.

Unless anyone has any easier suggestions, I'm going to suggest that
you start over.  If your lfs user still has the command history,
look at that before you restart, in case anything now jumps out and
says "whoops!".

For a restart, save all the sources and patches so that you don't
need to download them again. Then make a new filesystem for
/mnt/lfs.  If your distro insists on mounting the new filesystem
under /media, then get a root shell (you need that anyway during the
build, even on ubuntu which hates letting users get root shells) and
bind it to /mnt/lfs (mount --bind : man mount).

Then rerun the stuff to setup the environment, including any checks.

For the build, please remember that you need clean source for each
package, so remove the extracted directories when you move on to the
next package (particularly binutils and gcc, but also relevant for
all packages in chapter 6 that were also built in chapter 5).

And I hope your next attempt is successful.

ĸen
-- 
I live in a city. I know sparrows from starlings.  After that
everything is a duck as far as I'm concerned.  -- Monstrous Regiment
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] glibc compilation error (in chroo environmentt)

2017-07-20 Thread Isaac D. Cohen
On Tue, 18 Jul 2017 21:12:41 -0400
"Isaac D. Cohen" icohen2...@zoho.com wrote:

 make check. It compiled a little and then got stuck on this:
 
 tst-thread_local1.cc: In lambda function:
 tst-thread_local1.cc:172:7: error: 'thread' is not a member of 'std'

 On Wed, 19 Jul 2017 23:29:15 -0400 Michael 
Shellli...@michaelshell.org wrote  

  Isaac,

  A google search found this:

https://www.mail-archive.com/gcc@gcc.gnu.org/msg81240.html
https://www.mail-archive.com/gcc@gcc.gnu.org/msg81257.html

  "Yes, I finally realized I had built a GCC with '--enable-threads=no'
  and was using that GCC to build GLIBC. Once I rebuilt GCC with threads
  I could build GLIBC and not get this error."

  In the book, the first pass of gcc is built without thread support, but
  thread support should be enabled for the second pass (5.10.1).


Hi Michael,

I looked up the command I used to configure gcc on the second pass
(or perhaps the third as I redid the second pass to make gcc work in the
chroot environment) and it exactly matched the command in the book.
(I looked it up using the command gcc -v.) That is, it didn't use
--disable-threads. However, it didn't use --enable-threads either (the book
didn't say to).

But then I decided to try, just to make sure, and redo the second pass
of gcc with --enable-threads. After doing that I redid the compilation of
glibc and got the same error. So that doesn't seem to be the problem.




Thank you very much,
Isaac D. Cohen

-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] glibc compilation error (in chroo environmentt)

2017-07-19 Thread Michael Shell
On Tue, 18 Jul 2017 21:12:41 -0400
"Isaac D. Cohen"  wrote:

> make check. It compiled a little and then got stuck on this:
> 
> tst-thread_local1.cc: In lambda function:
> tst-thread_local1.cc:172:7: error: 'thread' is not a member of 'std'


  Isaac,

A google search found this:

https://www.mail-archive.com/gcc@gcc.gnu.org/msg81240.html
https://www.mail-archive.com/gcc@gcc.gnu.org/msg81257.html

 "Yes, I finally realized I had built a GCC with '--enable-threads=no'
  and was using that GCC to build GLIBC. Once I rebuilt GCC with threads
  I could build GLIBC and not get this error."


In the book, the first pass of gcc is built without thread support, but
thread support should be enabled for the second pass (5.10.1).



  Cheers,

  Mike Shell
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


[lfs-support] glibc compilation error (in chroo environmentt)

2017-07-18 Thread Isaac D. Cohen
Hi,


I'm now up to section 6.9 where glibc is built in the chroot environment.
I put in the patch, configured the package and ran make followed by
make check. It compiled a little and then got stuck on this:

tst-thread_local1.cc: In lambda function:
tst-thread_local1.cc:172:7: error: 'thread' is not a member of 'std'
   std::thread thr{[func] {func (nullptr);}};
   ^~~
tst-thread_local1.cc:173:7: error: 'thr' was not declared in this scope
   thr.join ();
   ^~~
make[2]: *** [../o-iterator.mk:9: 
/Source_Code/build-glibc2/nptl/tst-thread_local1.o] Error 1
make[2]: Leaving directory '/Source_Code/glibc-2.25/nptl'
make[1]: *** [Makefile:215: nptl/tests] Error 2
make[1]: Leaving directory '/Source_Code/glibc-2.25'
make: *** [Makefile:9: check] Error 2

Everything in the chroot environment seems to be set up correctly.
When I first got into the chroot environment gcc wasn't working. So I
went back and redid the second pass of binutils and gcc. Now
everything seems to work. What can be causing this error?

Thank you very much,
Isaac D. Cohen

-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style