Bug 217152 - net/xorp: fib2mrib_varrw.cc:43:30: error: instantiation of variable 'ElemNet<IPNet<IPv4> >::id' required
Summary: net/xorp: fib2mrib_varrw.cc:43:30: error: instantiation of variable 'ElemNet<...
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: Kurt Jaeger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-16 19:44 UTC by O. Hartmann
Modified: 2018-07-14 14:11 UTC (History)
4 users (show)

See Also:
pi: maintainer-feedback-


Attachments
svn-diff-xorp (4.09 KB, patch)
2018-07-02 18:03 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-xorp (3.48 KB, patch)
2018-07-03 02:23 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-xorp_v2 (7.62 KB, patch)
2018-07-11 17:16 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-xorp_v3 (8.04 KB, patch)
2018-07-11 17:21 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-xorp_v4 (20.75 KB, patch)
2018-07-11 19:30 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-xorp_v5 (20.83 KB, patch)
2018-07-12 10:17 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-xorp_v6 (20.83 KB, patch)
2018-07-12 11:55 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-xorp_v7 (40.72 KB, patch)
2018-07-12 15:07 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-xorp_v8 (82.88 KB, patch)
2018-07-12 18:17 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-xorp_v9 (82.88 KB, patch)
2018-07-12 18:24 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-xorp_v10 (42.02 KB, patch)
2018-07-12 19:37 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-xorp_v11_remove_broken_armv (41.61 KB, patch)
2018-07-14 10:18 UTC, Walter Schwarzenfeld
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2017-02-16 19:44:47 UTC
On recent CURRENT and poudriere/jail (up to date as of the time of writing this PR), port net/xorp fails to build, see below.

[... extract of LOG ...]
====>> Building net/xorp
build started at Thu Feb 16 16:21:07 UTC 2017
port directory: /usr/ports/net/xorp
building for: FreeBSD pkg.walstatt.dynvpn.de 12.0-CURRENT FreeBSD 12.0-CURRENT amd64
maintained by: hrs@FreeBSD.org
Makefile ident:      $FreeBSD: head/net/xorp/Makefile 430692 2017-01-06 08:45:03Z jbeich $
Poudriere version: 3.1.14
Host OSVERSION: 1200020
Jail OSVERSION: 1200020
[...]


Error:

[...]
Symlink("/wrkdirs/usr/ports/net/xorp/work/xorp.ct-xorp-1.8.5/xorp/obj/x86_64-unknown-freebsd12.0/fea/libxorp_fea.so", as "/wrkdirs/usr/ports/net/xorp/work/xorp.ct-xorp-1.8.5/xorp/obj/x86_64-unknown-freebsd12.0/lib/libxorp_fea.so")
c++ -o obj/x86_64-unknown-freebsd12.0/policy/backend/policy_filter.os -c -pipe -fstack-protector -fno-strict-aliasing -O3 -g3 -Werror -W -Wall -Wwrite-strings -Wcast-qual -Wpointer-arith -Wcast-align -Woverloaded-virtual -ftemplate-depth-25 -DXORP_BUILDINFO -fPIC -DXRL_PF=120 -DXORP_VERSION=1.8.5 -DBOOST_DISABLE_THREADS -I/usr/local/include -Iobj/x86_64-unknown-freebsd12.0 -I. -I. policy/backend/policy_filter.cc
fib2mrib/fib2mrib_varrw.cc:43:30: error: instantiation of variable 'ElemNet<IPNet<IPv4> >::id' required here, but no definition is available [-Werror,-Wundefined-var-template]
                   _ef.create(ElemIPv4Net::id,
                                           ^
./policy/common/element.hh:448:24: note: forward declaration of template entity is here
    static const char*  id;
[...]
Comment 1 Mike Karels freebsd_committer freebsd_triage 2018-07-02 15:10:02 UTC
Has anyone looked at this?  I am running into the same problem now on FreeBSD 11.1-RELEASE.
Comment 2 Walter Schwarzenfeld freebsd_triage 2018-07-02 17:06:38 UTC
I don't reach your error, I got:
arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic]
        return ((const char *)a - (const char *)0) + (char *)0;
                                                   ^ ~~~~~~~~~

don't know how to solve this.
Comment 3 Walter Schwarzenfeld freebsd_triage 2018-07-02 18:03:24 UTC
Created attachment 194840 [details]
svn-diff-xorp

The only way I found to build it, is to patch out "-Werror" from SConstruct and other/lookup/configure.in.
Comment 4 Walter Schwarzenfeld freebsd_triage 2018-07-02 18:20:18 UTC
Comment on attachment 194840 [details]
svn-diff-xorp

No, does not work, throws another error.
Comment 5 Walter Schwarzenfeld freebsd_triage 2018-07-03 02:23:43 UTC
Created attachment 194845 [details]
svn-diff-xorp

