LinuxQuestions.org
Help answer threads with 0 replies.
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 07-15-2016, 04:28 PM   #1
user242
LQ Newbie
 
Registered: Jun 2016
Posts: 13

Rep: Reputation: Disabled
glibc and chroot


Hi,

I'm creating a chroot environment that contains bash. I want to build glibc and "install" it in the chroot folder and then build bash and "install" it in there also.

Since I won't be using the same glibc that is currently on my system, I am wondering if this could cause any problem? Because, when building bash, I will be linking agains the host's glibc and not the chroot's libc. But when executing bash inside the chroot, it will run with the newer glibc from the chroot.

I saw plenty of places that explain how to build a cross-compiler (for the same platform) but I don't want to have to build gcc and binutils if I don't have to.

I'm thinking that either it just doesn't matter if I compile bash against and older libc, or maybe I need to build bash and explicitely instruct the compiler to use the other libc (while I'm out of the chroot of course).

Can anyone advise?
Thank you.
 
Old 07-15-2016, 06:28 PM   #2
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Rep: Reputation: 142Reputation: 142
Quote:
Originally Posted by user242 View Post
Because, when building bash, I will be linking agains the host's glibc and not the chroot's libc.
it shouldn't be linked to host's library (if you building bash inside chroot environment)
 
Old 07-15-2016, 06:47 PM   #3
user242
LQ Newbie
 
Registered: Jun 2016
Posts: 13

Original Poster
Rep: Reputation: Disabled
No, as i said, the chroot only contains bash (and libc). I will be compiling bash out of the chroot. I want to avoid building bash from the chroot because i dont want to install gcc in it
 
Old 07-15-2016, 11:07 PM   #4
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1012Reputation: 1012Reputation: 1012Reputation: 1012Reputation: 1012Reputation: 1012Reputation: 1012Reputation: 1012
You could use bash-static. The everything is statically linked.
 
Old 07-16-2016, 07:06 AM   #5
user242
LQ Newbie
 
Registered: Jun 2016
Posts: 13

Original Poster
Rep: Reputation: Disabled
I'd rather not link everything statically since I might add other things than bash after.

Is there not anyway to build against another glibc while out of the chroot?
 
Old 07-16-2016, 02:56 PM   #6
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,534

Rep: Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622
Quote:
Is there not anyway to build against another glibc while out of the chroot?
i normally use a "config.site" file and first export the build folder path
 
Old 07-17-2016, 11:22 AM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,538
Blog Entries: 4

Rep: Reputation: 3430Reputation: 3430Reputation: 3430Reputation: 3430Reputation: 3430Reputation: 3430Reputation: 3430Reputation: 3430Reputation: 3430Reputation: 3430Reputation: 3430
Quote:
Originally Posted by user242 View Post
I'd rather not link everything statically since I might add other things than bash after.

Is there not anyway to build against another glibc while out of the chroot?
The reason for the "static" suggestion is: "if bash depends on glibc, how's it gonna find (the right) glibc while running in-jail?" You need to be very certain that you have this aspect covered.
 
Old 07-17-2016, 07:11 PM   #8
user242
LQ Newbie
 
Registered: Jun 2016
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sundialsvcs View Post
The reason for the "static" suggestion is: "if bash depends on glibc, how's it gonna find (the right) glibc while running in-jail?" You need to be very certain that you have this aspect covered.
As I said in my first post, I am installing glibc in the chroot. I'm building it outside of the chroot with prefix=path/to/chroot. But I then want to compile bash using that glibc while still being outside of the chroot.

So bash would be able to find it since glibc will have been installed properly in the chroot (and ld.so.cache will have been built also)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
chroot install of arch fails, no mounted / in a chroot. Shadow_7 Arch 2 04-20-2015 05:33 PM
How to run a software based on an old glibc in a chroot jail? jetbright Linux - Software 4 09-22-2012 03:49 AM
Chroot in shell scripts: Ensuring that subsequent commands execute within the chroot Kenny_Strawn Programming 2 05-21-2012 01:25 PM
[SOLVED] in chroot compiled programs do not work in chroot graphit Linux From Scratch 2 04-11-2010 04:04 AM
Glibc testsuit failed in chroot env rangalo Linux From Scratch 7 02-12-2006 12:32 PM

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

All times are GMT -5. The time now is 11:54 PM.

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