PurpleI2P / i2pd

🛡 I2P: End-to-End encrypted and anonymous Internet
https://i2pd.website
BSD 3-Clause "New" or "Revised" License
3.25k stars 423 forks source link

[proposal] Make static release builds #602

Open l-n-s opened 8 years ago

l-n-s commented 8 years ago

Quote from IRC:

SGLG hints to the devs of i2pd that it would be really nice if there were a statically compiled tar.gz'ed pre-compiled version that could be extracted and ran from the folder it was extracted to.

Portable binary? Sounds like a good idea.

majestrate commented 8 years ago

I have this for linux armhf, would be nice to have a script that pulls in dependencies and builds a static release.

orignal commented 8 years ago

@hagen-i2p had some concerns about static builds for linux

hagen-i2p commented 8 years ago

Several releases ago there was issues with static build on unix with glibc/gethostbyname(), because it's nsswitch support with pluggable modules.

I'll try again.

hagen-i2p commented 8 years ago

The same warning. See message in last line.

/usr/lib/x86_64-linux-gnu/libcrypto.a(dso_dlfcn.o): In function dlfcn_globallookup': (.text+0x11): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking libi2pd.a(Reseed.o): In functionboost::asio::detail::socketops::getaddrinfo(char const, char const_, addrinfo const&, addrinfo**, boost::system::error_code&)': /usr/include/boost/asio/detail/impl/socket_ops.ipp:3177: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

christiaan commented 8 years ago

@hagen-i2p that commit fixed the option to statically build awesome!

Since this is a proposal for the static builds can I request static builds for armel? I have been trying it for a while now with a armel cmake toolchain using -DCMAKE_TOOLCHAIN_FILE= without any succes.

l-n-s commented 8 years ago

I've just tried to build static i2pd with openssl and it gave me such error:

/tmp/static/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
dso_dlfcn.c:(.text+0x11): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x24): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x2f): undefined reference to `dlclose'
/tmp/static/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
dso_dlfcn.c:(.text+0x334): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x3db): undefined reference to `dlerror'
/tmp/static/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
dso_dlfcn.c:(.text+0x454): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x4fb): undefined reference to `dlerror'
/tmp/static/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
dso_dlfcn.c:(.text+0x569): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x5cb): undefined reference to `dlclose'
dso_dlfcn.c:(.text+0x603): undefined reference to `dlerror'
/tmp/static/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr':
dso_dlfcn.c:(.text+0x69f): undefined reference to `dladdr'
dso_dlfcn.c:(.text+0x709): undefined reference to `dlerror'
/tmp/static/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
dso_dlfcn.c:(.text+0x762): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
Makefile:67: recipe for target 'i2pd' failed
make: *** [i2pd] Error 1

Google search showed that to fix that issue, I'll need to add -ldl flag here

After that, it compiles and works perfect.

EDIT: I build with such command:

make LIBDIR="$STATDIR/lib" USE_STATIC=yes INCFLAGS="-I$STATDIR/include"
r4sas commented 6 years ago

Did we still need that issue?

l-n-s commented 6 years ago

There is big demand for static Raspberry Pi build, so I guess yes

r4sas commented 6 years ago

Now here no problems to build staticly, because I already created needed chroots for building packages, where I can also build static binary.