Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation of a static binaries #166

Open
0x00031337 opened this issue Feb 20, 2019 · 3 comments
Open

Compilation of a static binaries #166

0x00031337 opened this issue Feb 20, 2019 · 3 comments

Comments

@0x00031337
Copy link

Is it possible to compile and link libraries statically? Monolithic binaries in some situations is more convenient than one that has several dozen dependencies and requires over 1GB of overhead.

@moneroexamples
Copy link
Owner

It should already been this way. All the monero dependencies are for compilation. Once compilation is done you get large xmrblocks binary (about 28MB on my os). After that just the xmrblocks and frontend template files should be enough to use it.

p.s.
Haven't checked that recently, so this information might be outdated. Would need to check it to make sure.

@0x00031337
Copy link
Author

0x00031337 commented Feb 27, 2019

Thanks for your reply. Indeed, the binaries have about 28MB, but it has many dependencies for dynamically loaded libraries. As a result, the Docker container has a volume of over 1.7GB. If we could link static libraries, we could limit to maybe 100-200MB. I'm not an expert on CMake, so maybe someone can help solve the problem?

insp@matrix:~$ docker images|grep explor
dr.localnet/monero-explorer   1                              9546254ab741        7 days ago          1.72GB
insp@matrix:~$ docker run -ti --rm dr.localnet/monero-explorer:1 bash
user@0c620295579a:~/onion-monero-blockchain-explorer/build$ ls -lh xmrblocks
-rwxr-xr-x 1 user user 28M Feb 20 07:46 xmrblocks
user@0c620295579a:~/onion-monero-blockchain-explorer/build$ ldd xmrblocks
        linux-vdso.so.1 (0x00007ffe533ab000)
        libsodium.so.18 => /usr/lib/x86_64-linux-gnu/libsodium.so.18 (0x00007efc9ea55000)
        libboost_system.so.1.62.0 => /usr/lib/x86_64-linux-gnu/libboost_system.so.1.62.0 (0x00007efc9e851000)
        libboost_filesystem.so.1.62.0 => /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.62.0 (0x00007efc9e638000)
        libboost_thread.so.1.62.0 => /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.62.0 (0x00007efc9e410000)
        libboost_date_time.so.1.62.0 => /usr/lib/x86_64-linux-gnu/libboost_date_time.so.1.62.0 (0x00007efc9e1ff000)
        libboost_chrono.so.1.62.0 => /usr/lib/x86_64-linux-gnu/libboost_chrono.so.1.62.0 (0x00007efc9dff8000)
        libboost_regex.so.1.62.0 => /usr/lib/x86_64-linux-gnu/libboost_regex.so.1.62.0 (0x00007efc9dcdf000)
        libboost_serialization.so.1.62.0 => /usr/lib/x86_64-linux-gnu/libboost_serialization.so.1.62.0 (0x00007efc9da9e000)
        libboost_program_options.so.1.62.0 => /usr/lib/x86_64-linux-gnu/libboost_program_options.so.1.62.0 (0x00007efc9d81f000)
        libboost_atomic.so.1.62.0 => /usr/lib/x86_64-linux-gnu/libboost_atomic.so.1.62.0 (0x00007efc9d61d000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007efc9d400000)
        libunbound.so.2 => /usr/lib/x86_64-linux-gnu/libunbound.so.2 (0x00007efc9d160000)
        libcurl.so.4 => /usr/lib/x86_64-linux-gnu/libcurl.so.4 (0x00007efc9cee0000)
        libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007efc9ca47000)
        libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007efc9c7db000)
        libatomic.so.1 => /usr/lib/x86_64-linux-gnu/libatomic.so.1 (0x00007efc9c5d3000)
        libunwind.so.8 => /usr/lib/x86_64-linux-gnu/libunwind.so.8 (0x00007efc9c3b8000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007efc9c1b4000)
        libhidapi-libusb.so.0 => /usr/lib/x86_64-linux-gnu/libhidapi-libusb.so.0 (0x00007efc9bfac000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007efc9bc2a000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efc9b926000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007efc9b70f000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efc9b370000)
        /lib64/ld-linux-x86-64.so.2 (0x00007efc9fd4d000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007efc9b168000)
        libicudata.so.57 => /usr/lib/x86_64-linux-gnu/libicudata.so.57 (0x00007efc996eb000)
        libicui18n.so.57 => /usr/lib/x86_64-linux-gnu/libicui18n.so.57 (0x00007efc99271000)
        libicuuc.so.57 => /usr/lib/x86_64-linux-gnu/libicuuc.so.57 (0x00007efc98ec9000)
        libhogweed.so.4 => /usr/lib/x86_64-linux-gnu/libhogweed.so.4 (0x00007efc98c94000)
        libnettle.so.6 => /usr/lib/x86_64-linux-gnu/libnettle.so.6 (0x00007efc98a5d000)
        libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007efc987da000)
        libnghttp2.so.14 => /usr/lib/x86_64-linux-gnu/libnghttp2.so.14 (0x00007efc985b4000)
        libidn2.so.0 => /usr/lib/x86_64-linux-gnu/libidn2.so.0 (0x00007efc98392000)
        librtmp.so.1 => /usr/lib/x86_64-linux-gnu/librtmp.so.1 (0x00007efc98175000)
        libssh2.so.1 => /usr/lib/x86_64-linux-gnu/libssh2.so.1 (0x00007efc97f49000)
        libpsl.so.5 => /usr/lib/x86_64-linux-gnu/libpsl.so.5 (0x00007efc97d3b000)
        libssl.so.1.0.2 => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2 (0x00007efc97ad2000)
        libcrypto.so.1.0.2 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.2 (0x00007efc9766c000)
        libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007efc97421000)
        libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007efc97147000)
        libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007efc96f14000)
        libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007efc96d10000)
        liblber-2.4.so.2 => /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 (0x00007efc96b01000)
        libldap_r-2.4.so.2 => /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 (0x00007efc968b0000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007efc96696000)
        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007efc96470000)
        libusb-1.0.so.0 => /lib/x86_64-linux-gnu/libusb-1.0.so.0 (0x00007efc96257000)
        libunistring.so.0 => /usr/lib/x86_64-linux-gnu/libunistring.so.0 (0x00007efc95f40000)
        libgnutls.so.30 => /usr/lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007efc95ba7000)
        libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007efc95897000)
        libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007efc9568b000)
        libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007efc95487000)
        libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007efc95270000)
        libsasl2.so.2 => /usr/lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007efc95055000)
        libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007efc9ff33000)
        libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007efc94df0000)
        libidn.so.11 => /lib/x86_64-linux-gnu/libidn.so.11 (0x00007efc94bbc000)
        libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007efc949a9000)
        libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007efc94795000)
        libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007efc9458c000)

@moneroexamples
Copy link
Owner

I see. I will try to look into it the static linking can be improved. For now I focusing on the upcoming monero fork, so not sure if I could look into the static linking at this moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants