![]() |
|
|
#1 |
|
P90 years forever!
Aug 2002
Yeehaw, FL
11101011001102 Posts |
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???? |
|
|
|
|
|
#2 |
|
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
36·13 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 |
|
|
|
|
|
#3 | |||
|
If I May
"Chris Halsall"
Sep 2002
Barbados
37×263 Posts |
Quote:
![]() 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:
Quote:
|
|||
|
|
|
|
|
#4 |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3·29·83 Posts |
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.
A quick Google of that term led to this: http://blog.andrewbeacock.com/2007/1...vironment.html http://www.debian.org/doc/debian-pol...rsys.html#s9.9 He suggests /etc/environment, though since it's a 5 year old post, who knows what'll happen. Edit @chalsall: The sentence about Google mentions exporting, that was my first thought as well. Edit2: Even though I don't do remote coding, IDEs to me have always seemed like a barrier to development, all the fuss to go through to set it all up properly before writing even the simplest program, and then once you have a program, how are you supposed to use it outside the IDE? This is the main reason I learned C first (after a small bite of bash), despite all advice to the contrary (learn a simpler language, C is too hard, yadda yadda), because it's as simple as editing a text file and then 'gcc prog.c -o prog'. Adding the dev folder to my PATH took care of the execution problem. Last fiddled with by Dubslow on 2012-07-13 at 22:45 |
|
|
|
|
|
#5 |
|
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
36·13 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). |
|
|
|
|
|
#6 |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3×29×83 Posts |
Or even just `. ~/.bashrc`, at least in bash. The period can be used to read/run bash scripts/files.
PS This is why CUDA should allow static linking. Last fiddled with by Dubslow on 2012-07-13 at 23:21 |
|
|
|
|
|
#7 | |||||
|
P90 years forever!
Aug 2002
Yeehaw, FL
2·53·71 Posts |
I knew ranting against Linux would produce a firestorm :)
Quote:
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:
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:
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:
Quote:
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 |
|||||
|
|
|
|
|
#8 | |
|
May 2008
3·5·73 Posts |
Quote:
http://imgs.xkcd.com/comics/standards.png |
|
|
|
|
|
|
#9 | |||
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3·29·83 Posts |
Quote:
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:
Quote:
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 |
|||
|
|
|
|
|
#10 |
|
Tribal Bullet
Oct 2004
354110 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 |
|
|
|
|
|
#11 |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3·29·83 Posts |
That's one of the good things about the distros -- each family is largely cross-compatible. If it works on Debian, it probably works on Ubuntu (the reverse is largely but less so true). Same, I would imagine, for the various flavors of Red Hat/Fedora, and the various SUSEs.
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| New flame war idea ?? | skan | Miscellaneous Math | 64 | 2013-10-23 11:02 |
| Fred Flame Charges | davar55 | Lounge | 9 | 2008-08-25 00:22 |