mersenneforum.org Question and flame
 Register FAQ Search Today's Posts Mark Forums Read

 2012-07-13, 22:18 #1 Prime95 P90 years forever!     Aug 2002 Yeehaw, FL 52×311 Posts Question and flame Why does Linux have to make *everything* so frickin' difficult - wasting hours of my time? All I want to do is set an environment variable. Simple you'd think. Cuda requires that I set LD_LIBRARY_PATH. Obviously, one wants to do this once at startup. Google --- advised to set it and export it in .profile. Reboot. No joy. More google --- advised to set it in .bashrc. Short-lived joy make and execution works OK. Try to move my project to Eclipse and it can't make. More google --- suggests setting the environment variable in an Eclipse dialog. OK, I can make now. Try to debug - we all know where this is going - it's not set again. Yet more googling, suggests setting it in .cshrc.local. No joy. For crying out loud isn't there one place one can go to set a damn environment variable once and for all????
 2012-07-13, 22:31 #2 Batalov     "Serge" Mar 2008 Phi(4,2^7658614+1)/2 5·7·277 Posts [rant=on]I'd blame "windowzation" (bastardization, rather) of linux. Before there were linux distros for dummies, everything was fine! I actually liked it when UNIX and linux were for those who knew what they were doing and not for every kitchen maid (as proposed by V.I.Lenin: "every kitchen maid can participate in governing the state"; now every kitchen maid can run linux, blecccch... Why? because linux became diluted and dummified).[/rant] Also, I never liked bash (you said .bashrc?). tcsh is my poison. __________ EDIT: I didn't want to say that you were a kitchen maid but I think you are running a kitchen maid's distro. I tried it, didn't like it. Too few dev. tools. OpenSUSE which I am using is also far from perfect, but it comes with a larger set; but of course I'd need even more, so I prefer to start with a heavyweight (DVD-size) distro when I build every next comp. Last fiddled with by Batalov on 2012-07-13 at 22:40
2012-07-13, 22:40   #3
chalsall
If I May

"Chris Halsall"
Sep 2002

1019310 Posts

Quote:
 Originally Posted by Prime95 Why does Linux have to make *everything* so frickin' difficult - wasting hours of my time?
Think of Linux a bit like Intel CPUs -- not always the easiest thing to make friends with, but once you do you can do some pretty awesome things...

Based on your above, you've tried using the "dot" startup files for three different shells. Since .bachrc worked, it clear you're using the Bash shell (it's the most common now-a-days).

One very important thing though is you need to not just set the variable, but you must also export it for anything launched from the shell to pick it up. Hopefully this cut-and-paste from a bash session will show what I mean:

Code:
[chalsall@burrow ~]$echo$TEST  # Variable not defined.

[chalsall@burrow ~]$TEST="test" # Set variable. [chalsall@burrow ~]$ echo $TEST # Variable is now defined. test [chalsall@burrow ~]$ bash  # Launch a new program.  Another bash in this case.
[chalsall@burrow ~]$echo$TEST  # Variable not defined.

[chalsall@burrow ~]$exit # Return to the original bash. exit [chalsall@burrow ~]$ echo $TEST # Variable still defined. test [chalsall@burrow ~]$ export TEST  # Export the variable.
[chalsall@burrow ~]$echo$TEST  # Variable still defined.
test
[chalsall@burrow ~]$bash # Launch a new bash again. [chalsall@burrow ~]$ echo $TEST # Exported variable now defined in launched environment. test [chalsall@burrow ~]$
Quote:
 Originally Posted by Prime95 More google --- suggests setting the environment variable in an Eclipse dialog.
I don't know for sure (I don't use IDEs -- I usually code on machines thousands of KMs away from where I sit), but I suspect if you launched Eclipse from bash that you would have fewer problems.

Quote:
 Originally Posted by Prime95 For crying out loud isn't there one place one can go to set a damn environment variable once and for all????
Please don't get too frustrated George. *nix is worth the investment to learn, even though the learning curve can appear to be vertical at the beginning. And I'm sure there are many here who are more than happy to help you get away from the "dark side"....

 2012-07-13, 22:40 #4 Dubslow Basketry That Evening!     "Bunslow the Bold" Jun 2011 40
 2012-07-13, 22:52 #5 Batalov     "Serge" Mar 2008 Phi(4,2^7658614+1)/2 5×7×277 Posts One thing, George, that you most likely don't have to do is reboot. (Because even diluted, it is not Windows!) To make .*rc-added variables known you'd run things like "source ~/.cshrc"; "rehash" (after adding something to \$path) etc etc. For sh reincarnations like bash, yeah, "export" is a must, or iirc (I rarely use bash) you could do some inline exports like "CC=icc LD_ectetcect=whatever make" (or similar).
 2012-07-13, 23:11 #6 Dubslow Basketry That Evening!     "Bunslow the Bold" Jun 2011 40
2012-07-14, 00:12   #7
Prime95
P90 years forever!

Aug 2002
Yeehaw, FL

171378 Posts

I knew ranting against Linux would produce a firestorm :)

Quote:
 Originally Posted by Batalov I'd blame "windowzation" (bastardization, rather) of linux. Before there were linux distros for dummies, everything was fine!
The "it's *nix, it's fine" attitude leads to blindness to better ways of doing things. If Linux is made easier to install and easier to use for everyone (and you can still drop into a shell and do your old power-user tricks) its a win-win for everyone.

Your "everything was fine" quote is funny. Back in the early 80s I developed on a Unix machine. The first thing I did was write my own gedit-like editor, because I'd rather put a sharp stick in my eye than use vi on a day-to-day basis.

Quote:
 ...not for every kitchen maid... OpenSUSE which I am using ...
