LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-04-2016, 03:36 AM   #1
MahendraL
LQ Newbie
 
Registered: Jul 2009
Posts: 29

Rep: Reputation: 0
Difference in output of ldd command with and without sudo


Hi,
I'm working on following Linux OS.
Ubuntu 14.04.3 LTS \n \l
Linux Debian jessie/sid ( 3.13.0-62-generic x86_64)

I'm seeing difference in output of ldd command with and without sudo for the same executable as below.

$ ldd ./hpcc
linux-vdso.so.1 => (0x00007fff74ba6000)
libmpi.so.12 => /home/lml/install_1/lib/libmpi.so.12 (0x00007f4a5559a000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4a5537c000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4a55076000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4a54cb1000)
libOpenCL.so.1 => /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 (0x00007f4a54aa8000)
libibmad.so.5 => /usr/lib/x86_64-linux-gnu/libibmad.so.5 (0x00007f4a5488f000)
libibumad.so.3 => /usr/lib/x86_64-linux-gnu/libibumad.so.3 (0x00007f4a54688000)
libibverbs.so.1 => /usr/lib/libibverbs.so.1 (0x00007f4a5447b000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f4a54273000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f4a5405d000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4a55c31000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4a53e59000)

$ sudo ldd ./hpcc
[sudo] password for lml:
linux-vdso.so.1 => (0x00007fffc1d61000)
libmpi.so.12 => not found
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd9c81ad000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd9c7ea7000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd9c7ae2000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd9c83cb000)

Why is libmpi.so.12 not found when ldd is run with sudo command.
Because of this, when I run hpcc executable under sudo, I get following error.

$ sudo mpirun -np 4 ./hpcc
./hpcc: error while loading shared libraries: libmpi.so.12: cannot open shared object file: No such file or directory

Thank you.
LML
 
Old 01-04-2016, 04:44 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Root doesn't know about libraries located in /home/lml. The environment variable LD_LIBRARY_PATH contains the directories to search for libraries; check its value for lml and for root.

Note that for security reasons the user's environment is not inherited by default when running sudo. This behaviour can be changed in the sudoers file.
 
1 members found this post helpful.
  


Reply

Tags
ldd



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
lpstat command output difference on crontab hocheetiong Linux - Server 1 02-28-2013 07:55 PM
What is difference between Power broker utility and sudo command. pinga123 Linux - Newbie 4 08-12-2011 03:34 AM
LXer: How to properly redirect the output of command executed with sudo. LXer Syndicated Linux News 0 02-27-2011 11:50 PM
meaning of output of ldd command _Linux_Learner Linux - Newbie 3 11-16-2010 07:17 AM
Which ldd output is correct? kaz2100 Linux - General 1 08-24-2006 01:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration