Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 617548 - app-crypt/rhash: Won't build on Gentoo/FreeBSD due to differences in BSD make vs GNU make
Summary: app-crypt/rhash: Won't build on Gentoo/FreeBSD due to differences in BSD make...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All FreeBSD
: Normal normal (vote)
Assignee: James Le Cuirot
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2017-05-05 02:04 UTC by Joshua Kinard
Modified: 2017-08-17 21:12 UTC (History)
4 users (show)

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


Attachments
sample patch for rhash-1.3.4.ebuild (file_617548.txt,1.51 KB, patch)
2017-05-31 11:00 UTC, Yuta SATOH
Details | Diff
sample patch for Makefile (make part) (file_617548.txt,2.68 KB, patch)
2017-06-04 10:08 UTC, Yuta SATOH
Details | Diff
sample patch for Makefile (install part) (file_617548.txt,496 bytes, patch)
2017-06-04 10:09 UTC, Yuta SATOH
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Kinard gentoo-dev 2017-05-05 02:04:14 UTC
It looks like app-crypt/rhash, a dependency for cmake-3.8.0+, has a hardcoded "make" command in several spots in its Makefile, and this causes issues on a BSD system where BSD make is present, and GNU make is installed as "gmake":

The use of emake in the ebuild works for the initial compiles:
>>> Compiling source in /ramfs/portage/app-crypt/rhash-1.3.4/work/rhash-1.3.4 ...
 * abi_x86_64.amd64_fbsd: running multilib-minimal_abi_src_compile
gmake -j6 'CFLAGS=-O2 -pipe -march=corei7 -mtune=corei7 -fomit-frame-pointer  -mfpmath=sse -msse -msse2 -mssse3 -msse4.1 -msse4.2  -mcx16 -msahf -mcrc32 -maccumulate-outgoing-args  -fforce-addr -fmodulo-sched -fivopts' LDFLAGS= CC=x86_64-gentoo-freebsd11.0-gcc ADDCFLAGS=-DNDEBUG ADDLDFLAGS= PREFIX=/usr LIBDIR=$(PREFIX)/lib build-shared


But then:
make -C librhash lib-shared
make[1]: illegal argument to -j -- must be positive integer!
gmake: *** [Makefile:133: librhash/librhash.so.0] Error 1
gmake: *** Waiting for unfinished jobs....

And this is caused by:
# grep -rIn "make -C" *
Makefile:127:   +make -C librhash install-lib-static
Makefile:130:   +make -C librhash install-lib-shared
Makefile:133:   +make -C librhash lib-shared
Makefile:136:   +make -C librhash lib-static
Makefile:139:   +make -C librhash test-static
Makefile:142:   +make -C librhash test-shared
Makefile:145:   +make -C librhash test-static test-shared
Makefile:247:   +make -C bindings distclean
Makefile:260:   +make -C bindings gzip ARCHIVE_GZIP=../rhash-bindings-$(VERSION)-src.tar.gz
Makefile:264:   +make -C bindings copy-dist COPYDIR=../$(PROGNAME)-$(VERSION)/bindings
Makefile:306:   +make -C librhash clean

If I manually replace references to "make -C" with "gmake -C", I can complete the compile and install, and '/usr/bin/rhash' appears to work normally.  Not sure what the correct solution to this is to properly fix it.
Comment 1 Yuta SATOH 2017-05-31 11:00:08 UTC
Created attachment 474734 [details, diff]
sample patch for rhash-1.3.4.ebuild

This patch will fix the following issues.
But I think it's a bit bad patch because it directly replace Makefile.
Better fixes are very welcome.

1. If set MAKEOPTS=-j2 or more, I also got the illegal argument error.
2. If set USE=nls, it seems to need -lintl. I added it.
3. I think this package cannot install with the BSD's install command.
   The ginstall command is provided by sys-apps/coreutils.

1.)
>>> Compiling source in /var/tmp/portage/app-crypt/rhash-1.3.4/work/rhash-1.3.4 ...
 * abi_x86_64.amd64_fbsd: running multilib-minimal_abi_src_compile
