LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Can't compile libstdc++-v3 in LFS 7.10 (https://www.linuxquestions.org/questions/linux-from-scratch-13/can%27t-compile-libstdc-v3-in-lfs-7-10-a-4175593408/)

bsmith52 11-12-2016 06:19 PM

Can't compile libstdc++-v3 in LFS 7.10
 
Hello! I'm an old computer programmer, but new linux noob (see my intro page).

My problem: I am attempting to run LFS 7.10. I have installed through the glibc-2.24. I got the expected compile error. When I to the next package (libstdc++-v3), I was unable to execute the ../libstdc__v3/configure command(why?). I was able to get around it with replacing it with /mnt/lfs/sources/gcc-6.2.0/libstdc++-v3/configure. It ran, but not without a few compile errors (as I found out later). binnutils-2.27 seemed to work. Then gcc-6.2.0(Pass 2) failed. I have tried to rerun libstdc++-v3 without errors, but without success.

The first error that I could see while compiling the libstdc++-v3 was:

Code:

/mnt/lfs/sources/gcc-6.2.0/libstdc++-v3/src/c++98/strstream.cc: In member function 'void std::strstreambuf::_M_setup(char*, char*, std::streamsize)':
/mnt/lfs/sources/gcc-6.2.0/libstdc++-v3/src/c++98/strstream.cc:324:63: error: 'INT_MAX' was not declared in this scope
  size_t N = n > 0 ? size_t(n) : n == 0 ? strlen(get) : size_t(INT_MAX);
                                                              ^~~~~~~
Makefile:813: recipe for target 'strstream.lo' failed
make[3]: *** [strstream.lo] Error 1
make[3]: Leaving directory '/mnt/lfs/sources/gcc-6.2.0/libstdc++-v3/build/src/c++98'
Making all in c++11

My configuration: I loaded a debian jesse (7.8, not updated) onto my laptop. I have the following packages installed:

Recommended Package Installed Package
Bash-3.2 bash-3.2
Binutils-2.17 (Versions greater than 2.27 are not recommended as they have not been tested) binutils-2.25
Bison-2.3 bison-2.3
Bzip2-1.0.4 bzip2-1.0.6
Coreutils-6.9 coreutils-8.23
Diffutils-2.8.1 fiffutils-3.3
Findutils-4.2.31 findutils-4.4.2
Gawk-4.0.1 (/usr/bin/awk should be a link to gawk) (/usr/bin/awk points to /usr/bin/gawk)
GCC-4.7 GCC-4.9.2
Glibc-2.11 (Versions greater than 2.24 are not recommended as they have not been tested) glibc-2.19
Grep-2.5.1a grep-2.20
Gzip-1.3.12 gzip-1.6
Linux Kernel-2.6.32 linux kernel-3.16.0-4
M4-1.4.10 m4-1.4.17
Make-3.81 make-4.0
Patch-2.5.4 patch-2.7.5
Perl-5.8.8 perl-5.20.2
Sed-4.1.5 sed-4.2.2
Tar-1.22 tar-1.27.1
Texinfo-4.7 makeinfo-5.2

Question: What do I do now? Since it was a gcc error, do I need to revert back from gcc-4.9 back to gcc-4.7? I tried to do this, but was unable to figure out how.

Thanks for your patience with this old noob!

spiky0011 11-13-2016 02:22 AM

Whats the output of on host

Code:

g++ --version | head -n1

bsmith52 11-13-2016 09:03 PM

Just got back from a full day at church.

I realize that I gave you an incomplete version for my g++ (4.9). The exact version is:

g++ (Debian 4.9.2-10) 4.9.2

If I need to go back to a 4.7 version, I need help. I looked, and was unable to find a tarball to compile from that was older than the 4.9.2 version that I had. I suppose that I could build my own dependency tree and install .deb files. But that would take a lot of time. There must be a better way and/or a location for a 4.7 g++ tarball that I was unable to locate.

As an alternative, I could install Slackware. I understand that the implementation of LFS is easier from this linux distro (though I have never tried it).

Be aware also that I have never run the apt-get update for Debian 7.8. I usually use Ubuntu, and never got around setting up the sources.list file (not required in Ubuntu).

Thanks again for your help.

Best regards,
Bill

hendrickxm 11-14-2016 01:14 PM

Make sure /bin/sh points to bash when using debian.
A safe bet would be to use a livecd of calculate linus for example.
I prefer this one, never failed me.
http://miroir.linuxtricks.fr/calculate/release/15.17/
CLDX is the XFCE desktop live cd.

bsmith52 11-14-2016 02:05 PM

I've learned a bit since I started attempting to install Linux From Scratch. The following are 2 terminal commands that will print out the link used by a command (assuming that you know that the system looks at "/bin/sh" for bash)

Code:

root@black:/home/bill# MYSH=$(readlink -f /bin/sh)
root@black:/home/bill# echo "/bin/sh -> $MYSH"
/bin/sh -> /bin/dash

It appears that Debian likes to use a more efficient version of bash, called dash

To change it, run:

dpkg-reconfigure dash

Now rerun the above shell commands:

Code:

root@black:/home/bill# MYSH=$(readlink -f /bin/sh)
root@black:/home/bill# echo "/bin/sh -> $MYSH"
/bin/sh -> /bin/bash

However, I like to know:
1. What .iso do I need to download to get the software you described?
2. What is the purpose of this software (besides showing what is actually being executed when one enters a command)?

It was under "LinuxTricks", so that appears to be something that I could use!

Merci and bonjour

Best regards,
Bill

hendrickxm 11-14-2016 02:18 PM

Quote:

Originally Posted by bsmith52 (Post 5630521)
It appears that Debian likes to use a more efficient version of bash, called dash

To change it, run:

dpkg-reconfigure dash

Now rerun the above shell commands:

Code:

root@black:/home/bill# MYSH=$(readlink -f /bin/sh)
root@black:/home/bill# echo "/bin/sh -> $MYSH"
/bin/sh -> /bin/bash

However, I like to know:
1. What .iso do I need to download to get the software you described?
2. What is the purpose of this software (besides showing what is actually being executed when one enters a command)?

It was under "LinuxTricks", so that appears to be something that I could use!

Merci and bonjour

Best regards,
Bill

Well, if you fixed /bin/sh to link to /bin/bash I don't see why you could not use your debian host.

The iso you need, if any, depends on your architecture. If you have a 64-bit capable system, you can use both 64bit or i686. I myself, prefer to use i686, even on 64-bit machines.
CLDX is the XFCE version, CLD is KDE and CLDM is Mate.
I prefer XFCE or Mate, but you can pick any.
The iso needs to be written to a dvd and booted. After you boot the livedvd, you will be able to run all commands to build LFS inside on a live host.
Open a terminal and run
Code:

sudo su
to run all following commands as root in that terminal.

bsmith52 11-14-2016 11:05 PM

Thanks to all the responses. But the problem still remains: I can use the system. I just can't get libstdc_v3 to compile.

I have been thinking about the problem. I have found another HD to reinstall Debian 7.8, and restart my build. However, I will not downgrade all the utilities that LFS recommends (I don't know why they recommend binutils-2.17 - it has known issues)- except that I downgraded the bash to 3.2. The problem may to incompatibility between some of the older utility versions (such as bison-2.3) and the current stable version of gcc at Debian 7.8 release time (4.9.2). Hopefully, they can get along with each other, and bash-3.2.

I'll let you know if that solves the problem.

Again, thanks for all your suggestions.

Best regards,
Bill

hendrickxm 11-17-2016 03:55 PM

Well Bill, the versions on Calculate are newer than the minimun required for LFS-7.10.
Debian has more up to date versions than the minimum required too.

When are you starting to get errors? The monent an error occurs early in the build, continuing has no use.

bsmith52 11-17-2016 08:55 PM

The first time that I "noticed" a problem was with the 2nd pass of gcc-6.2.0 - it failed. So I went back to libstdc++v3. It did not compile as per the original post.

I thought that since the my build had "passed" the glibc-2.24 compile failure test. Therefore the problem must be after that (or the libstdc++v3). It compiles, but not without errors. Which is where I am stuck.

Since then, I thought that since it was a compiler install related issue, maybe I should restart the build at the gcc-6.2.0 first pass. I have not pursued that option as yet.

However, I have started the LFS build from a different computer. I have done only the minimum amount of updates (ie. downgrade the bash to 3.2, install bison, and install build-essentials). Since I have already gotten this far, I will continue under the assumption that I installed some older linux libs that are incompatible with the newer ones included in the Debian 7.8 DVD.

I will keep you posted as I make progress (which needs to contend with other priorities in my life)(that is the LFS project, not "progress"!).

Best regards and thanks for your interest,
Bill

bsmith52 12-01-2016 09:31 PM

SOLVED - Can't compile libstdc++-v3 in LFS 7.10
 
I believe that I have resolved my issue with LFS. In the process of redoing all my step on a different HD, I discovered that I excluded the following during the GCC-6.2.0 first pass:

Code:

tar -xf ../mpfr-3.1.4.tar.xz
mv -v mpfr-3.1.4 mpfr
tar -xf ../gmp-6.1.1.tar.xz
mv -v gmp-6.1.1 gmp
tar -xf ../mpc-1.0.3.tar.gz
mv -v mpc-1.0.3 mpc

When I did the Host System Requirements Library-ck.sh, I found that I had none of these libraries (which was OK). I found that they were part of the Debian 7.8 that I was using to build LFS. Somehow my mind thought that it was OK to not include the above libraries in my build. Maybe. in part, due to fact that these had to be downloaded separately.

This is humbling to admit. But I have posted this in the hope that someone else (another "old dog" as myself) could benefit.

Thanks to all who looked at the problem and offered solutions.


All times are GMT -5. The time now is 07:40 AM.