wltsmrz / nim_zstd

Nim bindings for zstd
MIT License
37 stars 2 forks source link

Help getting started #6

Closed telatin closed 1 year ago

telatin commented 1 year ago

Hi @wltsmrz, Thanks for making this library!

I wanted to give it a go, but I'm not familiar with zstd so I wanted to know if you are able to guide me.

I'm using Ubuntu 20.04 and nim 1.6.0.

I installed zstd (64-bits v1.4.4, by Yann Collet) and your library with:

sudo apt install zstd libzstd-dev
nimble install zstd

Then trying to run the tests I get:

Hint: used config file '/usr/users/QIB_fr009/telatina/.choosenim/toolchains/nim-1.6.0/config/nim.cfg' [Conf]
Hint: used config file '/usr/users/QIB_fr009/telatina/.choosenim/toolchains/nim-1.6.0/config/config.nims' [Conf]
Hint: used config file '/usr/users/QIB_fr009/telatina/git/seqfu2/nim.cfg' [Conf]
Hint: used config file '/usr/users/QIB_fr009/telatina/git/seqfu2/nim_zstd/tests/config.nims' [Conf]
........................................................................................................
Hint:  [Link]
/usr/bin/ld: /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/zstd.c.o: in function `POOL_resize_internal':
zstd.c:(.text+0xe89): undefined reference to `pthread_create'
/usr/bin/ld: /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/zstd.c.o: in function `POOL_free':
zstd.c:(.text+0x8963f): undefined reference to `pthread_join'
/usr/bin/ld: /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/zstd.c.o: in function `POOL_create_advanced':
zstd.c:(.text+0x89853): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
Error: execution of an external program failed: 'gcc   -o /usr/users/QIB_fr009/telatina/git/seqfu2/nim_zstd/tests/test_all  /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/zstd.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_digitsutils.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_assertions.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_dollars.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_io.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_system.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_parseutils.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_math.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_unicode.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_strutils.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_times.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_os.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_streams.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_exitprocs.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_hashes.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_strformat.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_terminal.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/stdlib_unittest.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/@m..@szstd@scompress.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/@m..@szstd@sdecompress.nim.c.o /usr/users/QIB_fr009/telatina/.cache/nim/test_all_r/@mtest_all.nim.c.o  -lm -lm -lrt   -ldl'

Do I have the wrong version of zstd or is there something else? Thanks a million, andrea

telatin commented 1 year ago

Got it: gcc needs to be called with -pthread, and I achieved it by creating a nim.cfg with --threads:on. Maybe there is a cleaner way, but you might consider adding the setting in the repo?

Cheers A

wltsmrz commented 1 year ago

The test config has been updated. I think threads:on is default now, https://github.com/nim-lang/Nim/pull/19368