gmake -j5 'CFLAGS=-O2 -pipe' LDFLAGS= CC=x86_64-gentoo-freebsd11.0-gcc 'ADDCFLAGS=-DNDEBUG -DUSE_GETTEXT' PREFIX=/usr LIBDIR=$(PREFIX)/lib build-shared
<snip>
make -C librhash lib-shared
make[1]: illegal argument to -j -- must be positive integer!
gmake: *** [Makefile:133: librhash/librhash.so.0] Error 1

2.)
x86_64-gentoo-freebsd11.0-gcc calc_sums.o hash_print.o common_func.o hash_update.o file_mask.o file_set.o find_file.o hash_check.o output.o parse_cmdline.o rhash_main.o win_utils.o   -o rhash_shared librhash/librhash.so.0
rhash_main.o: In function `load_printf_template':
rhash_main.c:(.text+0x171): undefined reference to `libintl_gettext'
rhash_main.o: In function `main':
rhash_main.c:(.text.startup+0x22): undefined reference to `libintl_bindtextdomain'
rhash_main.c:(.text.startup+0x2c): undefined reference to `libintl_textdomain'
rhash_main.c:(.text.startup+0xac): undefined reference to `libintl_gettext'
rhash_main.c:(.text.startup+0x104): undefined reference to `libintl_gettext'
rhash_main.c:(.text.startup+0x118): undefined reference to `libintl_gettext'
rhash_main.c:(.text.startup+0x364): undefined reference to `libintl_gettext'
calc_sums.o: In function `rename_file_by_embeding_crc32':
calc_sums.c:(.text+0x78f): undefined reference to `libintl_gettext'
calc_sums.o:calc_sums.c:(.text+0x7f7): more undefined references to `libintl_gettext' follow
collect2: error: ld returned 1 exit status
gmake: *** [Makefile:171: rhash_shared] Error 1

