static binaries

2022-04-21 Thread enthus1ast
Maybe you could build the pgclient with musl statically and link it to your application.

static binaries

2022-04-21 Thread tmsa04
It's too late to edit the above post, here's some other ideas. Supply a bundled libc and link to that: Or possibly write a script so it builds easily on the target system, or if it was practical, break the ap

static binaries

2022-04-21 Thread tmsa04
I don't know if this applies here, but some time ago I wrote something to run on a minimal libc implementation as well as the usual glibc one. A precompiled binary would work fine and was portable to other versions but only if I restricted the code to using functions available in both libc's, ot

static binaries

2022-04-21 Thread archnim
Now I understand what you I trying to do. This is what I thought you were doing: * You call a static lib in your main module * You call a dynamic lib in your main module * You compile all together (without --passL:-static) That's why I said that it should be normally possible. But this i

static binaries

2022-04-21 Thread daef
Building my own, static, libpq.a seems like a last resort - true.

static binaries

2022-04-21 Thread daef
Can you justify this statement? At least [this answer](https://serverfault.com/a/490270) keeps me hopeful at the moment...

static binaries

2022-04-21 Thread daef
I think this is as minimal as it gets...: import std/db_postgres let fake = open("","","","") fake.close Run compile with nim --gcc.exe:musl-gcc --gcc.linkerexe:musl-gcc --passL:-static c test.nim Run

static binaries

2022-04-21 Thread Yardanico
That's not a bug, it's not possible to load dynamic libraries with static linking, no matter the language. Although there might be some workarounds that I'm not aware of.

static binaries

2022-04-21 Thread archnim
Normally, The way you link you program to a lib, doesn't affect how you use other libs. There is certainly a hidden bug somewhere. Please post a minimal code and your compiling command. So that we can figure out where is the issue.

static binaries

2022-04-21 Thread daef
As stated in my last question: I want to statically link libc while retaining the possibility for the binary to dynamically load .so's (libpq.so in this case)

static binaries

2022-04-20 Thread kaushalmodi
As @archnim said, std/db_postgres is an impure lib. So Nim tries to link to it dynamically by default. If you want to build a static binary with that library, you need to first build static version of that library. As a example, see

static binaries

2022-04-20 Thread archnim
Bro, what I understand is that you want to imoprt std/db_postgres in your code and compile it as a unique and independent binary. But std/db_postgres is an impure library. That means that your binary will always import dynamically postgres sql.

static binaries

2022-04-20 Thread archnim
When you say "static binary" do you mean an independent executable, or a static lib ? Can you share with us the command that you use to compile ?

static binaries

2022-04-20 Thread daef
Is it possible to create static binaries with nim? I found a [tutorial](https://scripter.co/nim-deploying-static-binaries/) using musl-gcc, but my example doesn't work when I try it like that: I `import std/db_postgres`. When trying to execute the static build I get $ .