Opened 3 weeks ago

Closed 3 weeks ago

#70665 closed defect (fixed)

ngspice-lib fails to build: error: duplicate member 'component'

Reported by: barracuda156 Owned by: bpdegnan (Brian Degnan)
Priority: Normal Milestone:
Component: ports Version: 2.10.1
Keywords: Cc: markemer (Mark Anderson)
Port: ngspice, ngspice-lib

Description

Aside from two obvious breakages introduced by a recent update, which are trivially fixable (drop hardcoded arch flag, set required C/C++ standard), there is another issue:

Making all in dense
make[3]: Entering directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_ngspice/ngspice-lib/work/ngspice-43/src/maths/dense'
  CC       dense.lo
  CCLD     libdense.la
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_ngspice/ngspice-lib/work/ngspice-43/src/maths/dense'
Making all in KLU
make[3]: Entering directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_ngspice/ngspice-lib/work/ngspice-43/src/maths/KLU'
  CC       libKLU_real_la-klu.lo
  CC       libKLU_real_la-klu_diagnostics.lo
  CC       libKLU_real_la-klu_extract.lo
  CC       libKLU_real_la-klu_free_numeric.lo
  CC       libKLU_real_la-klu_dump.lo
  CC       libKLU_real_la-klu_factor.lo
klu_factor.c: In function 'klu_factor':
klu_factor.c:397:10: warning: variable 'R' set but not used [-Wunused-but-set-variable]
  397 |     Int *R ;
      |          ^
  CC       libKLU_real_la-klu_kernel.lo
klu_diagnostics.c: In function 'klu_rgrowth':
klu_diagnostics.c:37:14: warning: variable 'Ui' set but not used [-Wunused-but-set-variable]
   37 |     Int *Q, *Ui, *Uip, *Ulen, *Pinv ;
      |              ^~
klu_diagnostics.c: In function 'klu_condest':
klu_diagnostics.c:182:9: warning: variable 'nblocks' set but not used [-Wunused-but-set-variable]
  182 |     Int nblocks, i, j, jmax, jnew, pend, n ;
      |         ^~~~~~~
klu_diagnostics.c:181:10: warning: variable 'R' set but not used [-Wunused-but-set-variable]
  181 |     Int *R ;
      |          ^
klu_diagnostics.c: In function 'klu_flops':
klu_diagnostics.c:425:21: warning: variable 'n' set but not used [-Wunused-but-set-variable]
  425 |     Int k, ulen, p, n, nk, block, nblocks, k1 ;
      |                     ^
  CC       libKLU_real_la-klu_multiply.lo
  CC       libKLU_real_la-klu_refactor.lo
  CC       libKLU_real_la-klu_scale.lo
  CC       libKLU_real_la-klu_solve.lo
klu_kernel.c: In function 'prune':
klu_kernel.c:553:17: warning: variable 'Ux' set but not used [-Wunused-but-set-variable]
  553 |     Entry *Lx, *Ux ;
      |                 ^~
  CC       libKLU_real_la-klu_sort.lo
  CC       libKLU_real_la-klu_tsolve.lo
klu_refactor.c: In function 'klu_refactor':
klu_refactor.c:34:36: warning: variable 'Offi' set but not used [-Wunused-but-set-variable]
   34 |     Int *P, *Q, *R, *Pnum, *Offp, *Offi, *Ui, *Li, *Pinv, *Lip, *Uip, *Llen,
      |                                    ^~~~
klu_refactor.c:34:29: warning: variable 'Offp' set but not used [-Wunused-but-set-variable]
   34 |     Int *P, *Q, *R, *Pnum, *Offp, *Offi, *Ui, *Li, *Pinv, *Lip, *Uip, *Llen,
      |                             ^~~~
klu_refactor.c:34:10: warning: variable 'P' set but not used [-Wunused-but-set-variable]
   34 |     Int *P, *Q, *R, *Pnum, *Offp, *Offi, *Ui, *Li, *Pinv, *Lip, *Uip, *Llen,
      |          ^
  CC       libKLU_real_la-klu_utils.lo
  CC       libKLU_complex_la-klu.lo
