Several problems on Solaris10

James list at xdrv.co.uk
Tue Jan 1 16:29:46 EET 2019


On 31/12/2018 17:28, Pierluigi Frullani wrote:

>     > My version is 2.2.13 ( it was the last one, at the time of the first
>     > server setup ).
>
>     2.2.13 is from around May 2014.  It worked but I can't see why you
>     wouldn't switch to the latest 2.3.4. (You might be seeing what I can't
>     and your question hasn't explained.)
>
>
> That's the date for installation. I was using the courier-imap and
> switched to dovecot.
> Not changed since then.

So use the latest version.


>     > I have seen that ( it seems ) the new solaris don't honour the
>     > LD_LIBRARY_PATH.
>
>     I'm sure it does but you shouldn't need it anyway.
>
>
> Believe me, it doesn't :(

Test:

$ cat > sub.c << EOF
void sub() {}
EOF
$ cat > main.c << EOF
void sub();
int main() { sub(); }
EOF
$ cc -G -o libsub.so sub.c
-- link with no run path in the executable, fails with no other help
$ cc main.c -L. -lsub
$ ./a.out
ld.so.1: a.out: fatal: libsub.so: open failed: No such file or directory
zsh: killed     ./a.out
-- succeeds with LD_LIBRARY_PATH set
$ LD_LIBRARY_PATH=. ./a.out
-- link with a run path, succeeds on its own
$ cc main.c -L. -R. -lsub
$ ./a.out
$ dump -Lv a.out | grep RUNPATH
[5]	RUNPATH         .

-- to see the logic when finding a library use "ldd -s ..."
$ LD_LIBRARY_PATH=. ldd -s ./a.out

    find object=libsub.so; required by a.out
     search path=.  (LD_LIBRARY_PATH)
     trying path=./libsub.so
	libsub.so =>	 ./libsub.so

-- clean up:
$ rm sub.c main.c libsub.so a.out


> The problem ( as usual ) arise with the openssl libs that solaris ships,

Build your own openssl.


>     1. Do not put your files in /use/local.  You will clash with someone
>     else thinking it is the place to put personal stuff.  man filesystem:
>     "/opt  Root of a subtree for add-on application packages."
>
>
>  Being that I'm the only one administering this machine I'm sure it
> would not  ;)

You will appreciate the separation of system and add-ons.  Solaris 10 
sparse zones can make /usr read only.  It really is the "right" way.


> Would you ( or could ) show me where to replace -R and -L on Makefile(s)
> to fix the runpath trouble ?
>
> I've tried the following:
> CPPFLAGS="-I/usr/local/clucene/include -I/usr/local/libtextcat/include
> -I/usr/local/openssl-1.0.1e/include" LDFLAGS="-L/usr/local/clucene/lib
> -L/usr/local/libtextcat/lib
> -L/usr/local/openssl-1.0.1e/lib -R/usr/local/openssl-1.0.1e/lib "
> ./configure --prefix=/usr/local/dovecot --with-ssl=yes --with-stemmer
> --with-lucene --with-zlib
> and it seems to work:
>
> root at puma dump -Lv ./src/imap-login/.libs/imap-login | grep RUN
> [14]    RUNPATH
>  /usr/local/dovecot/lib/dovecot:/usr/local/lib:/usr/local/openssl-1.0.1e/lib:/usr/ccs/lib:/lib:/usr/lib:/usr/sfw/lib

It would be easier if you put openssl and your other software under a 
common prefix, $PREFIX/lib, (not a subdirectory).  The SONAME should 
sort out versions.

If you are doing a simple build you will get away with the standard 
handling of -L and -R.

$ PREFIX=/opt/PREFIX
$ export LDFLAGS="-R/opt/FIRST/lib:${PREFIX}/lib"
$ ./configure --prefix=${PREFIX} ...

Gives RPATH: /opt/PREFIX/lib/dovecot:/opt/FIRST/lib:/opt/PREFIX/lib
which I think will work for you.



Problems with libtool are when we require:
+ /opt/PREFIX/lib/$ISALIST at the front before /opt/PREFIX/lib/
+ a non standard lib is needed before the normal one instead of libtool 
using /opt/PREFIX/lib as the first

In general it is easier to let libtool think it is helping but ignore 
it.  Create a wrapper script around cc to rewrite the args back to what 
they were before configure+libtool rearranged, in this case drop the -L 
and -R given and substitute the values in $LDFLAGS.




More reading:
https://blogs.oracle.com/solaris/ldlibrarypath-just-say-no-v2
https://docs.oracle.com/cd/E86824_01/html/E54763/ld.so.1-1.html
https://docs.oracle.com/cd/E19683-01/816-1386/chapter3-13312/
Avoid crle, you don't need it and it affects the whole system.  Hint, 
you might need this to unlock your machine:
# LD_LIBRARY_PATH=/usr/lib rm /var/ld/ld.config










More information about the dovecot mailing list