It is an "ugly" patch. But the code is very old (January 2012). 
(And I think undefined-var-template makes incorrect error messages).
Comment 6 Mike Karels freebsd_committer freebsd_triage 2018-07-03 03:24:32 UTC
Thanks.  I haven't tested this patch, but I confirmed earlier today that adding -Wno-undefined-var-template to the C++ flags in SConstruct makes it compile at least.  Your change is more selective. btw,  FreeBSD 11.1-RELEASE doesn't have Clang 5.0; I compiled with 4.0.  Does it fail with 6.0?
Comment 7 Walter Schwarzenfeld freebsd_triage 2018-07-03 05:29:31 UTC
Yes, see the error mentioned in comment2.
Comment 8 Walter Schwarzenfeld freebsd_triage 2018-07-03 17:29:32 UTC
I take a quick look into xorp-hackers on  http://www.xorp.org/.
They removed the same compiler warnings from SConstruct as I do (except Werror).
But not mentioned Wundefined-var-template. ((I don't know on which platforms they work, seems most of them on windows).
Comment 9 Walter Schwarzenfeld freebsd_triage 2018-07-03 17:37:45 UTC
And they removed '-ftemplate-depth-25'. Maybe, this is important for armv6 (on which it is marked broken).
Comment 10 Walter Schwarzenfeld freebsd_triage 2018-07-11 17:16:50 UTC
Created attachment 195056 [details]
svn-diff-xorp_v2

And that was it. "-ftemplate-depth-25" caused the error. I think his patch is better.
Comment 11 Walter Schwarzenfeld freebsd_triage 2018-07-11 17:21:23 UTC
Created attachment 195057 [details]
svn-diff-xorp_v3

Attached wrong svn-diff.
Comment 12 Walter Schwarzenfeld freebsd_triage 2018-07-11 19:30:48 UTC
Created attachment 195059 [details]
svn-diff-xorp_v4

Include some more patches.
Comment 13 Walter Schwarzenfeld freebsd_triage 2018-07-12 10:17:38 UTC
Created attachment 195071 [details]
svn-diff-xorp_v5

Thought I don't need Wno-undefined-var-template, but it is needed.
Comment 14 Walter Schwarzenfeld freebsd_triage 2018-07-12 11:55:09 UTC
Created attachment 195073 [details]
svn-diff-xorp_v6

Was a typo in it , missed "," in patch-SConstruct.
Comment 15 Walter Schwarzenfeld freebsd_triage 2018-07-12 15:07:55 UTC
Created attachment 195086 [details]
svn-diff-xorp_v7
Comment 16 Walter Schwarzenfeld freebsd_triage 2018-07-12 18:17:30 UTC
Created attachment 195088 [details]
svn-diff-xorp_v8
Comment 17 Walter Schwarzenfeld freebsd_triage 2018-07-12 18:24:08 UTC
Created attachment 195089 [details]
svn-diff-xorp_v9

Was a typo in it.
Comment 18 Walter Schwarzenfeld freebsd_triage 2018-07-12 19:37:10 UTC
Created attachment 195094 [details]
svn-diff-xorp_v10

Seems no end...
Pfff ... poudriere does not accepted "-Wno-undefined-var-template" (port does) (??).

This version now builds fine with poudriere. This port is simply too old. I use the "hammer-method" and patched out "-Werror" again. But this one also builds also with clang60.
Comment 19 Walter Schwarzenfeld freebsd_triage 2018-07-14 10:18:12 UTC
Created attachment 195125 [details]
svn-diff-xorp_v11_remove_broken_armv

vkarlssn on freebsd-bugs irc tested it on armv
"xorp builds fine and seems to run without issues with v10 of your patch in my armv6 test bench (qemu)".

So I remove the broken statement for armv.
Comment 20 Kurt Jaeger freebsd_committer freebsd_triage 2018-07-14 14:10:36 UTC
Testbuilds are fine, committed, thanks!
Comment 21 commit-hook freebsd_committer freebsd_triage 2018-07-14 14:11:32 UTC
A commit references this bug:

Author: pi
Date: Sat Jul 14 14:10:33 UTC 2018
New revision: 474640
URL: https://svnweb.freebsd.org/changeset/ports/474640

Log:
  net/xorp: fix build

  PR:		217152
  Submitted by:	Walter Schwarzenfeld <w.schwarzenfeld@utanet.at>
  Reported by:	O. Hartmann <ohartmann@walstatt.org>
  Approved by:	hrs (maintainer timeout)

Changes:
  head/net/xorp/files/patch-SConstruct
  head/net/xorp/files/patch-cplfile.c
  head/net/xorp/files/patch-element.hh
  head/net/xorp/files/patch-expand.c
  head/net/xorp/files/patch-getline.c
  head/net/xorp/files/patch-history.c
  head/net/xorp/files/patch-homedir.c
  head/net/xorp/files/patch-io__ip__socket.cc
  head/net/xorp/files/patch-lex.boot.cc
  head/net/xorp/files/patch-lex.opcmd.cc
  head/net/xorp/files/patch-lex.tplt.cc
  head/net/xorp/files/patch-lex.yy__policy__backend__parser.cc
  head/net/xorp/files/patch-lex.yy__policy__parser.cc
  head/net/xorp/files/patch-libproto__packet.cc
  head/net/xorp/files/patch-netstream__access.h
  head/net/xorp/files/patch-pathutil.c
  head/net/xorp/files/patch-pcache.c
  head/net/xorp/files/patch-popen.cc
  head/net/xorp/files/patch-strptime.c
  head/net/xorp/files/patch-y.boot__tab.cc
  head/net/xorp/files/patch-y.opcmd__tab.cc
  head/net/xorp/files/patch-y.tplt__tab.cc