klu_sort.c: In function 'klu_sort':
klu_sort.c:101:9: warning: variable 'n' set but not used [-Wunused-but-set-variable]
  101 |     Int n, nk, nz, block, nblocks, maxblock, k1 ;
      |         ^
  CC       libKLU_complex_la-klu_diagnostics.lo
  CC       libKLU_complex_la-klu_dump.lo
In file included from klu_internal.h:12,
                 from klu.c:61:
klu_version.h:341:14: error: duplicate member 'component'
  341 | #define Imag component [1]
      |              ^~~~~~~~~
  CC       libKLU_complex_la-klu_extract.lo
make[3]: *** [libKLU_complex_la-klu.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from klu_internal.h:12,
                 from klu_diagnostics.c:14:
klu_version.h:341:14: error: duplicate member 'component'
  341 | #define Imag component [1]
      |              ^~~~~~~~~
klu_diagnostics.c: In function 'klu_z_rgrowth':
klu_diagnostics.c:37:14: warning: variable 'Ui' set but not used [-Wunused-but-set-variable]
   37 |     Int *Q, *Ui, *Uip, *Ulen, *Pinv ;
      |              ^~
klu_diagnostics.c: In function 'klu_z_condest':
klu_diagnostics.c:182:9: warning: variable 'nblocks' set but not used [-Wunused-but-set-variable]
  182 |     Int nblocks, i, j, jmax, jnew, pend, n ;
      |         ^~~~~~~
klu_diagnostics.c:181:10: warning: variable 'R' set but not used [-Wunused-but-set-variable]
  181 |     Int *R ;
      |          ^
klu_diagnostics.c: In function 'klu_z_flops':
klu_diagnostics.c:425:21: warning: variable 'n' set but not used [-Wunused-but-set-variable]
  425 |     Int k, ulen, p, n, nk, block, nblocks, k1 ;
      |                     ^
make[3]: *** [libKLU_complex_la-klu_diagnostics.lo] Error 1
In file included from klu_internal.h:12,
                 from klu_dump.c:9:
klu_version.h:341:14: error: duplicate member 'component'
  341 | #define Imag component [1]
      |              ^~~~~~~~~
make[3]: *** [libKLU_complex_la-klu_dump.lo] Error 1
In file included from klu_internal.h:12,
                 from klu_extract.c:12:
klu_version.h:341:14: error: duplicate member 'component'
  341 | #define Imag component [1]
      |              ^~~~~~~~~
make[3]: *** [libKLU_complex_la-klu_extract.lo] Error 1
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_ngspice/ngspice-lib/work/ngspice-43/src/maths/KLU'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_ngspice/ngspice-lib/work/ngspice-43/src/maths'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_ngspice/ngspice-lib/work/ngspice-43/src'
make: *** [all-recursive] Error 1

Change History (11)

comment:1 Changed 3 weeks ago by markemer (Mark Anderson)

We don't hardcode arch do we? Or is that in ngspice? I have zero way to test this, I haven't had a working PPC machine quite some time. If you have a way to fix it without breaking modern macOS, I'm more than happy to merge it.

We probably should set the required C++ standard no matter what.

Last edited 3 weeks ago by markemer (Mark Anderson) (previous) (diff)

comment:2 in reply to:  1 ; Changed 3 weeks ago by barracuda156

Replying to markemer:

We don't hardcode arch do we? Or is that in ngspice? I have zero way to test this, I haven't had a working PPC machine quite some time. If you have a way to fix it without breaking modern macOS, I'm more than happy to merge it.

We probably should set the required C++ standard no matter what.

The portfile added -m64, unconditionally. No idea what for, MacPorts normally handles flags correctly, and this port is not an exception.

Anyway, I have a fix for KLU issue.

  1. S. Do you know why my patch was removed? It is still needed, upstream fixed nothing ever since.
    get_avail_mem_size.c:22:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
       22 | #import <mach/mach.h>
          |  ^~~~~~
    get_resident_set_size.c: In function 'getCurrentRSS':
    get_resident_set_size.c:114:33: error: storage size of 'info' isn't known
      114 |     struct mach_task_basic_info info;
          |                                 ^~~~
    get_avail_mem_size.c:23:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
       23 | #import <mach/mach_host.h>
          |  ^~~~~~
    get_resident_set_size.c:115:40: error: 'MACH_TASK_BASIC_INFO_COUNT' undeclared (first use in this function); did you mean 'TASK_BASIC_INFO_COUNT'?
      115 |     mach_msg_type_number_t infoCount = MACH_TASK_BASIC_INFO_COUNT;
          |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
          |                                        TASK_BASIC_INFO_COUNT
    get_resident_set_size.c:115:40: note: each undeclared identifier is reported only once for each function it appears in
    get_resident_set_size.c:116:40: error: 'MACH_TASK_BASIC_INFO' undeclared (first use in this function); did you mean 'TASK_BASIC_INFO'?
      116 |     if ( task_info( mach_task_self( ), MACH_TASK_BASIC_INFO,
          |                                        ^~~~~~~~~~~~~~~~~~~~
          |                                        TASK_BASIC_INFO
    get_resident_set_size.c:116:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
      116 |     if ( task_info( mach_task_self( ), MACH_TASK_BASIC_INFO,
          |     ^~
    get_resident_set_size.c:119:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
      119 |         return (unsigned long long) info.resident_size;
          |         ^~~~~~
    get_resident_set_size.c:114:33: warning: unused variable 'info' [-Wunused-variable]
      114 |     struct mach_task_basic_info info;
          |                                 ^~~~
    get_resident_set_size.c:140:1: warning: control reaches end of non-void function [-Wreturn-type]
      140 | }
          | ^
    make[4]: *** [get_resident_set_size.lo] Error 1
    

comment:3 in reply to:  2 ; Changed 3 weeks ago by markemer (Mark Anderson)

Replying to barracuda156:

Replying to markemer:

We don't hardcode arch do we? Or is that in ngspice? I have zero way to test this, I haven't had a working PPC machine quite some time. If you have a way to fix it without breaking modern macOS, I'm more than happy to merge it.

We probably should set the required C++ standard no matter what.

The portfile added -m64, unconditionally. No idea what for, MacPorts normally handles flags correctly, and this port is not an exception.

Anyway, I have a fix for KLU issue.

  1. S. Do you know why my patch was removed? It is still needed, upstream fixed nothing ever since.
    get_avail_mem_size.c:22:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
       22 | #import <mach/mach.h>
          |  ^~~~~~
    get_resident_set_size.c: In function 'getCurrentRSS':
    get_resident_set_size.c:114:33: error: storage size of 'info' isn't known
      114 |     struct mach_task_basic_info info;
          |                                 ^~~~
    get_avail_mem_size.c:23:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
       23 | #import <mach/mach_host.h>
          |  ^~~~~~
    get_resident_set_size.c:115:40: error: 'MACH_TASK_BASIC_INFO_COUNT' undeclared (first use in this function); did you mean 'TASK_BASIC_INFO_COUNT'?
      115 |     mach_msg_type_number_t infoCount = MACH_TASK_BASIC_INFO_COUNT;
          |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
          |                                        TASK_BASIC_INFO_COUNT
    get_resident_set_size.c:115:40: note: each undeclared identifier is reported only once for each function it appears in
    get_resident_set_size.c:116:40: error: 'MACH_TASK_BASIC_INFO' undeclared (first use in this function); did you mean 'TASK_BASIC_INFO'?
      116 |     if ( task_info( mach_task_self( ), MACH_TASK_BASIC_INFO,
          |                                        ^~~~~~~~~~~~~~~~~~~~
          |                                        TASK_BASIC_INFO
    get_resident_set_size.c:116:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
      116 |     if ( task_info( mach_task_self( ), MACH_TASK_BASIC_INFO,
          |     ^~
    get_resident_set_size.c:119:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
      119 |         return (unsigned long long) info.resident_size;
          |         ^~~~~~
    get_resident_set_size.c:114:33: warning: unused variable 'info' [-Wunused-variable]
      114 |     struct mach_task_basic_info info;
          |                                 ^~~~
    get_resident_set_size.c:140:1: warning: control reaches end of non-void function [-Wreturn-type]
      140 | }
          | ^
    make[4]: *** [get_resident_set_size.lo] Error 1
    

We can add that patch back in, it built fine without it out it on arm and intel with v43. We can add it back in. I'll leave a comment for future me as to why it's in there.

comment:4 in reply to:  1 ; Changed 3 weeks ago by barracuda156

Replying to markemer:

  1. S. Not that I expect anyone to test on powerpc when updating ports, that would be unreasonable, but closing a ticket about a failure was a bit premature.

comment:5 in reply to:  3 Changed 3 weeks ago by barracuda156

Replying to markemer:

We can add that patch back in, it built fine without it out it on arm and intel with v43. We can add it back in. I'll leave a comment for future me as to why it's in there.

Since there are several issues to address now, perhaps let me hopefully get the build succeeding, and I will tag you in a PR to review it.

(I mean, restoring a patch separately does not hurt, of course, it is just insufficient.)

comment:6 in reply to:  4 Changed 3 weeks ago by markemer (Mark Anderson)

Replying to barracuda156:

Replying to markemer:

  1. S. Not that I expect anyone to test on powerpc when updating ports, that would be unreasonable, but closing a ticket about a failure was a bit premature.

Yeah, I might have cast too wide a net when I closed those tickets. I'm just now noticing that one is pretty recent.

comment:7 in reply to:  4 Changed 3 weeks ago by markemer (Mark Anderson)

Replying to barracuda156:

Replying to markemer:

  1. S. Not that I expect anyone to test on powerpc when updating ports, that would be unreasonable, but closing a ticket about a failure was a bit premature.

Yeah, I don't want to break stuff if I don't have to - we need v43 for some reasonably modern models, but if it still builds with some tweaks, works for me.

comment:8 Changed 3 weeks ago by barracuda156

ngspice-lib is fixed, but ngspice still fails on the old bug:

  CC       ngspice-main.o
  CC       ngspice-conf.o
  CC       ngspice-ngspice.o
rm -f spinit spinit.tmp
srcdir=''; \
	  test -f ./spinit.in || srcdir=./; \
	  sed -e 's|@XSPICEINIT[@]||g' -e 's|@pkglibdir[@]|../lib/ngspice|g' ${srcdir}spinit.in >spinit.tmp
mv spinit.tmp spinit
{standard input}:1843:FATAL:incompatible feature used: directive .non_lazy_symbol_pointer (must specify "-dynamic" to be used)
make[2]: *** [ngspice-main.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_ngspice/ngspice/work/ngspice-43/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_ngspice/ngspice/work/ngspice-43/src'
make: *** [all-recursive] Error 1

comment:9 Changed 3 weeks ago by barracuda156

This is what fails, apparently:

spinitpath = ../lib/ngspice
edit = sed \
	-e 's|@XSPICEINIT[@]|$(XSPICEINIT)|g' \
	-e 's|@pkglibdir[@]|$(spinitpath)|g'

AM_CFLAGS = -static

Why does it even need a static linking?

Version 0, edited 3 weeks ago by barracuda156 (next)

comment:10 Changed 3 weeks ago by barracuda156

Last edited 3 weeks ago by barracuda156 (previous) (diff)

comment:11 Changed 3 weeks ago by Sergey Fedorov <barracuda@…>

Resolution: fixed
Status: assignedclosed

In f6293ac9d36631ade38760671b95873e92e2c40b/macports-ports (master):

ngspice: fix the port for < 10.8 (https://github.com/macports/macports-ports/pull/25537)

  • ngspice: fix compiler choice: it needs C/C++11
  • ngspice: do not hardcode arch flags
  • ngspice: restore accidentally dropped patch
  • ngspice: fix libKLU bug

Closes: #70665

  • ngspice: non-functional: alignment to multiple of 4 spaces
  • ngspice: fix broken linking, finally

Fixes: #70175

  • ngspice: remove unneeded build flags

Co-authored-by: Mark Anderson <mark@…>

Note: See TracTickets for help on using tickets.