`undefined symbol` custom expression linking failure

I am trying to run FEniCS (2019) on a new (Linux) machine. I installed FEniCS through conda, no problem. But when I run my code, at the time of compiling custom C++ expressions, the compilation passes but the link fails.
Here is a MWE:

import dolfin

cpp = '''\
#include <dolfin/function/Expression.h>
#include <pybind11/pybind11.h>

class Expr : public dolfin::Expression
{
public:
    Expr() : dolfin::Expression() {}
};

PYBIND11_MODULE(SIGNATURE, m)
{
    pybind11::class_<Expr, std::shared_ptr<Expr>, dolfin::Expression>
    (m, "Expr")
    .def(pybind11::init<>());
}
'''

module = dolfin.compile_cpp_code(cpp)

returns:

Traceback (most recent call last):
  File "test.py", line 37, in <module>
    module = dolfin.compile_cpp_code(cpp)
  File "/var/tmp/fenics-2019.1.0-conda/miniconda/lib/python3.8/site-packages/dolfin/jit/pybind11jit.py", line 95, in compile_cpp_code
    module, signature = dijitso_jit(cpp_code, module_name, params,
  File "/var/tmp/fenics-2019.1.0-conda/miniconda/lib/python3.8/site-packages/dolfin/jit/jit.py", line 47, in mpi_jit
    return local_jit(*args, **kwargs)
  File "/var/tmp/fenics-2019.1.0-conda/miniconda/lib/python3.8/site-packages/dolfin/jit/jit.py", line 103, in dijitso_jit
    return dijitso.jit(*args, **kwargs)
  File "/var/tmp/fenics-2019.1.0-conda/miniconda/lib/python3.8/site-packages/dijitso/jit.py", line 212, in jit
    lib = load_library(signature, cache_params)
  File "/var/tmp/fenics-2019.1.0-conda/miniconda/lib/python3.8/site-packages/dijitso/cache.py", line 363, in load_library
    lib = __import__(signature)
ImportError: /home/genet/.cache/dijitso-2019.1.0/lib/dolfin_cpp_module_e0fdf869aed999f1dc7592091234875c.so: undefined symbol: _ZN6dolfin10Expression12set_propertyESsd

Any idea? Thanks!

Sanity check: Have you tried running dijitso clean just to make sure it’s not pulling anything old from the cache?

And after that if you could do:

ldd /home/genet/.cache/dijitso-2019.1.0/lib/dolfin_cpp_module_e0fdf869aed999f1dc7592091234875c.so

(or whatever the signature is that dijitso gives the shared library) to make sure everything’s linked to the right places.

Thanks a lot Nate!

I did try dijitso clean and removing ~/.cache multiple times, to no avail—I should have mentioned it.

Here is the output of ldd:

	linux-vdso.so.1 =>  (0x00007ffca33ea000)
	libmpi.so.12 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/libmpi.so.12 (0x00007f6c04016000)
	libmpicxx.so.12 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/libmpicxx.so.12 (0x00007f6c0473b000)
	libpetsc.so.3.13 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/libpetsc.so.3.13 (0x00007f6c02c78000)
	libslepc.so.3.13 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/libslepc.so.3.13 (0x00007f6c02965000)
	libhdf5.so.103 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/libhdf5.so.103 (0x00007f6c025b2000)
	libboost_timer.so.1.74.0 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/libboost_timer.so.1.74.0 (0x00007f6c0472e000)
	libdolfin.so.2019.1 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/libdolfin.so.2019.1 (0x00007f6c01fde000)
	libstdc++.so.6 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/libstdc++.so.6 (0x00007f6c045b9000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f6c01cdc000)
	libgcc_s.so.1 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/libgcc_s.so.1 (0x00007f6c0457e000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f6c0190e000)
	libgfortran.so.5 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libgfortran.so.5 (0x00007f6c0176e000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f6c01552000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f6c0134a000)
	libgomp.so.1 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libgomp.so.1 (0x00007f6c0131d000)
	libquadmath.so.0 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libquadmath.so.0 (0x00007f6c012e3000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f6c0453b000)
	libHYPRE.so => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libHYPRE.so (0x00007f6c00eff000)
	libdmumps-5.2.1.so => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libdmumps-5.2.1.so (0x00007f6c00cd1000)
	libumfpack.so.5 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libumfpack.so.5 (0x00007f6c00bfb000)
	libklu.so.1 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libklu.so.1 (0x00007f6c00bc4000)
	libcholmod.so.3 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libcholmod.so.3 (0x00007f6c00abb000)
	libamd.so.2 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libamd.so.2 (0x00007f6c0456c000)
	libsuperlu_dist.so.6 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libsuperlu_dist.so.6 (0x00007f6c009d9000)
	liblapack.so.3 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./liblapack.so.3 (0x00007f6bfea14000)
	libptscotchparmetis-6.so => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libptscotchparmetis-6.so (0x00007f6c04564000)
	libptscotch-6.so => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libptscotch-6.so (0x00007f6bfe923000)
	libparmetis.so => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libparmetis.so (0x00007f6bfe89a000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f6bfe696000)
	libmpifort.so.12 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libmpifort.so.12 (0x00007f6bfe655000)
	libcrypto.so.1.1 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libcrypto.so.1.1 (0x00007f6bfe389000)
	libcurl.so.4 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libcurl.so.4 (0x00007f6bfe2f0000)
	libz.so.1 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libz.so.1 (0x00007f6bfe2d0000)
	libboost_chrono.so.1.74.0 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libboost_chrono.so.1.74.0 (0x00007f6bfe2c5000)
	libboost_filesystem.so.1.74.0 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libboost_filesystem.so.1.74.0 (0x00007f6bfe2a4000)
	libboost_program_options.so.1.74.0 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libboost_program_options.so.1.74.0 (0x00007f6bfe23b000)
	libboost_iostreams.so.1.74.0 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./libboost_iostreams.so.1.74.0 (0x00007f6bfe222000)
	libmumps_common-5.2.1.so => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libmumps_common-5.2.1.so (0x00007f6bfe1c8000)
	libmetis.so => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libmetis.so (0x00007f6bfe153000)
	libpord-5.2.1.so => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libpord-5.2.1.so (0x00007f6bfe13a000)
	libptesmumps-6.so => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libptesmumps-6.so (0x00007f6bfe133000)
	libptscotcherr-6.so => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libptscotcherr-6.so (0x00007f6bfe12e000)
	libscotch-6.so => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libscotch-6.so (0x00007f6bfe089000)
	libscalapack.so => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libscalapack.so (0x00007f6bfdab4000)
	libsuitesparseconfig.so.5 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libsuitesparseconfig.so.5 (0x00007f6bfdaae000)
	libcolamd.so.2 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libcolamd.so.2 (0x00007f6bfdaa4000)
	libbtf.so.1 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libbtf.so.1 (0x00007f6bfda9d000)
	libccolamd.so.2 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libccolamd.so.2 (0x00007f6bfda8f000)
	libcamd.so.2 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libcamd.so.2 (0x00007f6bfda80000)
	libnghttp2.so.14 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libnghttp2.so.14 (0x00007f6bfda56000)
	libssh2.so.1 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libssh2.so.1 (0x00007f6bfda12000)
	libssl.so.1.1 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libssl.so.1.1 (0x00007f6bfd981000)
	libgssapi_krb5.so.2 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libgssapi_krb5.so.2 (0x00007f6bfd932000)
	libkrb5.so.3 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libkrb5.so.3 (0x00007f6bfd859000)
	libk5crypto.so.3 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libk5crypto.so.3 (0x00007f6bfd839000)
	libcom_err.so.3 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libcom_err.so.3 (0x00007f6bfd833000)
	libbz2.so.1.0 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libbz2.so.1.0 (0x00007f6bfd81e000)
	liblzma.so.5 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././liblzma.so.5 (0x00007f6bfd7f5000)
	libzstd.so.1 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/././libzstd.so.1 (0x00007f6bfd736000)
	libscotcherr-6.so => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./././libscotcherr-6.so (0x00007f6bfd730000)
	libkrb5support.so.0 => /var/tmp/fenics-2019.1.0-conda/miniconda/lib/./././libkrb5support.so.0 (0x00007f6bfd720000)
	libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f6bfd506000)

Does that ring any bell to you? For instance, I see that libm.so.6 => /lib64/libm.so.6 even though there is /var/tmp/fenics-2019.1.0-conda/miniconda/x86_64-conda_cos6-linux-gnu/sysroot/lib/libm.so.6; could that be a problem?