Bug 257352 - www/chromium: Fails to build after mempcpy(3) added to base libc: error: static declaration of 'mempcpy' follows non-static declaration
Summary: www/chromium: Fails to build after mempcpy(3) added to base libc: error: stat...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Rene Ladan
URL:
Keywords: needs-qa
: 262111 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-07-23 12:40 UTC by Tomoaki AOKI
Modified: 2022-02-28 10:42 UTC (History)
9 users (show)

See Also:
bugzilla: maintainer-feedback? (chromium)
koobs: maintainer-feedback? (rene)
junchoon: merge-quarterly?


Attachments
AdHoc patch, cannot commit! (592 bytes, patch)
2021-08-01 12:08 UTC, Tomoaki AOKI
no flags Details | Diff
Patch rev.2 (1.62 KB, patch)
2021-08-07 06:18 UTC, Tomoaki AOKI
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomoaki AOKI 2021-07-23 12:40:06 UTC
www/chromium started failing to build after commit
  main: git: ee37f64cf875
  stable/13: git: dba677d13b26
with errors like below.

samu: job failed: cc -MMD -MF obj/third_party/nasm/nasm/regvals.o.d -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_OZONE=1 -DUSE_X11=1 -DOFFICIAL_BUILD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DNO_UNWIND_TABLES -D_GNU_SOURCE -DCR_CLANG_REVISION=\"llvmorg-13-init-6429-g0e92cbd6-2\" -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DHAVE_CONFIG_H -I../.. -Igen -I../../third_party/nasm -I../../third_party/nasm/asm -I../../third_party/nasm/disasm -I../../third_party/nasm/include -I../../third_party/nasm/output -I../../third_party/nasm/x86 -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fPIC -pthread -fcolor-diagnostics -fmerge-all-constants -flto=thin -fsplit-lto-unit -fwhole-program-vtables -m64 -march=x86-64 -msse3 -Xclang -fdebug-compilation-dir -Xclang . -no-canonical-prefixes -O2 -fdata-sections -ffunction-sections -fno-omit-frame-pointer -g0 -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wall -Wno-unused-variable -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-unneeded-internal-declaration -Wno-undefined-var-template -Wno-ignored-pragma-optimize -Wno-implicit-int-float-conversion -Wno-final-dtor-non-final-class -Wno-builtin-assume-aligned-alignment -Wno-deprecated-copy -Wno-thread-safety-analysis -Wno-thread-safety-attributes -Wno-unused-function -Wno-string-conversion -Wno-macro-redefined -Wno-sign-compare -Wno-nonnull -Wno-uninitialized -std=c11 -c ../../third_party/nasm/x86/regvals.c -o obj/third_party/nasm/nasm/regvals.o
In file included from ../../third_party/nasm/x86/regvals.c:3:
In file included from ../../third_party/nasm/include/tables.h:43:
../../third_party/nasm/include/compiler.h:249:21: error: static declaration of 'mempcpy' follows non-static declaration
static inline void *mempcpy(void *dst, const void *src, size_t n)
                    ^
/usr/include/string.h:70:7: note: previous declaration is here
void    *mempcpy(void * __restrict, const void * __restrict, size_t);
         ^
1 error generated.
Comment 1 Robert Cina 2021-07-26 11:45:44 UTC
I have the exact same issue building the chromium port on stable 13 as well.
Comment 2 Tomoaki AOKI 2021-07-31 00:09:56 UTC
Changed Importance to "Affect Some People", as second person popped in.
Comment 3 iron.udjin 2021-08-01 10:12:47 UTC
(In reply to Tomoaki AOKI from comment #2)

Same here on stable/13-n246626-af732203b8f7 and chromium-91.0.4472.164.
Comment 4 Tomoaki AOKI 2021-08-01 12:08:14 UTC
Created attachment 226835 [details]
AdHoc patch, cannot commit!

AdHoc patch only for commits below and later.
DO NOT TRY TO APPLY ON OLDER VERSION!

  main: git ee37f64cf875
  stable/13: git dba677d13b26

For applicable versions, apply this on /usr/ports.

Actually, this patch removes hunk 3 from freebsd-patch below.

 www/chromium/files/patch-third__party_nasm_config_config-linux.h

But it IS needed for older versions, and there's no bump for above-mentioned commits. So there's no standard way to fix www/chromium/Makefile.
Comment 5 Tomoaki AOKI 2021-08-01 12:12:37 UTC
BTW, devel/nasm built fine for me on affected revision.
If it's usable for www/chromium build instead of bunlded one on all supported branches, and there's any way to do so, it can be a sane solution.
Can anyone try?
Comment 6 iron.udjin 2021-08-02 15:44:55 UTC
(In reply to Tomoaki AOKI from comment #4)

With this patch chromium compilles and works fine.
Comment 7 Tomoaki AOKI 2021-08-07 06:18:11 UTC
Created attachment 227003 [details]
Patch rev.2

Updated patch.

 *Delete offending hunk from files/patch-third__party_nasm_config_config-linux.h
  and make deleted hunk an extra-patch.

 *Check the existense of mempcpy() in /usr/include/string.h and apply
  the extra-patch above only when mempcpy() is NOT exist.

As this is a build fix, no need to bump revision.

Some notes for future:
As no bump had done on adding mempcpy() to base, I first tried usual OSVERSION check using later and nearest bump.
But this could cause future confusion, as it's not the bump for this change.
So I decided to apply unusual tricky way above.
Comment 8 Tomoaki AOKI 2021-08-22 21:28:34 UTC
chromium 92.0.4515.159 (git 76daa653245e) has the same issue,
and the patch (Patch rev2) here fixes the issue,too.
Built OK on stable/13, amd64.
(Actually, not yet build-tested for main, but should be OK, too, theoretically.)
Comment 9 Rainer Hurling freebsd_committer freebsd_triage 2021-08-23 18:33:41 UTC
(In reply to Tomoaki AOKI from comment #8)
I tested a patched 92.0.4515.159 on a recent 14.0 CURRENT amd64 and it builds, installs and runs fine so far :)
Comment 10 Jonathan Chen 2021-08-30 03:13:27 UTC
Works for me on my 13-STABLE/amd64 system.
Comment 11 commit-hook freebsd_committer freebsd_triage 2021-09-01 10:27:46 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9e6695a71d64d995e6619497626c0a780397b7c9

commit 9e6695a71d64d995e6619497626c0a780397b7c9
Author:     Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
AuthorDate: 2021-08-30 16:10:28 +0000
Commit:     Rene Ladan <rene@FreeBSD.org>
CommitDate: 2021-09-01 10:09:23 +0000

    www/chromium: fix build on CURRENT

    ... after mempcpy(3) has been added to base libc.

    PR:     257352
    MFH:    2021Q3

 www/chromium/Makefile                                         |  5 +++++
 www/chromium/files/extra-patch-no-mempcpy-nasm (new)          | 11 +++++++++++
 .../files/patch-third__party_nasm_config_config-linux.h       |  9 ---------
 3 files changed, 16 insertions(+), 9 deletions(-)
Comment 12 Rene Ladan freebsd_committer freebsd_triage 2021-09-01 10:28:34 UTC
Patch committed, thanks!
Comment 13 commit-hook freebsd_committer freebsd_triage 2021-09-01 20:42:10 UTC
A commit in branch 2021Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5218b91edff502d736eec1e4db6eb23b44638839

commit 5218b91edff502d736eec1e4db6eb23b44638839
Author:     Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
AuthorDate: 2021-08-30 16:10:28 +0000
Commit:     Rene Ladan <rene@FreeBSD.org>
CommitDate: 2021-09-01 20:35:55 +0000

    www/chromium: fix build on CURRENT

    ... after mempcpy(3) has been added to base libc.

    PR:     257352
    MFH:    2021Q3
    (cherry picked from commit 9e6695a71d64d995e6619497626c0a780397b7c9)

 www/chromium/Makefile                                         |  5 +++++
 www/chromium/files/extra-patch-no-mempcpy-nasm (new)          | 11 +++++++++++
 .../files/patch-third__party_nasm_config_config-linux.h       |  9 ---------
 3 files changed, 16 insertions(+), 9 deletions(-)
Comment 14 Tatsuki Makino 2021-09-01 22:13:00 UTC
(In reply to commit-hook from comment #13)

This change will result in an error message in a non-problematic environment (12.2-STABLE).
The following might be better?

...

BASE_MEMPCPY!=  ${GREP} -q mempcpy ${CROSS_SYSROOT}/usr/include/string.h && echo 1 || echo 0
.if ${BASE_MEMPCPY}

...
Comment 15 Tomoaki AOKI 2021-09-02 12:27:35 UTC
(In reply to Tatsuki Makino from comment #14)

Thanks for pointing this out. I've tested the patch only on affected base only.
(Testing the reverse condition by changing "mempcpy" on patch to something nonexistent, i.e. "mempcpie", and see the extra patch IS applied. Didn't see outputs itself from make.)

But unfortunately, the logic is reversed.
The extra patch is needed only if string.h doesn't have mempcpy() definition.
So `echo 1` and `echo 0` should be swapped.
Comment 16 Tatsuki Makino 2021-09-02 21:24:56 UTC
(In reply to Tomoaki AOKI from comment #15)

Yes, I wrote my comment #14 without thinking about the conditions of true and false :)
To be precise, it would look like following. Or, .if ! ${BASE_MEMPCPY}.
Also, I forgot to write that the error message is:
make: "/usr/ports/www/chromium/Makefile" line 210: warning: "/usr/bin/grep mempcpy /usr/include/string.h" returned non-zero status


diff --git www/chromium/Makefile www/chromium/Makefile
index d60012118b..fd471f4d78 100644
--- www/chromium/Makefile
+++ www/chromium/Makefile
@@ -207,8 +207,8 @@ TEST_ALL_TARGET=	${TEST_TARGETS}
 .include <bsd.port.options.mk>
 .include <bsd.port.pre.mk>
 
-BASE_MEMPCPY!=	${GREP} mempcpy ${CROSS_SYSROOT}/usr/include/string.h
-.if empty(BASE_MEMPCPY)
+BASE_MEMPCPY!=	${GREP} -q mempcpy ${CROSS_SYSROOT}/usr/include/string.h && echo 0 || echo 1
+.if ${BASE_MEMPCPY}
 EXTRA_PATCHES+=	${PATCHDIR}/extra-patch-no-mempcpy-nasm
 .endif
Comment 17 Mark Millard 2021-10-02 10:29:26 UTC
(In reply to Tatsuki Makino from comment #16)

devel/electron12 includes an internal chromium build that also
gets the following in my attempted builds based on:

# cd /usr/ports
# ~/fbsd-based-on-what-commit.sh 
branch: main
merge-base: 59611d61d70a85f4418f3f701db1b7baf58560ba
merge-base: CommitDate: 2021-09-29 09:39:17 +0000
59611d61d70a (HEAD -> main) databases/postgresql14-server: fix openssl dependency
n560161 (--first-parent --count for merge-base)

The examples:

In file included from ../../third_party/nasm/asm/directbl.c:6:
In file included from ../../third_party/nasm/asm/directiv.h:9:
In file included from ../../third_party/nasm/include/perfhash.h:37:
../../third_party/nasm/include/compiler.h:249:21: error: static declaration of 'mempcpy' follows non-static declaration
static inline void *mempcpy(void *dst, const void *src, size_t n)
                    ^
/usr/include/string.h:70:7: note: previous declaration is here
void    *mempcpy(void * __restrict, const void * __restrict, size_t);
         ^
1 error generated.

and:

In file included from ../../third_party/nasm/asm/error.c:38:
../../third_party/nasm/include/compiler.h:249:21: error: static declaration of 'mempcpy' follows non-static declaration
static inline void *mempcpy(void *dst, const void *src, size_t n)
                    ^
/usr/include/string.h:70:7: note: previous declaration is here
void    *mempcpy(void * __restrict, const void * __restrict, size_t);
         ^
1 error generated.

and:

In file included from ../../third_party/nasm/asm/directiv.c:38:
../../third_party/nasm/include/compiler.h:249:21: error: static declaration of 'mempcpy' follows non-static declaration
static inline void *mempcpy(void *dst, const void *src, size_t n)
                    ^
/usr/include/string.h:70:7: note: previous declaration is here
void    *mempcpy(void * __restrict, const void * __restrict, size_t);
         ^
1 error generated.

and:

In file included from ../../third_party/nasm/asm/assemble.c:178:
../../third_party/nasm/include/compiler.h:249:21: error: static declaration of 'mempcpy' follows non-static declaration
static inline void *mempcpy(void *dst, const void *src, size_t n)
                    ^
/usr/include/string.h:70:7: note: previous declaration is here
void    *mempcpy(void * __restrict, const void * __restrict, size_t);
         ^
1 error generated.

and:

In file included from ../../third_party/nasm/asm/eval.c:38:
../../third_party/nasm/include/compiler.h:249:21: error: static declaration of 'mempcpy' follows non-static declaration
static inline void *mempcpy(void *dst, const void *src, size_t n)
                    ^
/usr/include/string.h:70:7: note: previous declaration is here
void    *mempcpy(void * __restrict, const void * __restrict, size_t);
         ^
1 error generated.
Comment 18 Mark Millard 2021-10-02 10:38:10 UTC
(In reply to Mark Millard from comment #17)

I forgot to list the Freebsd vintage:

# uname -apKU
FreeBSD amd64_ZFS 14.0-CURRENT FreeBSD 14.0-CURRENT #2 main-n249019-0637070b5bca-dirty: Tue Aug 31 01:27:48 PDT 2021     root@amd64_ZFS:/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/sys/GENERIC-NODBG  amd64 amd64 1400032 1400032
Comment 19 Tomoaki AOKI 2021-10-02 16:59:17 UTC
(In reply to Mark Millard from comment #17)
Please try patch on Bug 257378.
I've already ported the patch here for devel/electron12 and is reported to fix it.
 *I myself cannot test it as installed default node conflicts with required one.

It's just waiting for QA now.
Comment 20 Mark Millard 2021-10-02 20:28:59 UTC
(In reply to Tomoaki AOKI from comment #19)

The patch allowed my attempt to build via poudriere-devel on amd64 to
finish.

I do not use electron12 but I've been testing doing bulk -a runs on
a HoneyComb (16 Cortex-A72's) and wanted the activity to span bulding
large things like electron12.
Comment 21 Kubilay Kocak freebsd_committer freebsd_triage 2022-02-22 23:06:38 UTC
*** Bug 262111 has been marked as a duplicate of this bug. ***
Comment 22 Kubilay Kocak freebsd_committer freebsd_triage 2022-02-22 23:08:56 UTC
^Triage: Re-open given comment 14 onward and bug 262111. Request feedback from committer that originally resolved
Comment 23 Tatsuki Makino 2022-02-23 01:52:03 UTC
(In reply to Kubilay Kocak from comment #22)
> comment 14 onward

Is it me? :)
I'm 12.3-STABLE, so I've successfully slipped past this problem in 98.0.4758.102.
If it points to bug 258271 comment #14, then that is also a duplicate.
Comment 24 Rene Ladan freebsd_committer freebsd_triage 2022-02-28 10:42:22 UTC
This was fixed in main and quarterly.