LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 09-16-2019, 05:13 PM   #1
CPT-GrayWolf
LQ Newbie
 
Registered: Sep 2019
Location: Colorado USA
Distribution: Fedora
Posts: 14

Rep: Reputation: Disabled
Exclamation (Ch. 6) file-5.37 build can't find zlib libraries


I currently attempting to build LFS version 9.0 with systemd.

I'm in chapter 6, currently trying to build file-5.37, but I'm having an issue and I'm pulling my hair out trying to figure out what's happening.

Everything else has gone (relatively) well so far, but when I attempt to build file I get an error.
Code:
[root@chroot file-5.37]# make
make  all-recursive
make[1]: Entering directory '/sources/file-5.37'
Making all in src
make[2]: Entering directory '/sources/file-5.37/src'
make  all-am
make[3]: Entering directory '/sources/file-5.37/src'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/sources/file-5.37/src'
make[2]: Leaving directory '/sources/file-5.37/src'
Making all in magic
make[2]: Entering directory '/sources/file-5.37/magic'
../src/file -C -m magic
/sources/file-5.37/src/.libs/lt-file: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
make[2]: *** [Makefile:816: magic.mgc] Error 127
make[2]: Leaving directory '/sources/file-5.37/magic'
make[1]: *** [Makefile:399: all-recursive] Error 1
make[1]: Leaving directory '/sources/file-5.37'
make: *** [Makefile:331: all] Error 2
Okay so it can't seem to find libz.so.1.

But...

Code:
[root@chroot file-5.37]# ls /lib/libz.*
/lib/libz.a  /lib/libz.so  /lib/libz.so.1  /lib/libz.so.1.2.11
I have deviated from the book in that I've merged /usr, so /lib is a symlink to /usr/lib, but I've tried creating a copy of /usr/lib at /lib instead with the same result.

I tried recompiling zlib with no change.

Any help is appreciated.
 
Old 09-18-2019, 11:18 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,651
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
It's ld that can't find the library. You should be using the new version of ld, the one originally created as ld-new, which has /lib and /usr/lib in its search path. Are you sure you carried out that adjustment (after installing glibc)? Did you carry out all the sanity checks before proceeding? You might want to carry out the verbose sanity check in 6.10 again and post the results.
 
Old 09-18-2019, 12:17 PM   #3
CPT-GrayWolf
LQ Newbie
 
Registered: Sep 2019
Location: Colorado USA
Distribution: Fedora
Posts: 14

Original Poster
Rep: Reputation: Disabled
I did all the adjustments, and I'm sure of that because I messed up one of the sed commands and had to manually edit a file.

I something else must have gone wrong in that step. What would be the best way to revert back to that step?
 
Old 09-18-2019, 12:34 PM   #4
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,651
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
Can you carry out the check in 6.10 again? Specifically the ld check:
Code:
echo 'int main(){}' > dummy.c
cc dummy.c -v -Wl,--verbose &> dummy.log
grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
The result should be:
Code:
SEARCH_DIR("/usr/lib")
SEARCH_DIR("/lib")
 
Old 09-18-2019, 08:45 PM   #5
CPT-GrayWolf
LQ Newbie
 
Registered: Sep 2019
Location: Colorado USA
Distribution: Fedora
Posts: 14

Original Poster
Rep: Reputation: Disabled
Yeah,
Code:
[root@chroot file-5.37]# echo 'int main(){}' > dummy.c
[root@chroot file-5.37]# cc dummy.c -v -Wl,--verbose &> dummy.log
[root@chroot file-5.37]# grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
SEARCH_DIR("=/tools/x86_64-pc-linux-gnu/lib64")
SEARCH_DIR("/usr/lib")
SEARCH_DIR("/lib")
SEARCH_DIR("=/tools/x86_64-pc-linux-gnu/lib");
That looks right though...

Clearly I mucked something up.
I probably mistyped something during the compilation process.
I've been typing most of the commands by hand as I get a better hold of what's happening that way. But I'm far-sighted and mildly dyslexic, so it's easy to mess up. I'm pretty careful about double checking, but mistakes can still slip through.

I either messed up in the compile, or possibly somewhere else. I am at a loss.
Hopefully I don't have to restart. I'm not far in, but it would still be tedious.
 
Old 09-19-2019, 06:52 AM   #6
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,651
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
Don't type by hand! That's the first thing you learn with LFS. Always copy and paste, especially if you're dyslexic. Even if you aren't it's easy to make mistakes. And it's pointless to turn a Linux build into a test of typing skills.

