erigon icon indicating copy to clipboard operation
erigon copied to clipboard

New dynamic dependency within evm

Open namiloh opened this issue 1 year ago • 7 comments

Backtrace

I built the binary like this: https://github.com/holiman/goevmlab/blob/master/docker/Dockerfile#L46

RUN git clone https://github.com/ledgerwatch/erigon --depth 1
RUN cd erigon && make evm && cp ./build/bin/evm /erigon_vm

But the resulting binary has a new dynamic dependency which it didn't have previously:

root@683bec3f3dd9:/# ldd ./erigon_vm 
	linux-vdso.so.1 (0x00007ffc41bec000)
	libsilkworm_capi.so => not found
	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd6a130a000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd6a12e6000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd6a1104000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fd6a1565000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd6a1025000)
/erigon_vm: error while loading shared libraries: libsilkworm_capi.so: cannot open shared object file: No such file or directory

I guess I just need to dig it up and copy it over, or somehow enable static build mode. Just wanted to file this, in case you did not know that some recent change made a previously standalone binary into a dynamic dependency binary.

The location where it winds up is /go/pkg/mod/github.com/erigontech/[email protected]/lib/linux_x64/libsilkworm_capi.so

namiloh avatar Feb 06 '24 08:02 namiloh

@battlmonstr plz help

AskAlexSharov avatar Feb 06 '24 12:02 AskAlexSharov

here's my local hack to get around it, btw: https://github.com/holiman/goevmlab/pull/122/files

holiman avatar Feb 06 '24 12:02 holiman

@holiman @namiloh On this line:

RUN cd erigon && make evm && cp ./build/bin/evm /erigon_vm

Instead of cp please use make install like this:

RUN cd erigon && make evm && make DIST=/erigon_vm install

This will copy both evm and libsilkworm_capi.so to /erigon_vm

@AskAlexSharov do we have a FAQ somewhere? I'd like to document this.

battlmonstr avatar Feb 06 '24 13:02 battlmonstr

https://github.com/ledgerwatch/erigon/blob/devel/README.md#faq

AskAlexSharov avatar Feb 06 '24 14:02 AskAlexSharov

Using Erigon linux archive v2.58.1.tar.gz with go v1.22.0, running make erigon compiles with no errors, but get runtime error when starting up Erigon (systemctl start erigon):

Feb 24 23:23:39 xxxxxxxx systemd[1]: Started Erigon Execution Client (Mainnet). Feb 24 23:23:39 xxxxxxxx erigon[2062451]: /usr/local/bin/erigon/build/bin/erigon: error while loading shared libraries: libsilkworm_capi.so: cannot open shared object file: No such file or directory erigon.service: Main process exited, code=exited, status=127/n/a

How do I compile in the missing library? Or where do I get the missing library and what directory do I need to place it in for Erigon to find it?

Thank you

drjake007 avatar Feb 25 '24 08:02 drjake007

@drjake007 please use make DIST=<path> install command to get the binary + library at the same path. The library can be placed either in the same directory as the erigon binary, or in ../lib (lib in the parent).

battlmonstr avatar Feb 25 '24 10:02 battlmonstr

Got it working - thanks for the help - appreciate the quick response.

drjake007 avatar Feb 25 '24 21:02 drjake007

There's an FAQ entry about this now: https://github.com/ledgerwatch/erigon?tab=readme-ov-file#how-to-run-erigon-as-a-separate-user-eg-as-a-systemd-daemon

Please reopen if you still have this issue.

battlmonstr avatar Apr 10 '24 15:04 battlmonstr