"undefined symbol _Py_NoneStruct" when building Pure Data [pyo~] external

317 views
Skip to first unread message

Alexandros Drymonitis

unread,
May 24, 2021, 9:39:54 AM5/24/21
to pyo-discuss
Actually, I've now started a new thread about this error message. The conversation was left at Olivier's reply:

"Everything seems ok... Did you try with 3.8. Lately, on Windows, I didn't succeed to use python 3.9 in a pyo embedded project. I didn't have the time to investigate deeply, and I reverted to 3.8, which was working flawlessly. I had set up an Ubuntu 20.04 (but 32-bit, it's an old computer), I'll see if I can get it working there with python 3.9...

Olivier"

Trying Python3.8 did not work either.

Alexandros Drymonitis

unread,
Aug 31, 2021, 4:45:37 AM8/31/21
to pyo-discuss
Hi, revisiting this thread because I included Pd's current makefile system. The one that ships with Pyo uses the old Makefile, which, IIRC, is from the Pd-extended era. Nowdays the makefile system used for building externals in Pd is this https://github.com/pure-data/pd-lib-builder. Copying the Makefile.pdlibbuilder file in the directory of the [pyo~] source files, and copying the m_pyo.h file there as well, builds a Pd external with the following Makefile:

```
# Makefile for mylib

lib.name = pyo~

class.sources = pyo~.c

# m_pyo.h should be in this directory, don't know how to include it when it's in the parent directory
common.sources = m_pyo.h

datafiles = pyo~-help.pd manual.txt README.md

cflags = -I"$(PD_INCLUDE)" -I.. -Wno-cast-function-type -Wno-unused-parameter $(shell python-config --cflags)

ldflags = $(shell python-config --ldflags)

ldlibs = $(shell python-config --libs)

# use the following two lines if you have pd-lib-builder with the Makefile.pdlibbuilder in the parent directory of this one
#PDLIBBUILDER_DIR=../pd-lib-builder/
#include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder

# otherwise use the line below. In this case you should have Makefile.pdlibbuilder in this directory
include Makefile.pdlibbuilder
```
Note that I'm not using python3 in the cflags, ldflas, and ldlibs variables, because Python3 is the default Python on my system, and runs with the `python` command. Change according to your system.

The error message of this thread's subject line remains, still the object builds. Thought I'd share this makefile system update, since it's maintained by the core team of developers of Pd (not Miller himself, but the core around him).
If anyone has any idea why this error message occurs when I try to load the object in Pd, please enlighten me.

My system is Ubuntu Studio 21.04 with Pd-0.51.4

Alexandros

unread,
Aug 31, 2021, 4:53:14 AM8/31/21
to pyo-d...@googlegroups.com

Another update. This is the output when typing make:

cc -DPD -I "/usr/include/pd" -DUNIX  -fPIC -I"" -I.. -Wno-cast-function-type -Wno-unused-parameter -I/usr/include/python3.9 -I/usr/include/python3.9  -Wno-unused-result -Wsign-compare -g -ffile-prefix-map=/build/python3.9-1n6GrT/python3.9-3.9.5=. -flto=auto -ffat-lto-objects -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector -Wformat -Werror=format-security  -DNDEBUG -g -fwrapv -O3 -Wall -Wall -Wextra -Wshadow -Winline -Wstrict-aliasing -O3 -ffast-math -funroll-loops -fomit-frame-pointer -march=core2 -mfpmath=sse -msse -msse2 -msse3 -o pyo~.o -c pyo~.c
make: *** No rule to make target 'm_pyo.o', needed by 'pyo~.pd_linux'.  Stop.

So, the building process stops at this point. I guess this could be cause the error message?

--
You received this message because you are subscribed to a topic in the Google Groups "pyo-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyo-discuss/ESClWoB9Qz0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyo-discuss/cdb046f7-ec75-4d90-ab04-be8f0116d68en%40googlegroups.com.

Olivier Bélanger

unread,
Sep 2, 2021, 8:13:00 PM9/2/21
to pyo-d...@googlegroups.com
Hi,

