mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Linux

Reply
 
Thread Tools
Old 2012-07-13, 22:18   #1
Prime95
P90 years forever!
 
Prime95's Avatar
 
Aug 2002
Yeehaw, FL

52×311 Posts
Default 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????
Prime95 is offline   Reply With Quote
Old 2012-07-13, 22:31   #2
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

5·7·277 Posts
Default

[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
Batalov is offline   Reply With Quote
Old 2012-07-13, 22:40   #3
chalsall
If I May
 
chalsall's Avatar
 
"Chris Halsall"
Sep 2002
Barbados

1019310 Posts
Default

Quote:
Originally Posted by Prime95 View Post
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 View Post
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 View Post
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"....
chalsall is offline   Reply With Quote
Old 2012-07-13, 22:40   #4
Dubslow
Basketry That Evening!
 
Dubslow's Avatar
 
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88

160658 Posts
Default

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
Dubslow is offline   Reply With Quote
Old 2012-07-13, 22:52   #5
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

5×7×277 Posts
Default

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).
Batalov is offline   Reply With Quote
Old 2012-07-13, 23:11   #6
Dubslow
Basketry That Evening!
 
Dubslow's Avatar
 
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88

3×29×83 Posts
Default

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
Dubslow is offline   Reply With Quote
Old 2012-07-14, 00:12   #7
Prime95
P90 years forever!
 
Prime95's Avatar
 
Aug 2002
Yeehaw, FL

171378 Posts
Default

I knew ranting against Linux would produce a firestorm :)


Quote:
Originally Posted by Batalov View Post
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 View Post
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 View Post
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 View Post
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
Prime95 is offline   Reply With Quote
Old 2012-07-14, 00:24   #8
jrk
 
jrk's Avatar
 
May 2008

3×5×73 Posts
Default

Quote:
Originally Posted by Prime95 View Post
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
jrk is offline   Reply With Quote
Old 2012-07-14, 00:33   #9
Dubslow
Basketry That Evening!
 
Dubslow's Avatar
 
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88

3×29×83 Posts
Default

Quote:
Originally Posted by Prime95 View Post
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 View Post
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 View Post
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
Dubslow is offline   Reply With Quote
Old 2012-07-14, 01:16   #10
jasonp
Tribal Bullet
 
jasonp's Avatar
 
Oct 2004

354310 Posts
Default

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
jasonp is offline   Reply With Quote
Old 2012-07-14, 01:30   #11
Dubslow
Basketry That Evening!
 
Dubslow's Avatar
 
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88

11100001101012 Posts
Default

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.
Dubslow is offline   Reply With Quote
Reply

Thread Tools


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

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

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