Skip to content

C++ shared object library linker issue with declaration/definition #63

@Jintram

Description

@Jintram

This is fixed, but I've put this in tracker because a) we have a fix but don't know exactly how it works and b) perhaps we might run into this problem again and it's convenient to keep track of (fixed) problems.

The issue

Though compiling of "affected" branches did work on desktops, on the cluster we had the following issue.

The code did compile, but after compilation we would get the message:

ImportError <>.so undefined symbol <either MIN_TERMS or MAX_TERMS>

A specific example:

ImportError: ./_greens_functions.so: undefined symbol: _ZN22GreensFunction1DRadAbs14MAX_TERMS_TESTE

This can be fixed either by using static_cast on all occurences of MIN_TERMS and MAX_TERMS of the 1D functions, or by adding the next two lines to the .cpp files of the 1D functions (right after the includes, see current version of the code):

const unsigned int GreensFunction1DAbsAbs::MAX_TERMS;
const unsigned int GreensFunction1DAbsAbs::MIN_TERMS;

(With appropriate name of GFs.) The latter approach is what is done with other variables in used in the (other) Green's functions. It seems it has something to do with the variables not being defined before (http://bytes.com/topic/python/answers/133013-extending-python-undefined-symbol-error-import, http://wiki.answers.com/Q/What_is_the_difference_between_declaration_and_a_definition_in_C), but as mentioned we're not entirely sure how this works.

M.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions