News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

How to compile on Ubuntu with zstd?

Started by THLeaderH, March 02, 2020, 07:18:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

THLeaderH

Hello everyone.

Today I tried to compile simutrans on Ubuntu 18.04 with zstd, but I got the following error.


dataobj/loadsave.cc:522:37: error: 'ZSTD_c_compressionLevel' was not declared in this scope
   ZSTD_CCtx_setParameter( fd->cctx, ZSTD_c_compressionLevel, level );
                                     ^‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
dataobj/loadsave.cc:522:37: note: suggested alternative: 'ZSTD_decompressStream'
   ZSTD_CCtx_setParameter( fd->cctx, ZSTD_c_compressionLevel, level );
                                     ^‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
                                     ZSTD_decompressStream
dataobj/loadsave.cc:522:3: error: 'ZSTD_CCtx_setParameter' was not declared in this scope
   ZSTD_CCtx_setParameter( fd->cctx, ZSTD_c_compressionLevel, level );
   ^‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
dataobj/loadsave.cc:522:3: note: suggested alternative: 'ZSTD_CCtx_s'
   ZSTD_CCtx_setParameter( fd->cctx, ZSTD_c_compressionLevel, level );
   ^‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
   ZSTD_CCtx_s
dataobj/loadsave.cc: In member function 'const char* loadsave_t::close()':
dataobj/loadsave.cc:619:68: error: 'ZSTD_e_end' was not declared in this scope
     ret = ZSTD_compressStream2( fd->cctx, &(fd->zout), &(fd->zin), ZSTD_e_end  );
                                                                    ^‾‾‾‾‾‾‾‾‾
dataobj/loadsave.cc:619:68: note: suggested alternative: 'ZSTD_DDict'
     ret = ZSTD_compressStream2( fd->cctx, &(fd->zout), &(fd->zin), ZSTD_e_end  );
                                                                    ^‾‾‾‾‾‾‾‾‾
                                                                    ZSTD_DDict
dataobj/loadsave.cc:619:11: error: 'ZSTD_compressStream2' was not declared in this scope
     ret = ZSTD_compressStream2( fd->cctx, &(fd->zout), &(fd->zin), ZSTD_e_end  );
           ^‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
dataobj/loadsave.cc:619:11: note: suggested alternative: 'ZSTD_compressStream'
     ret = ZSTD_compressStream2( fd->cctx, &(fd->zout), &(fd->zin), ZSTD_e_end  );
           ^‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
           ZSTD_compressStream
dataobj/loadsave.cc: In member function 'void loadsave_t::flush_buffer(int)':
dataobj/loadsave.cc:802:67: error: 'ZSTD_e_continue' was not declared in this scope
    ret = ZSTD_compressStream2( fd->cctx, &(fd->zout), &(fd->zin), ZSTD_e_continue );
                                                                   ^‾‾‾‾‾‾‾‾‾‾‾‾‾‾
dataobj/loadsave.cc:802:10: error: 'ZSTD_compressStream2' was not declared in this scope
    ret = ZSTD_compressStream2( fd->cctx, &(fd->zout), &(fd->zin), ZSTD_e_continue );
          ^‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
dataobj/loadsave.cc:802:10: note: suggested alternative: 'ZSTD_compressStream'
    ret = ZSTD_compressStream2( fd->cctx, &(fd->zout), &(fd->zin), ZSTD_e_continue );
          ^‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
          ZSTD_compressStream


Compiling without zstd works fine on this environment. I installed libzstd-dev (0.5.1-1) before compiling.
I assume that I'm missing some libraries. What libraries should I install?

Sirius

#1
Installing the lib is a requirement to run compiled binaries but to compile you will at least need the headers.
The error messages seem like you don't have the header files installed.

I am not sure about ubuntu packaging. In opensuse I would ask zypper to list packqges whose names contain zstd and install the ...-headers, ...dev or ...-src package.

Edit: on opensuse it's libzstd-devel.
This may or may not help you.

prissi

I used version 1.xxx, so version 0.5 might be just too old.

Since the nightly, Macos, and Mingw64 both need a handcompiled libzstd (and the gain for standard is rather small), libzstd will be not a requirement anytime soon.

Sirius

Oh well, I missed the 0.5.1-1, which is a little confusing. The official ubuntu package list https://packages.ubuntu.com/search?keywords=zstd states that Ubuntu 18.04 (bionic) has zstd 1.3.3 in the packages.
No idea why you got 0.5.1-1 installed.

prissi

Since Ubuntu 16.05 had version 0.5, I wonder if the updating of the repositories went wrong.

THLeaderH

#5
The zstd version which I installed with apt was actually 1.3.3, not 0.5.1-1. Sorry for confusing you.
Anyway, I compiled zstd 1.4.4 by hand and installed it. With this version of zstd, I succeeded to compile.

A question about distribution. Is the static link configuration in config.default valid for zstd?

UPDATE: For macOS, homebrew provides zstd 1.4.4, and compiling works fine with it.

prissi

On windows it depends on your compile time settings.

On Mac I cannot use homebrew for the nightlies, so they come without freetype2 and miniupnpc, and without zstd. That is why there is no default support for zstd. (If you have a Mac, please tell me if https://nightly.simutrans.com/Simutrans nightlies run out of box.)