Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 708110 - app-arch/zstd-1.4.4 does not detect pthread, zlib, lzma support
Summary: app-arch/zstd-1.4.4 does not detect pthread, zlib, lzma support
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Patrick Lauer
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: make-4.3
  Show dependency tree
 
Reported: 2020-02-03 21:02 UTC by Byron Stanoszek
Modified: 2020-03-20 18:33 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch Makefile to fix pthread/zlib/etc detection (zstd-fix-detect.patch,2.94 KB, patch)
2020-02-03 21:04 UTC, Byron Stanoszek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Byron Stanoszek 2020-02-03 21:02:45 UTC
Likely caused by upgrading to GNU Make 4.3, programs/Makefile fails to properly detect support for pthread, zlib, and liblzma. The offending line(s) in the Makefile all look like this:

HAVE_PTHREAD := $(shell printf '\#include <pthread.h>\nint main(void) { return 0; }' > have_pthread.c && $(CC) $(FLAGS) -o have_pthread$(EXT) have_pthread.c -pthread 2> $(VOID) && rm have_pthread$(EXT) && echo 1 || echo 0; rm have_pthread.c)

At the beginning of the printf string, the \# escape sequence no longer works, and the literal characters \# are printed directly to the "have_pthread.c" file. This causes the following output to appear when compiling the test:

have_pthread.c:1:1: error: stray '\' in program
have_pthread.c:1:2: error: stray '#' in program
have_pthread.c:1:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token

Since \ is invalid in the C program, the Makefile assumes that pthreads are not available in the system.

I don't know the history behind why \# instead of # was used in the first place, but it was likely escaped to provide compatibility with older or non-GNU versions of "make". So assuming it is needed, we can change the \# escape to \043 to always produce a literal # in the output.

Patch attached.

Reproducible: Always
Comment 1 Byron Stanoszek 2020-02-03 21:04:36 UTC
Created attachment 611502 [details, diff]
Patch Makefile to fix pthread/zlib/etc detection
Comment 2 Byron Stanoszek 2020-02-03 21:16:39 UTC
Compile output when pthreads is not auto-detected:

==> no threads, building without multithreading support
==> no zlib, building zstd without .gz support
==> no liblzma, building zstd without .xz/.lzma support
==> no liblz4, building zstd without .lz4 support

Expected output on my system:

==> building with threading support
==> building zstd with .gz compression support
==> building zstd with .xz/.lzma compression support
==> no liblz4, building zstd without .lz4 support
Comment 3 Holger Hoffstätte 2020-03-14 17:14:38 UTC
Just stumbled across this myself. After filing a bug upstream I found that
it's already fixed in:

https://github.com/facebook/zstd/commit/06a57cf57e3c4e887cadcf688e3081154f3f6db4

Dropping that into /etc/portage/patches does the trick.
Comment 4 Larry the Git Cow gentoo-dev 2020-03-20 18:33:46 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7dd359a8181e14f2bf0bdc11236e287f845ad70f

commit 7dd359a8181e14f2bf0bdc11236e287f845ad70f
Author:     Matt Turner <mattst88@gentoo.org>
AuthorDate: 2020-03-20 18:26:52 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2020-03-20 18:31:20 +0000

    app-arch/zstd: Fix feature detection with make-4.3
    
    Closes: https://bugs.gentoo.org/708110
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 ...ue-More-portable-header-prefix-usage-1987.patch | 60 ++++++++++++++++++++++
 .../{zstd-1.4.4-r2.ebuild => zstd-1.4.4-r3.ebuild} |  1 +
 2 files changed, 61 insertions(+)