Hello Charles, Assume that was you on IRC just now, but you may have missed my response. In my experience, linking mosh-server statically basically works fine -- the NSS stuff is generally a non-issue. My technique is just to do ./autogen.sh && ./configure && make. Then I rm src/frontend/mosh-server and run "make V=1" to see the actual linking command-line. Then I take that command-line, remove -fPIE and -pie, and add -static at the very end. Done.
I'm sure there's a fancier way to do it too that involves arguments to ./configure, and maybe somebody will chime in, but please do let me know if this doesn't do the trick for you. In general you probably don't want to add a .a archive on the linking command line -- even when linking statically, you do want the default arguments (probably -lprotobuf, but whatever pkg-config gives you) with a -static on the end, and the right thing will happen. Cheers, Keith On Sun, Dec 27, 2015 at 7:00 PM, Charles Curtit <c.cur...@gmail.com> wrote: > Hi people, > > > I'm trying to run mosh on centos 6 machines. And to a large extent, I > have succeeded to do that in the "normal" way. ie: compile stuff on > the machines I will use, and modify LD_LIBRARY_PATH adequately. > > What I'm trying to do now is avoid having to modify the > LD_LIBRARY_PATH env on all machines, avoid having to compile protobuf > on all machines. Since I need to do that because of protobufs, I'm > looking for a way to statically link protobuf into the binary then > distributed that. I have so far failed. > > When I statically compile the whole binary, I run into problems with > glibc (because of nss mostly, and missing dlopen, dl* symbols), and > when I try to statically link only /usr/local/lib/libprotobuf.a, I run > into trouble at link time for this library. > > > I compile protobufs like this: > > ./configure (tried --disable-shared and --static and both without > success, the error is always the same when compiling mosh) > make > make install (goes to /usr/local/lib/protobufs....) > > Then I compile mosh like so: > > ./configure protobuf_LIBS="/usr/local/lib/libprotobuf.a" > PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" > make > > And after a little while I get this : > CXXLD mosh-client > /usr/bin/ld: /usr/local/lib/libprotobuf.a(common.o): relocation > R_X86_64_32S against `std::basic_string<char, std::char_traits<char>, > std::allocator<char> >::_Rep::_S_empty_rep_storage' can not be used > when making a shared object; recompile with -fPIC > /usr/local/lib/libprotobuf.a: could not read symbols: Bad value > collect2: ld returned 1 exit status > make[3]: *** [mosh-client] Error 1 > make[3]: Leaving directory `/root/Downloads/mosh-1.2.5/src/frontend' > make[2]: *** [all-recursive] Error 1 > make[2]: Leaving directory `/root/Downloads/mosh-1.2.5/src' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/root/Downloads/mosh-1.2.5' > make: *** [all] Error 2 > > > Don't know how to make this work... If I replace libprotobuf.a by > libprotobuf.so, it compiles ok, but checking with ldd, the binaries > produced do dynamic linking against libprotobuf.so, which is what I'm > trying to avoid. > > I can't wrap my head around what exactly does protobuf_LIBS and the > interaction with PKG_CONFIG_PATH, so perhaps there is something > there... > Thanks for any help ! > Charles. > _______________________________________________ > mosh-users mailing list > mosh-users@mit.edu > http://mailman.mit.edu/mailman/listinfo/mosh-users _______________________________________________ mosh-users mailing list mosh-users@mit.edu http://mailman.mit.edu/mailman/listinfo/mosh-users