Menu

#510 Compiling fails | undefined reference to `controlled_exit'

v1.0 (example)
closed-fixed
None
5
2020-10-13
2020-08-11
No

Hello,
I'm having some problem compiling ngspice32 on RHEL 7.8.
I downloaded the master branch, moved in and then followed these steps:

mkdir release
./autogen.sh
cd release
../configure --without-x --prefix=/home/rizzi/MyPackage/ngspice-compile/ngspice-32 CFLAGS="-m64 -O2" LDFLAGS="-m64 -s"
make clean
make

But something goes wrong and I recieve this error at the end of make's logfile:

...
...

../../misc/.libs/libmisc.a(string.o): In function `scannum':
string.c:(.text+0x4c0): multiple definition of `scannum'
test_cx_mag.o:test_cx_mag.c:(.text+0x40): first defined here
../../misc/.libs/libmisc.a(string.o): In function `tvprintf':
string.c:(.text+0x3a3): undefined reference to `controlled_exit'
collect2: error: ld returned 1 exit status
make[3]: *** [test_cx_mag] Error 1
make[3]: Leaving directory `/home/rizzi/MyPackage/ngspice-ngspice/release/src/maths/cmaths'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/rizzi/MyPackage/ngspice-ngspice/release/src/maths'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/rizzi/MyPackage/ngspice-ngspice/release/src'
make: *** [all-recursive] Error 1

Please find attached the complete make's logfile.
Any help would be much appreciated.

1 Attachments

Discussion

  • Holger Vogt

    Holger Vogt - 2020-08-11

    There is some ancient code which creates problems here. I will consider removing it. I am not sure why this is working in all other setups known to me, but not in yours. You may try removing the code by editing
    ngspice\src\maths\cmaths\Makefile.am

    Remove the following passage

    if !TCL_MODULE
    if !WINGUI
    if !SHARED_MODULE
    
    noinst_PROGRAMS = test_cx_mag test_cx_j test_cx_ph test_cx_cph
    
    test_cx_ph_SOURCES = \
            test_cx_ph.c
    
    test_cx_ph_LDADD = \
            libcmaths.la \
            ../../misc/libmisc.la \
            $(TCL_LIB_SPEC)
    
    test_cx_cph_SOURCES = \
                   test_cx_cph.c
    
    test_cx_cph_LDADD = \
                    libcmaths.la \
                    ../../misc/libmisc.la \
                    $(TCL_LIB_SPEC)
    
    test_cx_mag_SOURCES = \
            test_cx_mag.c
    
    test_cx_mag_LDADD = \
            libcmaths.la \
            ../../misc/libmisc.la \
            $(TCL_LIB_SPEC)
    
    test_cx_j_SOURCES = \
            test_cx_j.c
    
    test_cx_j_LDADD = \
            libcmaths.la \
            ../../misc/libmisc.la \
            $(TCL_LIB_SPEC)
    
    TESTS = test_cx_mag test_cx_j test_cx_ph test_cx_cph
    
    endif !SHARED_MODULE
    endif !WINGUI
    endif !TCL_MODULE
    

    and try compiling again, starting with ./autogen.sh.

     

    Last edit: Holger Vogt 2020-08-11
  • Tommaso Rizzi

    Tommaso Rizzi - 2020-08-11

    Thanks a lot for your quick reply!

    The compiling still fails but this time with the following message:

    ...
    ...
    
    misc/.libs/libmisc.a(util.o): In function `substring':
    util.c:(.text+0x60): multiple definition of `substring'
    ngspice-main.o:main.c:(.text+0x80): first defined here
    collect2: error: ld returned 1 exit status
    make[2]: *** [ngspice] Error 1
    make[2]: Leaving directory `/home/rizzi/MyPackage/ngspice-ngspice/release/src'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/home/rizzi/MyPackage/ngspice-ngspice/release/src'
    make: *** [all-recursive] Error 1
    

    As before you can find attached the make.log

     

    Related

    ngspice: ngspice

  • Holger Vogt

    Holger Vogt - 2020-08-11
    • status: open --> open-accepted
    • assigned_to: Holger Vogt
     
  • Holger Vogt

    Holger Vogt - 2020-08-17

    We have inline functions defined in a header stringutil.h that are included several times.

    Try compiling with flag -std=c99

     
  • Tommaso Rizzi

    Tommaso Rizzi - 2020-08-21

    It wroked!
    I rolled back to the master branch --without deleting the passage you mentioned-- and just added -std=c99 to the CFLAGS when calling ../configure "...".

    Thanks a lot!
    The ticket can be closed for me.

     
  • Holger Vogt

    Holger Vogt - 2020-08-21
    • status: open-accepted --> closed-fixed
     
  • J Jacob Wikner

    J Jacob Wikner - 2020-10-13

    [edit, noticed it was a bug to be fixed]

    I see the same issue on centos 7, but don't understand the fix. Could it be clarified please?

     

    Last edit: J Jacob Wikner 2020-10-13
  • Holger Vogt

    Holger Vogt - 2020-10-13

    Centos 7 uses an old compiler which has a different (old) standard for handling inline functions. Adding the flag -std=c99 will lead gcc to use the newer standard. This will not be added to ngspice because it is Centos-specific.

    The bug fix to
    undefined reference to controlled_exit
    is available in ngspice git master. Early during compilation some executables are generated to test some math functions. At this stage the file containing function 'controlled_exit' has not yet being compiled. The math function test is outdated and has now been removed (to be available only with an extra configure flag).

     

    Last edit: Holger Vogt 2020-10-13

Log in to post a comment.

MongoDB Logo MongoDB