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

WIP: add option to build Alpine Linux image for Substrate builder to generate 236MB image size #2

Closed

Conversation

ltfschoen
Copy link
Owner

@ltfschoen ltfschoen commented Jan 6, 2023

  • it currently works to an extent because i used this tip https://dev.classmethod.jp/articles/docker-alpine-glibc-error/ and reverted to using older version 2.34-rc0 and commented out the line # ldd ..., but when you run docker run --rm -it parity/substrate substrate --version it outputs the following, where the version is shown after other logs. the other commands work so you can run a node:
substrate: /usr/lib/libstdc++.so.6: no version information available (required by substrate)          │
substrate 3.0.0-dev-unknown

there are a lot of open issues in the repository that i'm using https://github.com/sgerrand/alpine-pkg-glibc that are likely the cause of the error

the image size is 236MB, where the rm -rf lines reduce it down from 250MB

parity/substrate   latest    d7b25e32abae   Less than a second ago   236MB                            │
parity/substrate   v3.0.0    d7b25e32abae   Less than a second ago   236MB

size of binaries that are built are:

chain-spec-builder 21MB
node-template 74.5MB
subkey 11.5MB
substrate 96.5MB

note: after building them i copied them to local machine with docker cp <CONTAINER_ID>:/usr/local/bin/substrate ./tmp/ and modified the dockerfile to copy the built ones across to avoid having to compile to debug.

if i uncomment ldd ..., then when i run ./build.sh it outputs:

#19 5.899 Executing glibc-bin-2.34-r0.trigger
#19 5.906 OK: 34 MiB in 28 packages
#19 5.961   /lib64/ld-linux-x86-64.so.2 (0x7f4855559000)
#19 5.961   libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f48515a5000)
#19 5.961   libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f4851587000)
#19 5.961   librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7f4855559000)
#19 5.961   libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f4855559000)
#19 5.961   libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f4855559000)
#19 5.961   libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f4855559000)
#19 5.961   libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f4855559000)
#19 5.961   ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x7f4851553000)
#19 5.962 Error relocating /lib/ld-linux-x86-64.so.2: unsupported relocation type 37
#19 5.962 Error relocating /usr/local/bin/substrate: __register_atfork: symbol not found
#19 5.964 Error relocating /usr/local/bin/substrate: gnu_get_libc_version: symbol not found
#19 5.964 Error relocating /usr/local/bin/substrate: __res_init: symbol not found

if i use 2.35-rc0 then run ./build.sh it outputs

#19 10.000 Error relocating /lib/ld-linux-x86-64.so.2: unsupported relocation type 37                 │
#19 10.000 Error relocating /usr/local/bin/substrate: __register_atfork: symbol not found             │
#19 10.00 Error relocating /usr/local/bin/substrate: gnu_get_libc_version: symbol not found           │
#19 10.00 Error relocating /usr/local/bin/substrate: __res_init: symbol not found 

prior to using fetching the glibc from the https://github.com/sgerrand/alpine-pkg-glibc repository in the dockerfile, i was just using default alpine which uses busybox instead, so the dockerfile just had:

RUN apk upgrade --no-cache && \
    apk add --no-cache libgcc libstdc++ openssl gcompat && \

instead of all this snippet

ENV GLIBC_REPO=https://github.com/sgerrand/alpine-pkg-glibc
ENV GLIBC_VERSION=2.34-r0

RUN apk update --no-cache && \
	apk add --no-cache git curl binutils && \
	curl -sL https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub && \
	curl -sLO "${GLIBC_REPO}/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk" && \
	curl -sLO "${GLIBC_REPO}/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk" && \
	apk add --force-overwrite --no-cache glibc-${GLIBC_VERSION}.apk glibc-bin-${GLIBC_VERSION}.apk && \

i compared the ubuntu and alpine image sizes, where latest alpine is 3.17

$ docker pull --quiet ubuntu:20.04 && docker pull --quiet alpine:latest && docker images
docker.io/library/ubuntu:20.04
docker.io/library/alpine:latest
REPOSITORY         TAG       IMAGE ID       CREATED        SIZE
ubuntu             20.04     d5447fc01ae6   3 weeks ago    72.8MB
alpine             latest    49176f190c7e   6 weeks ago    7.05MB