3.)
gmake -j1 DESTDIR=/var/tmp/portage/app-crypt/rhash-1.3.4/image/ PREFIX=/usr LIBDIR=$(PREFIX)/lib SYSCONFDIR=/etc install-gmo
for f in po/*.po; do \
        g=`basename $f .po`; \
        msgfmt $f -o po/$g.gmo; \
done
for f in po/*.gmo; do \
        l=`basename $f .gmo`; \
        install -d /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/share/locale/$l/LC_MESSAGES; \
        install -m 644 -T $f /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/share/locale/$l/LC_MESSAGES/rhash.mo; \
done
usage: install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]
               [-M log] [-D dest] [-h hash] [-T tags]
               [-B suffix] [-l linkflags] [-N dbdir]
               file1 file2
       install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]
               [-M log] [-D dest] [-h hash] [-T tags]
               [-B suffix] [-l linkflags] [-N dbdir]
               file1 ... fileN directory
       install -dU [-vU] [-g group] [-m mode] [-N dbdir] [-o owner]
               [-M log] [-D dest] [-h hash] [-T tags]
               directory ...
<snip>
gmake: *** [Makefile:324: install-gmo] Error 64
 * ERROR: app-crypt/rhash-1.3.4::gentoo failed (install phase):
 *   emake failed
Comment 2 James Le Cuirot gentoo-dev 2017-05-31 11:24:01 UTC
INSTALL can be overridden without patching. Invocations of make should be replaced with $(MAKE), assuming that works on BSD. I would rather see that fixed upstream. Upstream has merged a fix from me before. Can you verify this works?
Comment 3 Yuta SATOH 2017-06-04 10:08:22 UTC
Created attachment 475164 [details, diff]
sample patch for Makefile (make part)

(In reply to James Le Cuirot from comment #2)
> INSTALL can be overridden without patching. Invocations of make should be
> replaced with $(MAKE), assuming that works on BSD. I would rather see that
> fixed upstream. Upstream has merged a fix from me before. Can you verify
> this works?
Thanks for your advice.
I replaced make with $(MAKE) and I confirmed they called gmake in all cases.

>>> Compiling source in /var/tmp/portage/app-crypt/rhash-1.3.4/work/rhash-1.3.4 ...
 * abi_x86_64.amd64_fbsd: running multilib-minimal_abi_src_compile
gmake -j5 'CFLAGS=-O2 -pipe' LDFLAGS= CC=x86_64-gentoo-freebsd11.0-gcc 'ADDCFLAGS=-DNDEBUG -DUSE_GETTEXT' ADDLDFLAGS=-lintl PREFIX=/usr LIBDIR=$(PREFIX)/lib build-shared
x86_64-gentoo-freebsd11.0-gcc -c -pipe -O2 -pipe -DNDEBUG -DUSE_GETTEXT -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations calc_sums.c -o calc_sums.o
x86_64-gentoo-freebsd11.0-gcc -c -pipe -O2 -pipe -DNDEBUG -DUSE_GETTEXT -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations hash_print.c -o hash_print.o
echo "#define VERSION \"1.3.4\"" > version.h
x86_64-gentoo-freebsd11.0-gcc -c -pipe -O2 -pipe -DNDEBUG -DUSE_GETTEXT -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations hash_update.c -o hash_update.o
x86_64-gentoo-freebsd11.0-gcc -c -pipe -O2 -pipe -DNDEBUG -DUSE_GETTEXT -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations file_mask.c -o file_mask.o
x86_64-gentoo-freebsd11.0-gcc -c -pipe -O2 -pipe -DNDEBUG -DUSE_GETTEXT -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations file_set.c -o file_set.o
x86_64-gentoo-freebsd11.0-gcc -c -pipe -O2 -pipe -DNDEBUG -DUSE_GETTEXT -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations find_file.c -o find_file.o
x86_64-gentoo-freebsd11.0-gcc -c -pipe -O2 -pipe -DNDEBUG -DUSE_GETTEXT -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations hash_check.c -o hash_check.o
x86_64-gentoo-freebsd11.0-gcc -c -pipe -O2 -pipe -DNDEBUG -DUSE_GETTEXT -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations output.c -o output.o
x86_64-gentoo-freebsd11.0-gcc -c -pipe -O2 -pipe -DNDEBUG -DUSE_GETTEXT -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations parse_cmdline.c -o parse_cmdline.o
x86_64-gentoo-freebsd11.0-gcc -c -pipe -O2 -pipe -DNDEBUG -DUSE_GETTEXT -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations rhash_main.c -o rhash_main.o
x86_64-gentoo-freebsd11.0-gcc -c -pipe -O2 -pipe -DNDEBUG -DUSE_GETTEXT -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations win_utils.c -o win_utils.o
gmake -C librhash lib-shared
gmake[1]: Entering directory '/var/tmp/portage/app-crypt/rhash-1.3.4/work/rhash-1.3.4-abi_x86_64.amd64_fbsd/librhash'
sed -n '1s/.*/{ global:/p; s/^RHASH_API.* \([a-z0-9_]\+\)(.*/  \1;/p; $s/.*/local: *; };/p' rhash.h rhash_torrent.h rhash_timing.h > exports.sym
x86_64-gentoo-freebsd11.0-gcc -fpic  -pipe -DIN_RHASH -DNDEBUG -DUSE_GETTEXT -O2 -pipe -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations -shared algorithms.c byte_order.c plug_openssl.c rhash.c rhash_timing.c rhash_torrent.c util.c aich.c crc32.c ed2k.c edonr.c hex.c md4.c md5.c sha1.c sha256.c sha512.c sha3.c ripemd-160.c gost.c has160.c snefru.c tiger.c tiger_sbox.c tth.c torrent.c whirlpool.c whirlpool_sbox.c -Wl,--version-script,exports.sym,-soname,librhash.so.0  -lintl -o librhash.so.0
x86_64-gentoo-freebsd11.0-gcc -c -pipe -O2 -pipe -DNDEBUG -DUSE_GETTEXT -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations common_func.c -o common_func.o
ln -s librhash.so.0 librhash.so
gmake[1]: Leaving directory '/var/tmp/portage/app-crypt/rhash-1.3.4/work/rhash-1.3.4-abi_x86_64.amd64_fbsd/librhash'
x86_64-gentoo-freebsd11.0-gcc calc_sums.o hash_print.o common_func.o hash_update.o file_mask.o file_set.o find_file.o hash_check.o output.o parse_cmdline.o rhash_main.o win_utils.o  -lintl -o rhash_shared librhash/librhash.so.0
>>> Source compiled.
Comment 4 Yuta SATOH 2017-06-04 10:09:53 UTC
Created attachment 475166 [details, diff]
sample patch for Makefile (install part)

The -T option operates differently in GNU install and BSD install.
If it isn't necessary, please drop it to install with BSD install command.

GNU install man
https://www.gnu.org/software/coreutils/manual/html_node/install-invocation.html

FreeBSD install man
https://www.freebsd.org/cgi/man.cgi?query=install


>>> Install rhash-1.3.4 into /var/tmp/portage/app-crypt/rhash-1.3.4/image/ category app-crypt
 * abi_x86_64.amd64_fbsd: running multilib-minimal_abi_src_install
gmake -j5 DESTDIR=/var/tmp/portage/app-crypt/rhash-1.3.4/image/ PREFIX=/usr LIBDIR=$(PREFIX)/lib SYSCONFDIR=/etc -C librhash install-lib-shared install-so-link
gmake: Entering directory '/var/tmp/portage/app-crypt/rhash-1.3.4/work/rhash-1.3.4-abi_x86_64.amd64_fbsd/librhash'
install -d /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/lib
install -d /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/lib
install -m 644 librhash.so.0 /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/lib/
ln -s librhash.so.0 /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/lib/librhash.so
gmake: Leaving directory '/var/tmp/portage/app-crypt/rhash-1.3.4/work/rhash-1.3.4-abi_x86_64.amd64_fbsd/librhash'
gmake -j5 DESTDIR=/var/tmp/portage/app-crypt/rhash-1.3.4/image/ PREFIX=/usr LIBDIR=$(PREFIX)/lib SYSCONFDIR=/etc install-shared
install -d /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/bin
install -d /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/share/man/man1
install -d /var/tmp/portage/app-crypt/rhash-1.3.4/image///etc
install -m 644 dist/rhash.1 /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/share/man/man1/rhash.1
tr -d \\r < dist/rhashrc.sample > rc.tmp && install -m 644 rc.tmp /var/tmp/portage/app-crypt/rhash-1.3.4/image///etc/rhashrc
install -m 755 rhash_shared /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/bin/rhash
for f in sfv-hash tiger-hash tth-hash whirlpool-hash has160-hash gost-hash ed2k-link magnet-link; do ln -fs rhash /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/bin/$f; done
rm -f rc.tmp
cd /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/share/man/man1 && for f in sfv-hash tiger-hash tth-hash whirlpool-hash has160-hash gost-hash ed2k-link magnet-link; do ln -fs rhash.1* $f.1; done
gmake -j5 DESTDIR=/var/tmp/portage/app-crypt/rhash-1.3.4/image/ PREFIX=/usr LIBDIR=$(PREFIX)/lib SYSCONFDIR=/etc -C librhash install-headers
gmake: Entering directory '/var/tmp/portage/app-crypt/rhash-1.3.4/work/rhash-1.3.4/librhash'
install -d /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/include
install -m 644 rhash.h rhash_torrent.h /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/include/
gmake: Leaving directory '/var/tmp/portage/app-crypt/rhash-1.3.4/work/rhash-1.3.4/librhash'
gmake -j5 DESTDIR=/var/tmp/portage/app-crypt/rhash-1.3.4/image/ PREFIX=/usr LIBDIR=$(PREFIX)/lib SYSCONFDIR=/etc install-gmo
for f in po/*.po; do \
        g=`basename $f .po`; \
        msgfmt $f -o po/$g.gmo; \
done
for f in po/*.gmo; do \
        l=`basename $f .gmo`; \
        install -d /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/share/locale/$l/LC_MESSAGES; \
        install -m 644 $f /var/tmp/portage/app-crypt/rhash-1.3.4/image//usr/share/locale/$l/LC_MESSAGES/rhash.mo; \
done
>>> Completed installing rhash-1.3.4 into /var/tmp/portage/app-crypt/rhash-1.3.4/image/
Comment 5 James Le Cuirot gentoo-dev 2017-06-04 21:52:31 UTC
I've filed a pull request upstream.

https://github.com/rhash/RHash/pull/35
Comment 6 James Le Cuirot gentoo-dev 2017-08-17 21:12:41 UTC
Fixed in 1.3.5.