On Mon, Jun 01, 2020 at 09:37:39AM +0800, Honggang LI wrote:
On Sun, May 31, 2020 at 10:30:32AM -0700, Gordon Messmer wrote:
> On 5/31/20 1:24 AM, Honggang LI wrote:
> > As you see, "-lpython3.9" or "-lpython3.9d" library must be
provided to
> > the linker. Otherwise, a lot of "undefined reference to xxx" error
> > messages show up.
>
>
> I'd guess that you're seeing "undefined reference" when you use
ldd on the
> so, and that's expected. That's the wrong way to test the object, though.
> Instead, install that module and import it from a python3 shell. Do you get
We have to compile/build the module before we can import it from a
python3 shell. The problem is how to compile the modules without pass
"-lpython3.9" or "-lpython3.9d" to the linker (/usr/bin/ld).
After remove '-Wl,--no-undefined' from the gcc command line, build
xxx.so without "-lpython3.9" or "-lpython3.9d" works for me now.
+ gcc -fPIC -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wmissing-prototypes
-Wmissing-declarations -Wwrite-strings -Wformat=2 -Wcast-function-type -Wformat-nonliteral
-Wdate-time -Wnested-externs -Wshadow -Wstrict-prototypes -Wold-style-definition
-Wredundant-decls -O2 -g -DNDEBUG -Wl,--as-needed -shared -Wl,-z,relro -Wl,--as-needed
-Wl,-z,now -g -Wl,-z,relro -Wl,--as-needed -Wl,-z,now
-Wl,-soname,srq.cpython-39-x86_64-linux-gnu.so -o
../python/pyverbs/srq.cpython-39-x86_64-linux-gnu.so
CMakeFiles/srq.cpython-39-x86_64-linux-gnu.dir/srq.c.o -Wl,-z,relro -Wl,--as-needed
-Wl,-z,now -g -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -g
-Wl,-rpath,/home/honli/upstream/rdma-core/build/lib: ../lib/librdmacm.so.1.2.30.0
../lib/libibverbs.so.1.9.30.0
+ ldd ../python/pyverbs/srq.cpython-39-x86_64-linux-gnu.so
linux-vdso.so.1 (0x00007ffec4b9c000)
libibverbs.so.1 => /home/honli/upstream/rdma-core/build/lib/libibverbs.so.1
(0x00007f40d5136000)
libc.so.6 => /lib64/libc.so.6 (0x00007f40d4f5b000)
libnl-route-3.so.200 => /lib64/libnl-route-3.so.200 (0x00007f40d4ed3000)
libnl-3.so.200 => /lib64/libnl-3.so.200 (0x00007f40d4eaf000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f40d4e8d000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f40d4e86000)
/lib64/ld-linux-x86-64.so.2 (0x00007f40d516b000)
+ grep python
+ ldd ../python/pyverbs/srq.cpython-39-x86_64-linux-gnu.so
I think I know how to avoid link pyverbs without libpython3.9. I will
fix this for rdma-core (fc33).
Thanks