inspected the image and its file size breakdown and its user groups

docker run --rm -it alpine:latest /bin/sh
du -hc .[^.]* * | grep [MG]
getent group

and then in the dockerfile i just did;

RUN apk upgrade --no-cache && \
    apk add --no-cache libgcc libstdc++ openssl gcompat && \

but it still gave errors when running ./build.sh (note how these are busybox errors rather than glibc errors

#19 1.603 Executing busybox-1.35.0-r29.trigger
#19 1.609 OK: 11 MiB in 21 packages
#19 1.669 	/lib64/ld-linux-x86-64.so.2 (0x7fdb733d4000)
#19 1.669 	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7fdb6f420000)
#19 1.669 	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7fdb6f402000)
#19 1.669 	librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7fdb733d4000)
#19 1.669 	libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7fdb733d4000)
#19 1.669 	libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fdb733d4000)
#19 1.669 	libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7fdb733d4000)
#19 1.669 	libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fdb733d4000)
#19 1.669 	ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x7fdb6f3fc000)
#19 1.671 Error relocating /usr/local/bin/substrate: __register_atfork: symbol not found
#19 1.675 Error relocating /usr/local/bin/substrate: gnu_get_libc_version: symbol not found
#19 1.675 Error relocating /usr/local/bin/substrate: __res_init: symbol not found

which overcame a lot of the folllowing errors:

#15 0.260 Error loading shared library libstdc++.so.6: No such file or directory (needed by /usr/local/bin/substrate)
#15 0.260 Error loading shared library libgcc_s.so.1: No such file or directory (needed by /usr/local/bin/substrate)
#15 0.260 Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /usr/local/bin/substrate)
#15 0.260   librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7f772f688000)
#15 0.260   libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f772f688000)
#15 0.260   libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f772f688000)
#15 0.260   libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f772f688000)
#15 0.260   libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f772f688000)
#15 0.260 Error relocating /usr/local/bin/substrate: _Unwind_Resume: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: _Znwm: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: _ZdaPv: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: _ZdlPv: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: _ZSt19__throw_logic_errorPKc: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: _ZSt20__throw_length_errorPKc: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: _ZSt17__throw_bad_allocv: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: _Znam: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: __cxa_begin_catch: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: __cxa_rethrow: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: __cxa_end_catch: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: _ZSt9terminatev: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: _ZSt11_Hash_bytesPKvmm: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: _ZNKSt8__detail20_Prime_rehash_policy14_M_need_rehashEmmm: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: _ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: _ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: _ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base: symbol not found
#15 0.260 Error relocating /usr/local/bin/substrate: _ZSt25__throw_bad_function_callv: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZdlPvSt11align_val_t: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZSt24__throw_out_of_range_fmtPKcz: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt18condition_variableC1Ev: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt18condition_variableD1Ev: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZSt28_Rb_tree_rebalance_for_erasePSt18_Rb_tree_node_baseRS_: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1ESt13_Ios_Openmode: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNKSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE3strEv: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSo9_M_insertImEERSoT_: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt6localeD1Ev: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt8ios_baseD2Ev: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1ESt13_Ios_Openmode: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEED1Ev: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZSt18_Rb_tree_decrementPKSt18_Rb_tree_node_base: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt8__detail15_List_node_base7_M_hookEPS0_: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt8__detail15_List_node_base9_M_unhookEv: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: __cxa_guard_acquire: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: __cxa_guard_release: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: __cxa_guard_abort: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZSt20__throw_system_errori: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNKSt8__detail20_Prime_rehash_policy11_M_next_bktEm: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZSt20__throw_out_of_rangePKc: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: __cxa_allocate_exception: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: __cxa_throw: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNKSt5ctypeIcE13_M_widen_initEv: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSo3putEc: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSo5flushEv: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZSt16__throw_bad_castv: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSolsEi: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSo9_M_insertIlEERSoT_: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt6chrono3_V212system_clock3nowEv: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt6thread4joinEv: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt6thread15_M_start_threadESt10unique_ptrINS_6_StateESt14default_deleteIS1_EEPFvvE: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSo9_M_insertIdEERSoT_: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt6thread6_StateD2Ev: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZnwmSt11align_val_t: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt18condition_variable10notify_allEv: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt8ios_base4InitC1Ev: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSo9_M_insertIPKvEERSoT_: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt13runtime_errorC1EPKc: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: __cxa_free_exception: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt8__detail15_List_node_base11_M_transferEPS0_S1_: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt8ios_baseC2Ev: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_E: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt6localeC1Ev: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt6chrono3_V212steady_clock3nowEv: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt18condition_variable10notify_oneEv: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1ERKNS_12basic_stringIcS2_S3_EESt13_Ios_Openmode: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt13random_device7_M_initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt13random_device9_M_getvalEv: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt13random_device7_M_finiEv: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt6thread20hardware_concurrencyEv: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: __cxa_thread_atexit: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEC1ERKNS_12basic_stringIcS2_S3_EESt13_Ios_Openmode: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEED1Ev: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt16invalid_argumentC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt12out_of_rangeC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZSt24__throw_invalid_argumentPKc: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: _ZNSt6thread6detachEv: symbol not found
#15 0.261 Error relocating /usr/local/bin/substrate: __register_atfork: symbol not found
#15 0.265 Error relocating /usr/local/bin/substrate: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
#15 0.266 Error relocating /usr/local/bin/substrate: __cxa_pure_virtual: symbol not found
#15 0.266 Error relocating /usr/local/bin/substrate: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: __gxx_personality_v0: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTVNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTVSt15basic_streambufIcSt11char_traitsIcEE: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTTNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEE: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTVSt12bad_weak_ptr: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTISt12bad_weak_ptr: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt12bad_weak_ptrD1Ev: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTVN10__cxxabiv121__vmi_class_type_infoE: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTVN10__cxxabiv120__function_type_infoE: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTVN10__cxxabiv119__pointer_type_infoE: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt6thread6_StateD2Ev: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTINSt6thread6_StateE: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt8ios_base4InitD1Ev: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTISt13runtime_error: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt13runtime_errorD1Ev: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTVSt9basic_iosIcSt11char_traitsIcEE: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTVNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEE: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZSt15__once_callable: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZSt11__once_call: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: __once_proxy: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTTNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEE: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTISt9exception: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTVSo: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt15basic_streambufIcSt11char_traitsIcEE5imbueERKSt6locale: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE6setbufEPcl: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE7seekoffElSt12_Ios_SeekdirSt13_Ios_Openmode: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE7seekposESt4fposI11__mbstate_tESt13_Ios_Openmode: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt15basic_streambufIcSt11char_traitsIcEE4syncEv: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE9showmanycEv: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt15basic_streambufIcSt11char_traitsIcEE6xsgetnEPcl: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE9underflowEv: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt15basic_streambufIcSt11char_traitsIcEE5uflowEv: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE9pbackfailEi: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTINSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTISt16invalid_argument: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt16invalid_argumentD1Ev: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZTISt12out_of_range: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _ZNSt12out_of_rangeD1Ev: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _Unwind_GetIP: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _Unwind_FindEnclosingFunction: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _Unwind_GetCFA: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _Unwind_Backtrace: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: __deregister_frame: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: __register_frame: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _Unwind_GetTextRelBase: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _Unwind_GetDataRelBase: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: gnu_get_libc_version: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: __res_init: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _Unwind_GetLanguageSpecificData: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _Unwind_GetIPInfo: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _Unwind_GetRegionStart: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _Unwind_SetGR: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _Unwind_SetIP: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _Unwind_DeleteException: symbol not found
#15 0.267 Error relocating /usr/local/bin/substrate: _Unwind_RaiseException: symbol not found
#15 1.207   /lib64/ld-linux-x86-64.so.2 (0x7f12b81d3000)
#15 1.207   libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f12b421f000)
#15 1.208   libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f12b4201000)
#15 1.208   librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7f12b81d3000)
#15 1.208   libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f12b81d3000)
#15 1.208   libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f12b81d3000)
#15 1.208   libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f12b81d3000)
#15 1.208   libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f12b81d3000)
#15 1.208 Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /usr/local/bin/substrate)
#15 1.209 Error relocating /usr/local/bin/substrate: __register_atfork: symbol not found
#15 1.213 Error relocating /usr/local/bin/substrate: gnu_get_libc_version: symbol not found
#15 1.213 Error relocating /usr/local/bin/substrate: __res_init: symbol not found
#15 1.622   /lib64/ld-linux-x86-64.so.2 (0x7ffb84405000)
#15 1.622   libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7ffb80451000)
#15 1.622   libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7ffb80433000)
#15 1.622   librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7ffb84405000)
#15 1.622   libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7ffb84405000)
#15 1.622   libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7ffb84405000)
#15 1.622   libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7ffb84405000)
#15 1.622   libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7ffb84405000)
#15 1.622   ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x7ffb8042d000)
#15 1.624 Error relocating /usr/local/bin/substrate: __register_atfork: symbol not found
#15 1.628 Error relocating /usr/local/bin/substrate: gnu_get_libc_version: symbol not found
#15 1.628 Error relocating /usr/local/bin/substrate: __res_init: symbol not found

* it currently works because i used this tip https://dev.classmethod.jp/articles/docker-alpine-glibc-error/ and reverted to using older version 2.34-rc0 and commented out the line `# ldd ...`, but when you run `docker run --rm -it parity/substrate substrate --version` it
outputs the following, where the version is shown after other logs. the other commands work so you can run a node:
```
substrate: /usr/lib/libstdc++.so.6: no version information available (required by substrate)          │
substrate 3.0.0-dev-unknown
```

the image size is 236MB, where the `rm -rf` lines reduce it down from 250MB

    parity/substrate   latest    d7b25e32abae   Less than a second ago   236MB                            │
    parity/substrate   v3.0.0    d7b25e32abae   Less than a second ago   236MB

size of binaries that are built are:

chain-spec-builder 21MB
node-template 74.5MB
subkey 11.5MB
substrate 96.5MB

note: after building them i copied them to local machine with `docker cp <CONTAINER_ID>:/usr/local/bin/substrate ./tmp/` and modified the dockerfile to copy the built ones across to avoid having to compile to debug.

if i uncomment `ldd ...`, then when i run ./build.sh it outputs:
```
```

if i use 2.35-rc0 then run ./build.sh it outputs
```
```
@ltfschoen ltfschoen changed the title WIP: add option to buid alpine image for substrate builder to generate 236MB image size WIP: add option to build Alpine Linux image for Substrate builder to generate 236MB image size Jan 6, 2023
ltfschoen pushed a commit that referenced this pull request Aug 19, 2023
* Cherry pick all crypto related changes from pull-request paritytech#13311
applied to master's head

* Import some stuff just if 'full_crypto' is on

* Remove copyright year

* Cleanup

* First generic BLS draft

* Finalize generic implementation

* Restore tests

* Fix rust docs

* Fix after master merge

* Fix after master merge

* Use double bls with G1 as signature group and verify individual signatures using DLEQ proof.

* Fix inclusions and types used within substrate

* Remove unused cruft

* Restore usage of upstream crates

* Fix test

* Reduce the diff by aligning Cargo.lock to master

* Application-crypto provides bls381

* Implement bls381 for local keystore

* Use new generic keystore features

* import DoublePublickey[Scheme] from the bls-like root to be less confusing.

* fix compilation

* Apply suggestions from code review

Co-authored-by: Robert Hambrock <roberthambrock@gmail.com>

* Clean leftovers

* - update bls test vector after applying spec change recommendation.
- send message as ref.

* Different hard junction ids for different bls12 types

* update to new bls-like

* bls-like → w3f-bls

* Make clippy happy

* update test vector after replacing hash and crop with hash to field.

* cargo fmt

* account for paritytech#13972

* hide BLS behind "bls_non_production" feature flag

* Remove Cargo.lock entries duplicated in merge

* add bls377 to primitives/keystore and client/keystore
add bls377 to primitives/application-crypto/
add bls_non_production to primitives/keystore and client/keystore
bump up w3f-bls version

* rename feature `bls_non_production` to `bls-experimental`

---------

Co-authored-by: Davide Galassi <davxy@datawok.net>
Co-authored-by: André Silva <andrerfosilva@gmail.com>
Co-authored-by: Robert Hambrock <roberthambrock@gmail.com>
@ltfschoen ltfschoen closed this Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant