gcc on uml?

Help
vacha
2006-10-22
2013-06-03
  • vacha

    vacha - 2006-10-22

    Hi

    I am a newbie to uml. I got uml(kernel2.6.17.13 with patch and port helper) up and running, but I cant seem to be able to do much with it.

    How do I get gcc to run on user mode linux?

    I read somewhere that one can download tgz packages from slackware for binutils and gcc, and then install them using installpkg. I tried mounting the hostfs and doing installpkg but bash does not recognise that commaned.

    please help.
    vacha

     
    • ptb

      ptb - 2006-10-22

      Unfortunately, your question doesn't really make sense as stated, so I'll have to assume you meant to say something else ... maybe, how do you INSTALL gcc on a UML instance?

      Well, the same way you install on anything. UML is just a kernel. You set up the rest of the operating system as normal. If you want to run a debian or slackware or RH installation on top of the UML kernel, you do that. Maybe you should tell us what stage of installation of your UML-based system you are at?

      Have you gone through the instructions in the README, or elsewhere? I seem to remember that there were some HOWTOs and FAQs around.

      Maybe your question is directed at setting up a minimal system to for your UML kernel to boot you into? But surely you would have said something else ... so I'll assume you have a minimal UML-based system up and running. So what is it? Debian? RH? Slack? Whatever it is, use that distro's package installation method.

      Really, you need to tell us more about where you are at the present moment, so people can guess what you may be seeing and reacting to.

       
      • vacha

        vacha - 2006-10-23

        sorry. I guess I need to be more specific.

        I took a linux-2.6.17.13 kernel from kernel.org, applied the uml patch to it, compiled the kernel with um options. I compiled the port helper and put its binary in the required path.The kernel was up and running.

        Now, I need to get gcc running on that kernel. I tried mounting the host and appended the host path
        to the PATH variable of uml to see if I could run gcc that way, but it said something like

        gcc: /lib/libc.so.6: version 'GLIBC_2.3' not found.

        I also tried grabbing binutils and gcc from slackware and doing a installpkg on them from uml.
        it said installpkg: command not found.

        Vacha

         
        • ptb

          ptb - 2006-10-23

          Woah! You're skipping. After you have compiled a UML kernel you need to prepare a file system for it. That can be a normal distro (e.g. debian or slak) image. You don't need anything else. It will include, among other things, gcc - and the kitchen sink.

          The UML web pages contain pre-cooked mini file system images as I recall, so you don't need to bake the things for yourself. Use those instead.

          I remember making small (4MB) file system images which contained very few thngs indeed and which terminated their init scripts by doing a mount of a hostfs (the host computers file system, or some subpart of it). When root or anyone else logged in to the running UML instance, the /etc/bashrc or similar did a chroot to the hostfs mount in the instance, so everyone saw the host fs.

          You want to use the preprepared FS images, I think.

          When you are able to log in and out of a UML kernel + mini file system, then's the time to
          think of installing more stuff on it.

          So, tell us where you are now in this picture. Are you able to log in to your uml system? When you boot the kernel it should run the /sbin/init executable in the file system you passed as root=whatever to the kernel, or else whatever you named with init=whateverelse. It's a good idea to make that a script which calls a statically compiled zsh or bash for interpretation.

          Anyway, the error you got says simply that you have tried to run a gcc that is not compiled against the glibc that you have provided. So go away and provide the right glibc for your gcc binary, or else go get a gcc binary that is compiled for your installed glibc.

          Which glibc do you have in the UML instance? And what gcc binary have you tried to impose on the poor thing?

           
          • vacha

            vacha - 2006-10-24

            first of all, thanks for being so patient with me..

            I will begin at the beginning again...

            I got a linux-2.6.17.13 kernel applied the uml patch to it,took a Debian-3.0r2.ext2 file system with it, I compiled the kernel, got the uml running.Then I installed the port helper. But when in uml, I write "gcc", I find that it says:

            gcc:command not found

            so I assumed that I needed to install gcc.Would gcc be already there in the filesystem?How do I get it running?

            vacha

             
            • ptb

              ptb - 2006-10-24

              I'm not quite sure what you mean by "took a Debian ... file system with it". Might you mean that you have a debian system installed on a ext3 file system, and you pointed your uml kernel to it as its root file system?

              Can you show the uml boot line, please to make sure we understand you exactly?

              Assuming you did that, and that you were able to log in to the resulting
              uml system (how? Did you start some xterms as uml login terminals?), then whether gcc is "there" or not is a fact that you should ascertain by looking and seeing. It either will be present, or it won't be, and there's no two ways about it as it's your choice as to whether to put it there or not, I'm afraid. It will be listed in the debian manifest if you did put it there (and have forgotten, or did not notice), visble through dpkg or whatever you use as a package manager (dpkg -l gcc, or dpkg -S gcc, inside the running uml instance) or simply via ls and locate .. ls /usr/bin | grep gcc, or locate gcc (after an updatedb, clearly).

              If it is not there, and it doesn't sound as though it is (though maybe you just forgot to set your PATH variable correctly? Did you?), and you are sure it is not there because you looked and saw it not to be there, then you can install a gcc, just as on any system. You should use a debian gcc package targeted at your platform. It sounds as though the platform inside your uml instance is not a glibc 2.3 based one (but you will know, and you can see, by checking the contents of /lib) and that you have tried to run a binary that expects glibc 2.3. You should therefore install instead a binary compiled against the platform you have installed (which is what? glibc 2.2 based, or glibc 2.1? I can't believe that!) or you should add the libraries that your binary uses to your system somewhere, but be careful .. you should add a new glibc
              only in a directory of its own and use LD_LIBRARY_PATH to point your rogue gcc binary to that directory, when and only when you run that gcc, as an inline directive for the command (LD_LIBRARY_PATH=/lib/priv/: gcc").

              But really it would be a better idea to install the gcc binary that matches your platform.Maybe you could tell us what the platform is inside your uml instance (what glibc, what debian, if it is a debian, what processor, etc.) and we could point you to a binary package.

               

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks