setting an environment variable QTDIR

Asked by LEGOManiac

I'm trying to install the latest version of pdfedit 0.4.2. Version 0.4.1 is available in the repositories but it crashes the system occasionally and it's taking upwards of 4 minutes to edit one line in a PDF document so I want to see if 0.4.2 fixes this.

I've followed the instructions in the readme and installed the support files. The QT3 package is located in
 /usr/share/qt3

When I try sudo ./configure, all goes well until I get to this line:

configure: error: QTDIR environment variable must be set

According to the readme, all I need to do is:
export QTDIR=/usr/share/qt3

Typing env | grep QTDIR shows that the QTDIR environment variable appears to be set properly.

At this point I'm clueless.

I do note that this environment variable seems to be local to the particluar shell instance I'm setting it in. I happened to start another shell to check the variable and it wasn't set there. Could this be part of the problem? Is there a way to set an environment variable to be truely universal?

Also, on a hunch, I rebooted, thinking that perhaps environement variables need to be loaded during startup. I suspected not but, hey, it was worth a try. The variable did not survive the reboot and had to be set again. How do I make it permanent?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Simone Cianfriglia
Solved:
Last query:
Last reply:
Revision history for this message
Simone Cianfriglia (crimer) said :
#1

To set an environment variable to be permanent for you profile you have to type in terminal:
echo export QTDIR=/usr/share/qt3 >> ~/.bashrc

To set this variable on a system-wide basis you have to:
echo export QTDIR=/usr/share/qt3 >> etc/profile

Try this and see if it solves your problem :D

Revision history for this message
LEGOManiac (bzflaglegomaniac) said :
#2

I presume etc/profile should have read /etc/profile?

even typing sudo echo export QTDIR=/usr/share/qt3 >> /etc/profile returns "Permission Denied"

Typing sudo ./configure yields the last three lines:

checking whether we want to prepare pdfedit-core-dev package... no
checking whether we want to build PDFedit gui... yes
configure: error: QTDIR environment variable must be set

But typing env shows that it's there

/snip/
GTK_RC_FILES=/etc/gtk/gtkrc:/home/matthias/.gtkrc-1.2-gnome2
WINDOWID=73400380
QTDIR=/usr/share/qt3
/snip/

I have confirmed that

echo export QTDIR=/usr/share/qt3 >> ~/.bashrc

did set this environment variable for this profile. That is, if I open another terminal I can still see the variable set which is an improvement.

I still don't know what my problem is.

Revision history for this message
Best Simone Cianfriglia (crimer) said :
#3

At the beginning, remove the export QTDIR at the bottom of your bashrc file, you don't need it.

Then try this:
- sudo QTDIR=/usr/share/qt3 ./configure
OR
- sudo -E ./configure , if variable QTDIR is set in the current environment

The first syntax sets variable QTDIR only for the following command; the last doesn't override your environment with root's, obvioulsy QTDIR has to be set with "export QTDIR " in current shell.

I hope it helps :)

Revision history for this message
LEGOManiac (bzflaglegomaniac) said :
#4

Thanks Crimer, that solved my question.

Revision history for this message
dgoosens (dgoosens) said :
#5

thanks
sudo QTDIR=/usr/share/qt3 ./configure
did the trick for me