I'm afraid I can't diagnose your problem any further. The most likely cause of the failure to find zlib would be that ld was still looking in /tools/lib (which doesn't contain a copy) but that seems not to be the case with you. One other possibility is that you forgot to configure ld after building your final final glibc. You could try that now and see if it makes any difference. It's in section 6.9.2.3.

If it's any comfort, the first LFS build usually doesn't work.
 
Old 09-19-2019, 08:31 AM   #7
CPT-GrayWolf
LQ Newbie
 
Registered: Sep 2019
Location: Colorado USA
Distribution: Fedora
Posts: 14

Original Poster
Rep: Reputation: Disabled
Well, I haven't a clue where it went wrong. Guess I'm restarting.
That's annoying. At least I wasn't in chapter 8 or something before finding it went wrong.

I wasn't really typing the commands to practice typing, it was more about paying attention to what they're doing.
If I copy and past every command I have a tendency to only skim over what's happening. By typing it out I'm forced to slow down and look at what the command is doing in more depth. And if I get it wrong, it just shows me that I wasn't looking close enough. XP
I still don't bother with larger, more tedious or more complex commands though. If it's more easily run as a script I'll past it to a script and run that instead.

The second time around I have no problem copying and pasting. And I'll probably start making proper archives of critical files between the larger steps, that way I can revert back to any given point if I do happen to screw up again.

I suspect I can just clear out most of the files that have been created thus far. No need to destroy the directory structure.
I can probably even leave some of the config files in /etc. (Or at least set them aside for later.)
 
Old 09-19-2019, 08:45 AM   #8
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,651
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
Yes, if you are going to start again, you can leave the directory structure and /sources, but I would clear out /tools completely, together with all other directory contents. For /lib, you could get away with just emptying the directory but it would probably be quicker to delete the /usr tree completely and recreate it.

I would also clear out /etc. Saving the config files elsewhere (for example in /root) is a good idea. I tend to copy the /etc files across from one LFS to the next rather than recreating them for each build.

Did you try reconfiguring ld as I suggested. It's a long shot but it might perhaps work.

Another possibility (if you saved your unmodified tool set as suggested in the book) would be to reinstate the saved set in /tools and start again with Chapter 6.
 
Old 09-19-2019, 09:16 AM   #9
CPT-GrayWolf
LQ Newbie
 
Registered: Sep 2019
Location: Colorado USA
Distribution: Fedora
Posts: 14

Original Poster
Rep: Reputation: Disabled
I can't remember it exactly at the moment, but I remember using a find command once to delete everything that isn't a directory. If I can remember how to do that, it may save me some time with rebuilding the /usr directory.

I did try setting the path in the config, but it didn't seem to change anything. Plus I'm pretty sure if I have to manually direct ld at /lib, I probably messed up bad enough that I should retry. XD

I do with I had properly archived /tools before moving on, but I tried to be lazy and in the process forgot that cp doesn't, by default, traverse symlinks.
I'm worried that the problem started back in chapter 5 anyway, so I'll just go back and be sure to do it right. By the end of it I should have a known-good staring point, and an archive of it an case things go wrong again, or I want to build another system.

Edit:
For future reference. If anyone was wondering what the find command is:
Code:
find <dir> -type f -type l -delete
'-type f' selects all regular files and '-type l' selects any links.
If you want more control over what's being deleted you could use '-exec rm -iv {} \;' instead of '-delete'. If you don't want it to prompt you just use 'f' instead of 'i' so that it forces the removal but still shows what was removed.

Last edited by CPT-GrayWolf; 09-21-2019 at 11:05 AM. Reason: Added information on command I couldn't remember at the time.
 
  


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
Unable to build qBittorrent with libtorrent-rasterbar 0.15.2 and zlib 1.2.5 robertjinx Linux - Software 0 08-31-2010 06:49 AM
unable to build compress Zlib sherimm Linux - Software 2 03-02-2009 08:20 AM
no matching comp found: client zlib none, zlib@openssh.com lost connection jorge_ivan Linux - Networking 0 08-14-2006 07:09 PM
LFS-6.1 error in File-4.13, "cannot find zlib.h" Dhaval Motghare Linux From Scratch 1 11-15-2005 05:14 AM
Can't Find zlib rebdi Linux - Newbie 1 09-04-2003 09:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 07:00 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