Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Creating a new custom environment shell, inheriting most of bash.

  1. #1
    Join Date
    Oct 2014
    Location
    Switzerland
    Posts
    384

    Default Creating a new custom environment shell, inheriting most of bash.

    Hello,
    There are several proprietary software that I need to use, and many of these depend on gcc 4.8.

    For this reason, there are some systems I "froze" at LEAP 42.3, for personal reason (of completeness), I would like to be able to run these softwares on LEAP 15.0 and higher. There are several issues however mostly the fact that I am unaware which systems functions have a dependency for the default gcc bundled with the kernel and the OS.

    To avoid conflicts or systems failure, I wish to create an environmental shell that inherits everything bash shell with the option of re-routing the bin and library addresses. For example, I'm thinking about setting up say
    Code:
    /usr/custom/lib
    /usr/custom/lib64
    /usr/custom/bin
    /usr/custom/etc
    and put all components of gcc-4.8.5 and when I choose to from bash, enter this customshell, and install/compile/run software from this custom shell.

    Could someone provide some hints and/or help at creating a new environment shell?

    Thank you for your time.
    -SJL

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,194
    Blog Entries
    3

    Default Re: Creating a new custom environment shell, inheriting most of bash.

    I'm not quite sure what you are looking for.

    I have a few 32-bit programs that were compiled back in 2006 (running SuSE 10.1 at that time). And they still work as long as I install "glibc-32bit".

    As far as I know, C++ programs compiled with "gcc" will use libgcc. But most programs using plain C won't really have any dependency on the compiler used. That is to say, they will still work, even if the install "gcc" is different. The main issue is with dynamically linked libraries. But you can usually have some control over this with settings for LD_LIBRARY_PATH and LD_RUN_PATH.
    openSUSE Leap 15.1; KDE Plasma 5;

  3. #3
    Join Date
    Oct 2014
    Location
    Switzerland
    Posts
    384

    Default Re: Creating a new custom environment shell, inheriting most of bash.

    Okay,
    In that case, I will first try setting the LD paths.

    However in the future, I will need a shell that will need many older packages that are no longer supported. Is there a way to create a custom shell in that case?

  4. #4
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,194
    Blog Entries
    3

    Default Re: Creating a new custom environment shell, inheriting most of bash.

    If you look at "firefox" (as in "/usr/bin/firefox"), you will see that it is a shell script. It sets some environment variables, and then runs the real firefox executable. You can do something similar for other commands. Back when I was a sysadmin, I used to do that for some commands.
    openSUSE Leap 15.1; KDE Plasma 5;

  5. #5
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,842
    Blog Entries
    2

    Default Re: Creating a new custom environment shell, inheriting most of bash.

    You should understand that typically an application is compiled once before you use it, and then never again. It's very unusual for any app to have to be re-compiled more than once, much less repeatedly over a period of time.

    Therefor,
    The apps you compiled in 42.3 will be retained as you upgrade your openSUSE, perhaps all the way to the current 15.1 and they will continue to work... without any need or regard for any gcc installed on your system.

    If you really needed to re-compile an application in any version of openSUSE using a gcc that isn't default, I wrote a Wiki article how to set up your machine to switch between different gcc... Again, ordinarily unless your machine is re-compiling anything that requires gcc, you don't care what is the default although I provide you guidance so you can switch between gcc easily

    https://en.opensuse.org/User:Tsu2/gc...e-alternatives

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  6. #6
    Join Date
    Oct 2014
    Location
    Switzerland
    Posts
    384

    Default Re: Creating a new custom environment shell, inheriting most of bash.

    Quote Originally Posted by tsu2 View Post
    You should understand that typically an application is compiled once before you use it, and then never again. It's very unusual for any app to have to be re-compiled more than once, much less repeatedly over a period of time.

    Therefor,
    The apps you compiled in 42.3 will be retained as you upgrade your openSUSE, perhaps all the way to the current 15.1 and they will continue to work... without any need or regard for any gcc installed on your system.

    If you really needed to re-compile an application in any version of openSUSE using a gcc that isn't default, I wrote a Wiki article how to set up your machine to switch between different gcc... Again, ordinarily unless your machine is re-compiling anything that requires gcc, you don't care what is the default although I provide you guidance so you can switch between gcc easily

    https://en.opensuse.org/User:Tsu2/gc...e-alternatives

    TSU
    Some of the applications fail to compile with the new gcc version. Even if it does, I end up with segment fault possibly because of the some of the syntax and package headers that have been hard coded.

    As for configuring update-alternatives for gcc. What I am looking for is almost what you have presented Tsu. I just wish to do that seperately in just one shell. Basically, I wish to create a new shell that inherits everything bash, and from there I can configure it to use gcc 4 for example using your instructions, but not actually affect the original bash, only the new shell.

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,733

    Default Re: Creating a new custom environment shell, inheriting most of bash.

    I am sorry, but it eludes me complete what bash (or any shell) has to do with this.

    The shell sits only between a terminal user and the kernel. It has no knowledge at all about which version of gcc is available, it does not even know anything about if gcc is a compiler or a game or whatever. It just reads from the terminal and tries to interprete that as a command. In the end it can be that the command is asking for starting a process from a file. While that file must be an executable (in being fit to be used as the code for a process), the shell has no knowledge about what that process will do.

    Maybe I do misunderstand you, but I have the idea that others here also need some more explanation from you.
    Henk van Velden

  8. #8
    Join Date
    Oct 2014
    Location
    Switzerland
    Posts
    384

    Default Re: Creating a new custom environment shell, inheriting most of bash.

    hcvv,
    What I mean by creating a new shell environment is similar to bash, I would like to create a new shell environment which for the most part are duplicate of the existing system's bash.

    Now, in this environmental shell, I wish to by default use bin, library and etc. paths which would use a specific versions of the packages.

    Similar to starting with bash, then re-setting
    PATH, LD_LIBRARY_PATH, ...
    to specific directories such that my programs would run the way I would like them to.

    I wish to do this for gcc for example since some of the proprietary software that I am trying to set up require a specific version of libraries within say libstdc++.so.6, and supplying sym link to a newer one would cause a segement fault. Similarly, the proprietary software specifically seeks for gcc48 and when it cannot, it will force a crash.

    Before I start this software, I can export paths such that it would be forced to look into where I installed gcc48. Within that bash shell, everything seem to work okay, however I wish to create an entire shell to do this.

    For example, similar to entering c or z shells and etc.
    I wish to create for example, "48sh" such that when I open a terminal, I type in

    48sh,
    which would create reconfigure the paths so that I can avoid the conflicts altogether (as I am typing this, I am wondering to myself why I don't bother just writing a shell script that would set the environment on demand).

  9. #9
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,589

    Default Re: Creating a new custom environment shell, inheriting most of bash.

    Use startup scripts for a different user. ie normal user and old environment user

  10. #10
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,733

    Default Re: Creating a new custom environment shell, inheriting most of bash.

    I still think you are misunderstanding what the shell is and on the other side what the process environment (with it's process environment variables) is.

    Process environment variables (in short: environment variables) like PATH, LD_LIBRARY_PATH, ... are not set by the shell, they are used by the shell. They are mostly set at the startup of a shell process because the shell at it's start executes several files (if they exist) in a predefined sequence. Names like /etc/profile, ~/.profile, .bashrc, etc. are in this range. And when a user wants e.g. a PATH variable that differs from the default as configured by the system in /etc/profile, he can do so in his ~/.profile.

    And the user can indeed call a script that changes PATH (and others) again, or type a command on the terminal that changes PATH, etc. The shell only uses what it finds as the value of PATH every time it uses it in the action of finding the file that corresponds to the first word of a command given (when that word does not contain a / and .....).

    From
    Code:
    man bash
    PATH
    The search path for commands. It is a colon-separated list of directories in which the shell looks for commands (see COMMAND EXECUTION below). A zero-length (null) directory name in the value of PATH indicates the current directory. A null directory name may appear as two adjacent colons, or as an initial or trailing colon. The default path is system-dependent, and is set by the administrator who installs bash. A common value is ``/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin''.
    And the other one you mention LD_LIBRARY_PATH is not even used by bash.
    Last edited by hcvv; 20-Jun-2019 at 06:13.
    Henk van Velden

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •