LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   BLFS 7.7, Segmentation fault (core dumped) when trying to compile a package (https://www.linuxquestions.org/questions/linux-from-scratch-13/blfs-7-7-segmentation-fault-core-dumped-when-trying-to-compile-a-package-4175539366/)

thinkrorbot 04-10-2015 06:51 PM

BLFS 7.7, Segmentation fault (core dumped) when trying to compile a package
 
Hello all,

How do I compile a package using make in a chroot environment without the segmentation fault error popping up?

For example, in the BLFS botscripts package, I can't install random using make. It comes up with the error message "Segmentation fault(core dumped)". Instead, I have to reboot into LFS to install it. The same thing happens in the other packages I tried such as emacs and openssl.

I mounted /dev/sda11 to /mnt/lfs and /dev/sda12 to /mnt/lfs/boot and when into the chroot environment using the following commands:
Code:

chroot "$LFS" /usr/bin/env -i              \
    HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
    PATH=/bin:/usr/bin:/sbin:/usr/sbin    \
    /bin/bash --login

How do I compile packages in a chroot environment?

Thanks

moonfrog 04-10-2015 08:08 PM

I always run through "Ch 6.2. Preparing Virtual Kernel File Systems" before chrooting.

my chroot looks like:

Code:

Hopeless formatting...see post 7

thinkrorbot 04-11-2015 02:18 AM

Thanks for the reply,

Your instructions simply opened up xterm for me logged in as root. I tried to mount those directories and use the chroot instructions in lfs 6.73 but it ended up with the same result.

veerain 04-11-2015 02:27 AM

Segmentation fault may be arising because of kernel/glibc/software incompatibilities. Which kernel version support you used during glibc build. Is the version used newer than host kernel?

thinkrorbot 04-11-2015 04:39 PM

I have Kernel version 3.19 and used --enable-kernel=2.6.32 to configure Glibc as the instructions state.

thinkrorbot 04-11-2015 05:00 PM

I got it working using moonfrog's commands but instead of mount -v --bind /dev dev, use mount -v --bind /dev $LFS/dev

moonfrog 04-11-2015 05:15 PM

The formatting in my commands up there are F'ed...can't be run as is
I've tried 4 times to edit them but it only tries to make it worse

I'll try again here, this would be for chrooting w/o being on the build host:


mount /mnt/lfs
cd /mnt/lfs

mkdir -pv {dev,proc,sys,run}
mount -v --bind /dev dev
mount -vt devpts devpts dev/pts -o gid=5,mode=620
mount -vt proc proc proc
mount -vt sysfs sysfs sys
mount -vt tmpfs tmpfs run

if [ -h dev/shm ]; then
mkdir -pv $(readlink dev/shm)
fi

chroot . /usr/bin/env -i \
HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/bin/bash --login
source /etc/profile
export PS1="(lfs-chroot) $PS1"

Keith Hedger 04-12-2015 07:17 AM

Quote:

Originally Posted by moonfrog (Post 5345988)
...
export PS1="(lfs-chroot) $PS1"

I never think to set PS1 when I chroot just as a check that I know where I am, added to my chroot script.


All times are GMT -5. The time now is 04:24 PM.