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

remove ncli re import/libpcre dependency #4208

Merged
merged 1 commit into from
Oct 3, 2022
Merged

remove ncli re import/libpcre dependency #4208

merged 1 commit into from
Oct 3, 2022

Conversation

tersec
Copy link
Contributor

@tersec tersec commented Oct 3, 2022

https://nim-lang.org/docs/re.html is

implemented by providing a wrapper around the PCRE (Perl-Compatible Regular Expressions) C library.

In particular, https://github.com/nim-lang/Nim/blob/8ccde68f132be4dba330eb6ec50f4679e564efac/lib/wrappers/pcre.nim#L313-L329 pulls in libpcre using some system and configuration-dependent method:

when not defined(usePcreHeader):
  when hostOS == "windows":
    when defined(nimOldDlls):
      const pcreDll = "pcre.dll"
    elif defined(cpu64):
      const pcreDll = "pcre64.dll"
    else:
      const pcreDll = "pcre32.dll"
  elif hostOS == "macosx":
    const pcreDll = "libpcre(.3|.1|).dylib"
  else:
    const pcreDll = "libpcre.so(.3|.1|)"
  {.push dynlib: pcreDll.}
else:
  {.push header: "<pcre.h>".}

{.push cdecl, importc: "pcre_$1".}

nimbus-eth doesn't otherwise seem to use the re module, so this should remove the its last vestige, and keep nimbus-eth2 free of such dependency hazards.

Otherwise, when running ncli_db without a supported version of libpcre (not a documented requirement):

nimbus-eth2$ build/ncli_db 
could not load: libpcre.so(.3|.1|)
compile with -d:nimDebugDlOpen for more information

@tersec tersec enabled auto-merge (squash) October 3, 2022 13:08
@jakubgs
Copy link
Member

jakubgs commented Oct 3, 2022

I checked out this bizarrely named anO branch and it appears to fix the could not load: libpcre.so(.3|.1|) error:

~/work/nimbus-eth2 anO
 > make ncli_db -j12
Building: install/usr/lib/libbacktracenim.a
Building: build/generate_makefile
Build completed successfully: build/generate_makefile
Building: build/ncli_db
Build completed successfully: build/ncli_db

~/work/nimbus-eth2 anO
 > build/ncli_db --help   
Usage: 

ncli_db [OPTIONS]... command

The following options are available:

 --db           Directory where `nbc.sqlite` is stored.
 --network      The Eth2 network preset to use.
...

Thanks!

@zah zah disabled auto-merge October 3, 2022 21:43
@zah zah merged commit 5da94ad into unstable Oct 3, 2022
@zah zah deleted the anO branch October 3, 2022 21:43
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

Successfully merging this pull request may close these issues.

4 participants