LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   Compile source without dependencies (https://www.linuxquestions.org/questions/solaris-opensolaris-20/compile-source-without-dependencies-4175608251/)

ohijames 06-20-2017 06:42 AM

Compile source without dependencies
 
I downloaded and compiled Sudo from sudo.ws
however when I install my compiled version of Sudo on a Solaris machine that doesn't have gcc I get the following errors.

libintl.so.8 => (file not found)
libiconv.so.2 => (file not found)


bash-2.05$ sudo -V
ld.so.1: sudo: fatal: libintl.so.8: open failed: No such file or directory
bash-2.05$ ldd /opt/quest/bin/sudo
/usr/lib/secure/s9_preload.so.1
libproject.so.1 => /usr/lib/libproject.so.1
libsocket.so.1 => /usr/lib/libsocket.so.1
libnsl.so.1 => /usr/lib/libnsl.so.1
libsudo_util.so.0 => /opt/quest/libexec/sudo/libsudo_util.so.0
libintl.so.8 => (file not found)
libiconv.so.2 => (file not found)
libsec.so.1 => /usr/lib/libsec.so.1
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
librt.so.1 => /usr/lib/librt.so.1
libsecdb.so.1 => /usr/lib/libsecdb.so.1
libproc.so.1 => /usr/lib/libproc.so.1
libpool.so.1 => /usr/lib/libpool.so.1
libmp.so.2 => /usr/lib/libmp.so.2
libintl.so.8 => (file not found)
libiconv.so.2 => (file not found)
libaio.so.1 => /usr/lib/libaio.so.1
libmd5.so.1 => /usr/lib/libmd5.so.1
libcmd.so.1 => /usr/lib/libcmd.so.1
librtld_db.so.1 => /usr/lib/librtld_db.so.1
libelf.so.1 => /usr/lib/libelf.so.1
libxml2.so.2 => /usr/lib/libxml2.so.2
libpthread.so.1 => /usr/lib/libpthread.so.1
libz.so.1 => /usr/lib/libz.so.1
libm.so.1 => /usr/lib/libm.so.1
/usr/platform/sun4v/lib/libc_psr.so.1
libthread.so.1 => /usr/lib/libthread.so.1

I looked into the dependencies and I don't need them for what I want to achieve however I need to use the compiled version for added functionality

If I download the and install already compiled version I don't see those missing dependencies like below

# ldd /usr/bin/sudo
/usr/lib/secure/s9_preload.so.1
libproject.so.1 => /usr/lib/libproject.so.1
libsocket.so.1 => /usr/lib/libsocket.so.1
libnsl.so.1 => /usr/lib/libnsl.so.1
libsudo_util.so.0 => /usr/local/libexec/sudo/libsudo_util.so.0
libdl.so.1 => /usr/lib/libdl.so.1
librt.so.1 => /usr/lib/librt.so.1
libc.so.1 => /usr/lib/libc.so.1
libsecdb.so.1 => /usr/lib/libsecdb.so.1
libproc.so.1 => /usr/lib/libproc.so.1
libpool.so.1 => /usr/lib/libpool.so.1
libmp.so.2 => /usr/lib/libmp.so.2
libaio.so.1 => /usr/lib/libaio.so.1
libmd5.so.1 => /usr/lib/libmd5.so.1
libcmd.so.1 => /usr/lib/libcmd.so.1
librtld_db.so.1 => /usr/lib/librtld_db.so.1
libelf.so.1 => /usr/lib/libelf.so.1
libxml2.so.2 => /usr/lib/libxml2.so.2
libpthread.so.1 => /usr/lib/libpthread.so.1
libz.so.1 => /usr/lib/libz.so.1
libm.so.1 => /usr/lib/libm.so.1
/usr/platform/sun4v/lib/libc_psr.so.1
libthread.so.1 => /usr/lib/libthread.so.1
#

Is it possible to compile from source without those dependencies?

wpeckham 06-20-2017 06:47 AM

Read through the documents in the sudo build file set, and there are build options. I no longer remember the exact syntax, but you can set STATIC and compile to a single larger executable that includes all of the dependencies rather than using the dynamic calls. It creates a larger package, and is arguably less secure since security updates to those packages will be ignored until your next build.

Laserbeak 06-20-2017 03:49 PM

.so files are dynamically linked, so they have to be present everytime you run the program.

Copy those library files into /usr/lib or /usr/local/lib or something. (Assuming these computers are all of the same architecture -- i.e. UltraSPARC or x86_64, etc.)

If you put it in /usr/local/lib (or anywhere else), make sure that directory is in your LD_LIBRARY_PATH environment variable.

Laserbeak 06-20-2017 04:04 PM

Quote:

Originally Posted by ohijames (Post 5724752)
Is it possible to compile from source without those dependencies?

As noted by wpeckham, there should be a way to build it with all static libraries. But this is not recommended since you'll end up with a much larger binary and no bug fixes or improvements in upgraded libraries will be automatically included in your program.

Laserbeak 06-20-2017 04:15 PM

Are you writing this for yourself or for widespread distribution?

ohijames 06-21-2017 09:55 AM

Thank you
 
Quote:

Originally Posted by wpeckham (Post 5724755)
Read through the documents in the sudo build file set, and there are build options. I no longer remember the exact syntax, but you can set STATIC and compile to a single larger executable that includes all of the dependencies rather than using the dynamic calls. It creates a larger package, and is arguably less secure since security updates to those packages will be ignored until your next build.

Thank you for all the suggestions guys. Its all working

wpeckham 06-21-2017 12:24 PM

Quote:

Originally Posted by ohijames (Post 5725213)
Thank you for all the suggestions guys. Its all working

I suggest that you then leave a post with a short description of what worked, and mark this thread SOLVED.

It may help someone else working on the same issue one day.

Laserbeak 06-21-2017 12:42 PM

Yes, I'd also like to know what your solution was.

Also, these are GNU items, so on Solaris 11.3, they probably should live in /usr/gnu, so if you needed to install them, they should probably go there, making sure the appropriate directories are in the appropriate environment PATHs.


All times are GMT -5. The time now is 09:34 AM.