LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-15-2024, 05:05 PM   #1
EmDeeTee
LQ Newbie
 
Registered: Apr 2023
Distribution: Gentoo
Posts: 9

Rep: Reputation: 0
Unhappy Moving Linux From Scratch


Hi, I was using my Linux from scratch inside a virtual machine, but recently I wanted to copy it to a laptop.

So I packed the whole thing, installed it and it seems to work fine. It boots up, Xorg works, and programs open as they should but... I wanted to compile some new software (Wireless Tools 29). So I downloaded the source code and executed `make` gcc errored out saying that `if` is an illegal instruction.

So I created a tiny test file, compiled it and executed it.
Code:
#include <stdio.h>

int main(void) {
   if (1==1) {
      printf("Hello\n");
   }
}
It compiled compiled and gave me the expected output.

I wanted to test further. I downloaded the source code of nano-7.2 and tried to run `./configure`.

It gave no output and seemed to be running in an infinite loop.

My LFS system was compiled for a generic x86_64 system and my laptop meets this requirement

Does anybody have a clue on what's going on?

EDIT: I just discovered, that compiling using clang is fine. The program compiles and runs. But `GCC` and `./configure` are still not working

Last edited by EmDeeTee; 02-15-2024 at 06:21 PM. Reason: New info on the topic
 
Old 02-16-2024, 05:15 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,302

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
There's not half enough detail there. Phrases like "packed up" "seems to" "not working" and similar hide the information we need to be useful. Your query tells us you have problems, but nothing else.

IME, it's quicker to recompile LFS than to try and sort this sort of a mess out. Quicker again to install a distro.
 
Old 02-16-2024, 05:31 AM   #3
EmDeeTee
LQ Newbie
 
Registered: Apr 2023
Distribution: Gentoo
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by business_kid View Post
There's not half enough detail there. Phrases like "packed up" "seems to" "not working" and similar hide the information we need to be useful. Your query tells us you have problems, but nothing else.

IME, it's quicker to recompile LFS than to try and sort this sort of a mess out. Quicker again to install a distro.
Hi, thanks for your response.

I used `tar cvpf` to pack the system. and xz to compress it. And I used `tar xpf` to unpack it.

I ran a few programs, like X server, Xterm PCmanFM and Thunar, bash etc. By "seems to work fine" I meant that they work as expected and there aren't any errors like some instructions not being supported on the platform. I made sure that this is not the case by using GCC with `-march-x86-64`, as I understand, this means a generic 64-bit processor.

Up to now, I have been using this LFS system inside VirtualBox, but I first built it on my PC and moved it to the VM. Today I took the same tarball I used on the laptop and installed it in a brand new VM. Configure scripts and GCC compiles the programs it couldn't on the laptop.

I don't want to rebuild the system or use a distro, because I'm not using this system as a daily driver or anything. It's just a hobby of mine so it doesn't make sense to abandon it.

Sorry for the lack of information, but I don't know what else to tell you.

If you have any further questions I'm happy to answer and possibly get some insight into this problem

EDIT: The problem I'm facing with configure scripts is that they don't give any output whatsoever. No error. No nothing. I run the script, and the only thing I see it it using the laptop's CPU

Last edited by EmDeeTee; 02-16-2024 at 05:34 AM. Reason: Infor about configure
 
Old 02-16-2024, 12:09 PM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,302

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Quote:
Originally Posted by EmDeeTee
Configure scripts and GCC compiles the programs it couldn't on the laptop.
Post the errors. Nobody can help you without diagnostic information. It's like going to a doctor and saying: "I don't feel well..."
 
Old 02-16-2024, 12:47 PM   #5
EmDeeTee
LQ Newbie
 
Registered: Apr 2023
Distribution: Gentoo
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by business_kid View Post
Post the errors. Nobody can help you without diagnostic information. It's like going to a doctor and saying: "I don't feel well..."
I can't show you the errors if I don't have any output. When I download the source code of any program and I try to run `./configure` it doesn't create any .log file or give any output whatsoever
 
Old 02-17-2024, 11:46 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,302

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Quote:
Originally Posted by EmDeeTee View Post
I can't show you the errors if I don't have any output. When I download the source code of any program and I try to run `./configure` it doesn't create any .log file or give any output whatsoever
Does the source code even have a configure script? You never told us what you're building either, so we don't know! You downloaded SOME source code, I presume.Tell us what it is, first of all. Change into the source top directory. Then post the output of
Code:
ls -lha
 
Old 02-17-2024, 01:37 PM   #7
EmDeeTee
LQ Newbie
 
Registered: Apr 2023
Distribution: Gentoo
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by business_kid View Post
Does the source code even have a configure script? You never told us what you're building either, so we don't know! You downloaded SOME source code, I presume.Tell us what it is, first of all. Change into the source top directory. Then post the output of
Code:
ls -lha
Hello! Thanks for your response.

I was trying to build nano-7.2.

But at the time of writing this, the problem is resolved. I fixed it.

Turns out there were two libraries that, unlike I thought weren't compiled for a generic x86-64 processor. GMP and libffi. After noticing this, I recompiled (inside my VM) GMP using the following command:
Code:
./configure --prefix=/usr    \
            --enable-cxx     \
            --disable-static \
            --docdir=/usr/share/doc/gmp-6.3.0 \ 
            --host=none-linux-gnu
and recompiled libffi with:
Code:
./configure --prefix=/usr          \
            --disable-static       \
            --with-gcc-arch=x86-64
But this didn't work. After further research on this problem, I tried to compile GMP again. The same configuration but this time with -O0, instead of the default -O2. For good measure, I also recompiled libmpc and libmpfr (both use libgmp). I don't think this was necessary, since all libraries are shared, so if libmpc and mpfr depend on libgmp, they should be fine even when I don't recompile them, right?

anyway...

This did work, and the configure script that came with nano-7.2 started working. It produced a Makefile that I was able to run using `make` and finally, I was able to run the nano executable. But now I wonder... if setting the `--host=none-linux-gnu` for libmpfr didn't work and I had to set -O0, isn't that a ducktape solution? I don't really know where all of this came from.

So as far as I understand, this is what happened.
When I was first building my LFS I was doing it on my PC with Intel i5-6400. All packages were built with no platform specific optimisations but I overlooked two libraries (libgmp and libffi). Those libraries use the `native` setting of GCC by default if none are provided. So now, when I moved to the laptop (Dual Core T3200), everything else was working fine, since it was compiled for a generic 64-bit CPU.

I noticed my mistake, recompiled those libraries with but it didn't work. I also had to set -O0 in libgmp
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ali aladdin v agp stinks :scratch: :scratch: :scratch: Mr Marmmalade Linux - Hardware 1 07-08-2003 05:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration