VectorFunctionSpace JIT compile is not working on mingw

Issue #130 resolved
Chaffra Affouda created an issue

this simple example is not working after update to dijitso

mesh = UnitSpaceMesh(100,100)
V = VectorFunctionSpace(mesh,'CG',1)

the compile command that's failing is below. All the files are there but somehow the linker is not finding -ldijitso-ffc_element_d9ff644853cc218e8f962af6a3778b698bb71081

c++ -Wall -shared -fPIC -std=c++11 -O2 -IC:/msys64/mingw64/lib/python2.7/site-packages/ffc-2016.2.0.dev0-py2.7.egg/ffc/backends/ufc -IC:/msys64/home/chaffra/.cache/dijitso/include ffc_element_a362cff3edcbc48f60bbc43ddaf51e8067dd99bf.cpp -LC:/msys64/home/chaffra/.cache/dijitso/lib -Wl,-rpath,C:/msys64/home/chaffra/.cache/dijitso/lib -ldijitso-ffc_element_d9ff644853cc218e8f962af6a3778b698bb71081 -olibdijitso-ffc_element_a362cff3edcbc48f60bbc43ddaf51e8067dd99bf.so

But

mesh = UnitSpaceMesh(100,100)
Q = FunctionSpace(mesh,'CG',1)

which is not linking to anything compiles fine.

Comments (12)

  1. Martin Sandve Alnæs

    Is the compiler g++? When you run the example code, a directory "jitfailure..." should be created. Can you post the error log found in there?

  2. Chaffra Affouda reporter

    Here is the command being ran:

    c++ -Wall -shared -fPIC -std=c++11 -O2 -IC:/msys64/mingw64/lib/python2.7/site-packages/ffc-2016.2.0.dev0-py2.7.egg/ffc/backends/ufc -IC:/msys64/home/chaffra/.cache/dijitso/include ffc_element_e9df002726ec.cpp -LC:/msys64/home/chaffra/.cache/dijitso/lib -Wl,-rpath,C:/msys64/home/chaffra/.cache/dijitso/lib -ldijitso-ffc_element_3e92f51a1da5 -olibdijitso-ffc_element_e9df002726ec.so
    

    Here is the error log. Yes the compiler is g++.

    C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ldijitso-ffc_element_3e92f51a1da5
    
    collect2.exe: error: ld returned 1 exit status
    

    The following hack seems to do the trick but I don't know why it's not working with -L.

    if sys.platform == 'win32':
            for lib in deplibs:
                full_lib_filename = os.path.join(lib_dir,
                                                 cache_params['lib_prefix']+lib+cache_params['lib_postfix']
                                             )
                args.append(os.path.abspath(full_lib_filename))
        else:
            args.extend("-l" + lib for lib in deplibs)
    

    But that assumes deplibs only contains libraries in .cache/dijitso/lib.

  3. Martin Sandve Alnæs

    Can you try changing the lib_postfix in dijitso/params.py from ".so" to ".dll"?

    Without the absolute path change you did here.

  4. Log in to comment