Have you tried adding the "-rdynamic" (without the quotes) flag to the linker (which tells the program to resolve symbols dynamically at run-time)?

Olivier


--
You received this message because you are subscribed to the Google Groups "pyo-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyo-discuss...@googlegroups.com.

Olivier Bélanger

unread,
Sep 2, 2021, 8:16:12 PM9/2/21
to pyo-d...@googlegroups.com
Hi again!

In the previous message, you said that the object builds....

On Tue, Aug 31, 2021 at 4:53 AM Alexandros <alexdry...@gmail.com> wrote:

Another update. This is the output when typing make:

cc -DPD -I "/usr/include/pd" -DUNIX  -fPIC -I"" -I.. -Wno-cast-function-type -Wno-unused-parameter -I/usr/include/python3.9 -I/usr/include/python3.9  -Wno-unused-result -Wsign-compare -g -ffile-prefix-map=/build/python3.9-1n6GrT/python3.9-3.9.5=. -flto=auto -ffat-lto-objects -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector -Wformat -Werror=format-security  -DNDEBUG -g -fwrapv -O3 -Wall -Wall -Wextra -Wshadow -Winline -Wstrict-aliasing -O3 -ffast-math -funroll-loops -fomit-frame-pointer -march=core2 -mfpmath=sse -msse -msse2 -msse3 -o pyo~.o -c pyo~.c
make: *** No rule to make target 'm_pyo.o', needed by 'pyo~.pd_linux'.  Stop.


... but this says it is not. Maybe a typo in the Makefile?

Olivier
 
You received this message because you are subscribed to the Google Groups "pyo-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyo-discuss/95465e45-970a-8a21-e3b4-615a642c57b6%40gmail.com.

Alexandros Drymonitis

unread,
Feb 22, 2023, 4:08:16 AM2/22/23
to pyo-discuss
Revisiting this thread as I tried to build this object again. I asked the Pd list, but it appears the the issue is Python related, so I'm sending here again. The object doesn't build if I try Pd's new Makefile, but it builds with the Makefile used by Pyo, which is he old Pd Makefile. The error in the subject of this thread though keeps on appearing. The -rdynamic flag is probably there, as it is mentioned in the `make` output. Also, the compiler seems to be looking at the right places, for example /usr/lib/x86_64-linux-gnu. This is the output of make:
```
cc -I"/usr/include/pd" -I.. -Wno-cast-function-type -Wno-unused-parameter -I/usr/include/python3.10 -I/usr/include/python3.10  -Wno-unused-result -Wsign-compare -g      -fstack-protector-strong -Wformat -Werror=format-security  -DNDEBUG
-g -fwrapv -O2 -Wall -DPD -DVERSION='"0.1"' -fPIC -Wall -W -g -O6 -funroll-loops -fomit-frame-pointer -o "pyo~.o" -c "pyo~.c"
cc  -L/usr/lib/python3.10/config-3.10-x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu  -lcrypt -ldl  -lm -lm  -rdynamic -shared -fPIC -Wl,-rpath,"\$ORIGIN",--enable-new-dtags -o "pyo~.l_ia64" "pyo~.o"    -lcrypt -ldl  -lm -lm  -lc   
chmod a-x "pyo~.l_ia64"
```
I searched online, and -rdynamic is the most prevailing answer, so I really don't know how to approach this. This answer here https://www.gamedev.net/forums/topic/167094-undefined-reference-to-_imp___py_nonestruct/ mentions an answer from Python's FAQ, saying that _Py_NoneStruct shoud be replaced by Py_BuildValue(""), but I guess this goes into the source code of Pyo and not the Pd object, as I can't find any _Py_NoneStruct in the pyo~.c file of the Pd external. Any ideas?

Olivier Bélanger

unread,
Mar 11, 2023, 11:44:41 PM3/11/23
to pyo-d...@googlegroups.com
Hi Alexandros,

I'll try to take a look at this next week!

Olivier


Reply all
Reply to author
Forward
0 new messages