Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Undefined symbol when importing module in python

Open
#380 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp, python
Domain
backend

Research direction

Start by comparing the expected and exported symbols in libboost_python39.so.1.78.0 against the shown ConnectionFactory exposure on Ubuntu 18.04. Review the objcopy workaround and determine whether the mismatch is reproducible and whether it indicates a Boost.Python or build configuration problem.

Written by the indexing model from the issue text.

Description

Hi guys

I''m trying to use boost python and then I'm exposing simple class i get
undefined symbol: _ZN5boost6python15instance_holder8allocateEP7_objectmm

I checked symbols in libboost_python39.so.1.78.0 and i noticed that exist following symbol
_ZN5boost6python15instance_holder8allocateEP7_objectmmm (one m more than expected)

So am I doing sth wrong or this is a bug?

My class

struct ConnectionFactory
{   
    ConnectionFactory(){} 
    ~ConnectionFactory(){}
};

Exposing by:
class_<ConnectionFactory>("ConnectionFactory");

Linux Ubuntu 18.04

EDIT:
I made a workaround, just modifying expected symbol using this
objcopy --redefine-sym _ZN5boost6python15instance_holder8allocateEP7_objectmm=_ZN5boost6python15instance_holder8allocateEP7_objectmmm myFile.o

And this is working, but i'm not sure if this is correct approach

Dominant language
C++
Stars
537
Forks
223
Avg merge
11h 22m
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/python

All issues in boostorg/python

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.