Installed Gcc in a custom dir. Now I wish to create sym links in /Usr/Local

colt

New Member
Joined
Sep 3, 2020
Messages
12
Reaction score
0
Credits
148
Hello. As the title says, I compiled and installed a newer Gcc in a custom dir, outside local system default system dir. That means that by default, they are not searched when I type commands on command line. So to make my life easier, I decided to create symbolic links to the more important binary files, libraries and header files in dir on /usr/locl, where they would be searched. Would thing with sym links in /usr/local/whatever have priority under stuff in /usr/bin, usr/lib, etc?

The question is. Which files are good candidates? G++ is the first candidate. I did it and it seems to work as intended. However, doing only this, it will use the default headers and libs. I think this might cause it to have problems to use newer c++ features, since the default installed ones does not support or have experimental support to any mildly new c++ features.

So probably create a sym link to libstdc++.so is a good idea? What about the headers? Which possible benefits there are in doing this procedure for them. What else.

And to do this for everything? It is worth. It would pollute the /usr/local/wharever dir. It would be a fairly big effort to do so.

Other options? One would be to download, compile and then install it in /usr/local/whatever. However, this takes a lot of time. Even unzip it, takes a fairly long time (at least in my underclocked core 2 at 900Mhz). Compile it, probably four hours, not to mention to read configure help (don't remember all options from the lats time). This has the big disadvantage of being wasted work whenever I reinstall the OS. I had a superblock corruption a couple days ago and had to format the partition to then reinstall the OS. So I am not very favorable to it (the current install dir is in a different partition)

Other one, would be to set Path to point to the Gcc/bin dir. Then LD_LIBRARY_PATH to Gcc/lib. And finally CPPFLAGS to Gcc/include. Perhaps something else has to be done. Any cons?

So what you all think?
 


I’m not sure offhand. I’ve never tried compiling and installing a custom version of gcc.
At least, not since I tried installing LFS and Gentoo (a loooooong time ago).
What distro are you currently using?
If it’s Debian based, the update-alternatives command might help......

Regarding the priority of /usr/local - that will depend on how $PATH is set up.
The priority is left to right through the list, so the first directory listed in $PATH has the highest priority and will be searched first. The last one in the list has the lowest priority and is searched last.

For custom things, I have set up a personal bin directory in my home directory, which is given highest priority in $PATH. I often put sym links to executables I have built in various projects directories.
Not sure if that will work for gcc though.....
 
Last edited:

Members online


Top