Yamato-Security / takajo

Takajō (鷹匠) is a Hayabusa results analyzer.
https://yamato-security.github.io/takajo/
GNU General Public License v3.0
59 stars 4 forks source link

Replace Puppy with standard HTTP client? #160

Open YamatoSecurity opened 1 month ago

YamatoSecurity commented 1 month ago

@fukusuket What about replacing Puppy with https://nim-lang.org/docs/httpclient.html in order to be able to compile static linux binaries?

fukusuket commented 1 month ago

@YamatoSecurity Yes, I think it's good! My only concern is that a dll is required on Windows, but is that OK?

YamatoSecurity commented 1 month ago

@fukusuket Since we already require separate dlls to be bundled I don't think there is any problem to add one more. As long as it can compile statically on linux and macos.

fukusuket commented 1 month ago

@YamatoSecurity I see, that's fine then, I agree with replacing it with HTTP client!

fukusuket commented 1 month ago

I'll try implementing it!

fukusuket commented 1 month ago

@YamatoSecurity I tried the httpclient.html, but unforunatelly it seems that a similar issue also occurs :( It seems difficult to resolve, I'll put it hold on now.

YamatoSecurity commented 1 month ago

@fukusuket Thanks so much for implementing it. It seems the problem is that libpcre is still being compiled dynamically. This person figured out how to compile it statically: https://forum.nim-lang.org/t/5160 Also, nimpcre might work: https://github.com/genotrance/nimpcre

fukusuket commented 1 month ago

@YamatoSecurity Thank you for information! I tried, but got a compile error :( It was last committed 4 years ago, so it may not be compatible with recent versions of Nim...?😭

fukusuke@ub:~/takajo$ nimble build -d:release --threads:on --gcc.exe:"musl-gcc" --gcc.linkerexe:"musl-gcc" --passL="-static" -d:nimDebugDlOpen
  Verifying dependencies for takajo@2.5.0
     Info:  Dependency on cligen@>= 1.5 already satisfied
  Verifying dependencies for cligen@1.7.0
     Info:  Dependency on suru@#f6f1e607c585b2bc2f71309996643f0555ff6349 already satisfied
  Verifying dependencies for suru@0.3.1
     Info:  Dependency on termstyle@any version already satisfied
  Verifying dependencies for termstyle@0.1.0
     Info:  Dependency on nancy@any version already satisfied
  Verifying dependencies for nancy@0.1.1
     Info:  Dependency on ansiparse@>= 0.2.0 already satisfied
  Verifying dependencies for ansiparse@0.4.0
     Info:  Dependency on jsony@>= 1.1.5 already satisfied
  Verifying dependencies for jsony@1.1.5
     Info:  Dependency on bearssl@any version already satisfied
  Verifying dependencies for bearssl@0.2.2
     Info:  Dependency on unittest2@any version already satisfied
  Verifying dependencies for unittest2@0.2.2
     Info:  Dependency on nimpcre@any version already satisfied
  Verifying dependencies for nimpcre@0.2.1
     Info:  Dependency on nimterop@>= 0.4.4 already satisfied
  Verifying dependencies for nimterop@0.6.13
     Info:  Dependency on regex@>= 0.15.0 already satisfied
  Verifying dependencies for regex@0.25.0
     Info:  Dependency on unicodedb@>= 0.7.2 already satisfied
  Verifying dependencies for unicodedb@0.12.0
     Info:  Dependency on cligen@>= 1.0.0 already satisfied
  Verifying dependencies for cligen@1.7.0
   Building takajo/takajo using c backend
stack trace: (most recent call last)
nimpcre.nim(7, 11)       nimpcre
assertions.nim(41, 14)   failedAssertImpl
assertions.nim(36, 13)   raiseAssert
fatal.nim(53, 5)         sysFatal
/home/fukusuke/.choosenim/toolchains/nim-2.0.2/lib/system/fatal.nim(53, 5) Error: unhandled exception: nimpcre.nim(7, 5) `false` Error: -d:usePcreHeader is required [AssertionDefect]
       Tip: 36 messages have been suppressed, use --verbose to show them.
nimble.nim(229)          buildFromDir

    Error:  Build failed for the package: takajo
fukusuke@ub:~/takajo$ nimble build -d:release --threads:on --gcc.exe:"musl-gcc" --gcc.linkerexe:"musl-gcc" --passL="-static" -d:nimDebugDlOpen -d:usePcreHeader
  Verifying dependencies for takajo@2.5.0
     Info:  Dependency on cligen@>= 1.5 already satisfied
  Verifying dependencies for cligen@1.7.0
     Info:  Dependency on suru@#f6f1e607c585b2bc2f71309996643f0555ff6349 already satisfied
  Verifying dependencies for suru@0.3.1
     Info:  Dependency on termstyle@any version already satisfied
  Verifying dependencies for termstyle@0.1.0
     Info:  Dependency on nancy@any version already satisfied
  Verifying dependencies for nancy@0.1.1
     Info:  Dependency on ansiparse@>= 0.2.0 already satisfied
  Verifying dependencies for ansiparse@0.4.0
     Info:  Dependency on jsony@>= 1.1.5 already satisfied
  Verifying dependencies for jsony@1.1.5
     Info:  Dependency on bearssl@any version already satisfied
  Verifying dependencies for bearssl@0.2.2
     Info:  Dependency on unittest2@any version already satisfied
  Verifying dependencies for unittest2@0.2.2
     Info:  Dependency on nimpcre@any version already satisfied
  Verifying dependencies for nimpcre@0.2.1
     Info:  Dependency on nimterop@>= 0.4.4 already satisfied
  Verifying dependencies for nimterop@0.6.13
     Info:  Dependency on regex@>= 0.15.0 already satisfied
  Verifying dependencies for regex@0.25.0
     Info:  Dependency on unicodedb@>= 0.7.2 already satisfied
  Verifying dependencies for unicodedb@0.12.0
     Info:  Dependency on cligen@>= 1.0.0 already satisfied
  Verifying dependencies for cligen@1.7.0
   Building takajo/takajo using c backend
/home/fukusuke/.nimble/pkgs2/nimpcre-0.2.1-3377b148d8e5e1c87e45259d2d4ebb1495ba354c/nimpcre.nim(24, 10) template/generic instantiation of `getHeader` from here
/home/fukusuke/.nimble/pkgs2/nimterop-0.6.13-a93246b2ad5531db11e51de7b2d188c42d95576a/nimterop/build/getheader.nim(421, 65) Error: type mismatch
Expression: true == 1
  [1] true: bool
  [2] 1: int literal(1)

Expected one of (first mismatch at [position]):
[1] proc `==`(a, b: NimIdent): bool
[1] proc `==`(a, b: NimNode): bool
[1] proc `==`(a, b: NimSym): bool
[1] proc `==`(err1, err2: OSErrorCode): bool
[1] proc `==`(pkg1, pkg2: ConanPackage): bool
[1] proc `==`(pkg1, pkg2: JBBPackage): bool
[1] proc `==`(x, y: char): bool
[1] proc `==`(x, y: cstring): bool
[1] proc `==`(x, y: float): bool
[1] proc `==`(x, y: float32): bool
[1] proc `==`(x, y: int): bool
[1] proc `==`(x, y: int16): bool
[1] proc `==`(x, y: int32): bool
[1] proc `==`(x, y: int64): bool
[1] proc `==`(x, y: int8): bool
[1] proc `==`(x, y: pointer): bool
[1] proc `==`(x, y: string): bool
[1] proc `==`(x, y: uint): bool
[1] proc `==`(x, y: uint16): bool
[1] proc `==`(x, y: uint32): bool
[1] proc `==`(x, y: uint64): bool
[1] proc `==`(x, y: uint8): bool
[1] proc `==`[A, B](s, t: OrderedTableRef[A, B]): bool
[1] proc `==`[A, B](s, t: OrderedTable[A, B]): bool
[1] proc `==`[A, B](s, t: TableRef[A, B]): bool
[1] proc `==`[A, B](s, t: Table[A, B]): bool
[1] proc `==`[A](s, t: CountTableRef[A]): bool
[1] proc `==`[A](s, t: CountTable[A]): bool
[1] proc `==`[Enum: enum](x, y: Enum): bool
[1] proc `==`[I, T](x, y: array[I, T]): bool
[1] proc `==`[T: proc | iterator](x, y: T): bool
[1] proc `==`[T: tuple | object](x, y: T): bool
[1] proc `==`[T](x, y: openArray[T]): bool
[1] proc `==`[T](x, y: ptr T): bool
[1] proc `==`[T](x, y: ref T): bool
[1] proc `==`[T](x, y: seq[T]): bool
[1] proc `==`[T](x, y: set[T]): bool
[2] proc `==`(x, y: bool): bool

       Tip: 28 messages have been suppressed, use --verbose to show them.
nimble.nim(229)          buildFromDir

    Error:  Build failed for the package: takajo