← Back to team overview

kicad-developers team mailing list archive

Re: eeschema depends on libngspice.so instead of libngspice.so.0?

 

Hi Stefan,

On 10/30/18 4:22 PM, Brüns, Stefan wrote:
[snip]
> Some inline comments:
>> diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt
>> index e56f3c849..cd4d0d78e 100644
>> --- a/eeschema/CMakeLists.txt
>> +++ b/eeschema/CMakeLists.txt
>> @@ -7,6 +7,15 @@ add_definitions( -DEESCHEMA )
>>  if( KICAD_SPICE )
>>      set( INC_AFTER ${INC_AFTER} ${NGSPICE_INCLUDE_DIR} )
>> +
>> +    # Find out the exact libngspice file name
>> +    get_filename_component( NGSPICE_REAL_PATH "${NGSPICE_LIBRARY}" REALPATH
>> ) +    get_filename_component( NGSPICE_LIB_FILE "${NGSPICE_REAL_PATH}" NAME
>> ) +
>> +    set_property( SOURCE sim/ngspice.cpp
>> +        APPEND PROPERTY COMPILE_DEFINITIONS
>> +        NGSPICE_LIB_FILE="${NGSPICE_LIB_FILE}"
>> +        )
>>  endif()
>>  include_directories( BEFORE ${INC_BEFORE} )
>> @@ -359,7 +368,15 @@ target_link_libraries( eeschema_kiface
>>      legacy_gal
>>      ${wxWidgets_LIBRARIES}
>>      ${GDI_PLUS_LIBRARIES}
>> +    ${NGSPICE_LIBRARY}
> 
> Likely duplicates the line below and probably breaks when NGSPICE_LIBRARY is 
> unset

You are correct. I have noticed that as well and in the patch that has
been committed [1] NGSPICE_LIBRARY is linked only conditionally.

>>      )
>>
>> +
>> +if( KICAD_SPICE )
>> +    target_link_libraries( eeschema_kiface
>> +        ${NGSPICE_LIBRARY}
>> +        )
>> +endif()
> 
> This does not achieve what you likely intended. At least on openSUSE, kicad is 
> linked with the as-needed linker flag, discarding any symbols and libraries 
> not actually linked to.

Good point, thank you sharing the information. Do you know how smart is
the linker when the flag is enabled? Is it enough to call a function
from libngspice in a part of code that is actually never executed? Do we
need to create a dedicated dummy executable and install it as well?

Kind regards,
Orson

> Kind regards,
> 
> Stefan

1.
https://git.launchpad.net/kicad/commit/?id=b445b0fab28f7dd41273801d06d7705215c57c0f

Attachment: signature.asc
Description: OpenPGP digital signature


References