linker input file unused because linking not done with cython

176 views
Skip to first unread message

Tomas Bartoli

unread,
Sep 8, 2023, 12:30:07 AM9/8/23
to cython-users

This is the setup for the installation of cython module:

from setuptools import setup, find_packages, Extension
from Cython.Distutils import build_ext
from Cython.Build import cythonize

setup(
    name="online_no_mem",
    packages=find_packages(include=['.', '.*']),
    zip_safe=False,
    #ext_modules=cythonize("online_no_mem.pyx")
    ext_modules=[
        Extension(
        "online_no_mem",
        sources=["online_no_mem.pyx"],
        extra_compile_args=[
            "libpheval.a",
            "-O3", "-std=c++17",
            "-fopenmp",
            '-fPIC'
            ],
        #library_dirs=['/home/tomas/Desktop/Projects/MC'],
        include_dirs=['../Deck', '/home/tomas/Desktop/Projects/thirdparty/HandEvaluator-master/cpp/include',
        ],
        language="c++",
        #libraries=['/home/tomas/Desktop/Projects/MC/libpheval.a'],
        extra_link_args=['-fopenmp', "libpheval.a"],

    )],
    cmdclass = {'build_ext': build_ext}
)

During the compilation I have these errors:

tomas@tomas-tobefilledbyoem:~/Desktop/Projects/MC$ python setup.py build_ext --inplace running build_ext skipping 'online_no_mem.cpp' Cython extension (up-to-date) building 'online_no_mem' extension gcc -pthread -B /home/tomas/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../Nodes -I/home/tomas/Desktop/Projects/thirdparty/HandEvaluator-master/cpp/include -I/home/tomas/Desktop/Projects/MC -I/home/tomas/anaconda3/include/python3.7m -c online_no_mem.cpp -o build/temp.linux-x86_64-cpython-37/online_no_mem.o libpheval.a -O3 -std=c++17 -fopenmp cc1plus: warning: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc: warning: libpheval.a: linker input file unused because linking not done g++ -pthread -B /home/tomas/anaconda3/compiler_compat -Wl,--sysroot=/ -pthread -shared -B /home/tomas/anaconda3/compiler_compat -L/home/tomas/anaconda3/lib -Wl,-rpath=/home/tomas/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-cpython-37/online_no_mem.o -o /home/tomas/Desktop/Projects/MC/online_no_mem.cpython-37m-x86_64-linux-gnu.so 


If I compile it as a normal c++ code with:

g++ online_no_mem.cpp -o online_no_mem.o libpheval.a -O3 -std=c++17 -I ../Nodes -I /home/tomas/Desktop/Projects/thirdparty/HandEvaluator-master/cpp/include -fopenmp

I have no problems.



Stefan Behnel

unread,
Sep 9, 2023, 5:59:51 AM9/9/23
to cython...@googlegroups.com
Hi,

Tomas Bartoli schrieb am 08.09.23 um 01:29:
>
>
> This is the setup for the installation of cython module:
> from setuptools import setup, find_packages, Extension
> from Cython.Distutils import build_ext
> from Cython.Build import cythonize
>
> setup(
> name="online_no_mem",
> packages=find_packages(include=['.', '.*']),
> zip_safe=False,
> #ext_modules=cythonize("online_no_mem.pyx")
> ext_modules=[
> Extension(
> "online_no_mem",
> sources=["online_no_mem.pyx"],
> extra_compile_args=[
> "libpheval.a",

Remove this line. You are not compiling against that (static) library, just
linking against it.

Stefan
Reply all
Reply to author
Forward
0 new messages