No offense taken :) In this case I want to be a kitchen maid. I develop on 3 platforms and don't have time (or brain-power now that I'm old) to be a power user on any one platform.

I chose Ubuntu because CUDA 5 gave me a choice of Ubuntu, Fedora, and OpenSUSE. Ubuntu was the only one that had a real easy install from within Windows (my Mac is balking at burning DVDs right now). BTW, kudos to Ubuntu on the Windows-based install - easy and flawless.

Quote:
 Originally Posted by chalsall I don't know for sure (I don't use IDEs ), but I suspect if you launched Eclipse from bash that you would have fewer problems.
As pointed out, .bashrc did export the variable.

I don't use IDEs much either - except for debugging. gdb in command line mode is painful. Is there an alternative that isn't a full blown IDE but is better than plain old gdb?

I'll look into launching eclipse from the command line rather than the GUI. Shame on Ubuntu (or the GUI developer) if there is a difference between the two.

Quote:
 Originally Posted by Batalov One thing, George, that you most likely don't have to do is reboot. (Because even diluted, it is not Windows!) To make .*rc-added variables known you'd run things like "source ~/.cshrc"; "rehash"
More to remember. I don't want to be a power user. I didn't mind rebooting at all figuring it was just my lack of knowledge. I do mind having to reboot Windows and my Mac nearly every time there is a software update.

Quote:
 Originally Posted by Dubslow The .profile and .bashrc sound like they would only work for a bash program. I'm not sure I've ever heard of a global environment variable on Linux, but then I'm certainly not the authority.
Looks like an opportunity to improve the OS. Wouldn't it be nice if there was one standard place to personalize environment variables for *all* distros and *all* shells, say ~/.vars. After all, I've never installed an OS (except maybe my Mac) where one of the first things I didn't need to do was personalize the PATH variable. I think Linus(x) made a big mistake in not forming a committee to enforce more standardization across the distros. Now you have a mess.

P.S. Thanks for being the only one to point to a possible solution. I'll try the 5 year old tip tomorrow.

Last fiddled with by Prime95 on 2012-07-14 at 00:40

2012-07-14, 00:24   #8
jrk

May 2008

3×5×73 Posts

Quote:
 Originally Posted by Prime95 I think Linus(x) made a big mistake, in not forming a committee to enforce more standardization across the distros. Now you have a mess.
oblig:

http://imgs.xkcd.com/comics/standards.png

2012-07-14, 00:33   #9
Dubslow

"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88

3×29×83 Posts

Quote:
 Originally Posted by Prime95 I don't use IDEs much either - except for debugging. gdb in command line mode is painful. Is there an alternative that isn't a full blown IDE but is better than plain old gdb?
I did a search after CUDALucas ran into problems, and I found this:
http://www.gnu.org/software/ddd/

The GUI isn't the most intuitive in the world, but it's a major step up from gdb, almost equivalent to Eclipse's (Java) debugger.
Quote:
 Originally Posted by Prime95 I'll look into launching eclipse from the command line rather than the GUI. Shame on Ubuntu (or the GUI developer) if there is a difference between the two.
Shouldn't be. In my System Monitor, it has the option to show the command that launched each process -- that should get you a long way.
Quote:
 Originally Posted by Prime95 More to remember. I don't want to be a power user. I didn't mind rebooting at all figuring it was just my lack of knowledge. I do mind having to reboot Windows and my Mac nearly every time there is a software update.
If not re-running the config files, then just closing the current terminal and opening a new one should provide a 'fresh' environment, i.e. each terminal separately reads the config files when it starts.

PS I do indulge myself in gedit's syntax highlighting, that's pretty nice.

Last fiddled with by Dubslow on 2012-07-14 at 00:36

 2012-07-14, 01:16 #10 jasonp Tribal Bullet     Oct 2004 354310 Posts The problem with trying to standardize on one way of handling shells is that all the different shells have 30 years of legacy stuff that depends on them. Imagine if there were 10 different versions of DOS that all had different incompatible syntax, each with a huge community of people and large companies that only cared about their preferred DOS. Oddly enough, vi was what the programmers at my first job out of college all used, so that's what I learned. I was young enough that I barely noticed the enormous learning curve; now I install vi on the windows machines at work because it's what I'm used to and being productive is very difficult with anything else. Everybody eventually finds the balance that works for them. Unfortunately it takes a long time (years) before you can do things the unix way by reflex, and the reflex part is what makes you productive in that environment, not the fact that it's unix. I've often found myself wishing, for example, that I can paste the output of a windows command line into another windows command line, or do recursive things through the file tree, or other things that any unix environment takes for granted. PS: Particular distros do standardize things like what script gets run when you log in, and you can stick an environment variable into that so that it works for everything you do when you log in. Depending on what that script says, you may get another script in your home directory that you can use to continue customizing your login shell. That script is often named .bashrc, .cshrc, .login, .initrc, or something else. But everybody makes different choices, not just linux, and that does make it a pain sometimes. In Fedora linux, stuff that you want to run at boot time can go into the /etc/rc.local script, so that on Fedora (but not on others) you get something very similar to autoexec.bat. This is a choice the distro authors make, and has nothing to do with the OS. Last fiddled with by jasonp on 2012-07-14 at 01:26
 2012-07-14, 01:30 #11 Dubslow Basketry That Evening!     "Bunslow the Bold" Jun 2011 40

 Similar Threads Thread Thread Starter Forum Replies Last Post skan Miscellaneous Math 64 2013-10-23 11:02 davar55 Lounge 9 2008-08-25 00:22

All times are UTC. The time now is 11:56.

Tue Jan 25 11:56:21 UTC 2022 up 186 days, 6:25, 0 users, load averages: 1.37, 1.31, 1.22