Opened 6 years ago

Closed 6 years ago

#5293 closed defect (fixed)

buildModelFMU does not copy DLL libraries in binaries folder

Reported by: dariomangoni@… Owned by: Adrian Pop
Priority: blocker Milestone: 1.13.2
Component: FMI Version: v1.14.0-dev-nightly
Keywords: Cc:

Description

buildFMU does not copy required additional DLL libraries (e.g. sundials) while packaging the FMU, even thought the output DLL does require them.

The generated Makefile found in source does not have any cp command in it.

Log file is clear.

Attachments (2)

test.fmu (10.4 MB ) - added by dariomangoni@… 6 years ago.
test_fmu
test.mo (861 bytes ) - added by dariomangoni@… 6 years ago.
Modelica code used to generate the FMU

Change History (14)

by dariomangoni@…, 6 years ago

Attachment: test.fmu added

test_fmu

comment:1 by dariomangoni@…, 6 years ago

Summary: buildFMU does not copy DLL libraries in binaries folderbuildModelFMU does not copy DLL libraries in binaries folder

comment:2 by Adrian Pop, 6 years ago

Milestone: Future1.13.2
Owner: changed from Lennart Ochel to Adrian Pop
Priority: criticalblocker
Status: newaccepted

I thought we linked everything statically but *strangely* it seems we don't do it for these.
From the Makefile:

-Wl,-Bdynamic -lsundials_idas -lsundials_kinsol -lsundials_nvecserial -Wl,-Bstatic

I only need to change these to:

-Wl,-Bstatic -lsundials_idas -lsundials_kinsol -lsundials_nvecserial -Wl,-Bdynamic

and we should be good to go as we do have .a libs for these.

Is good that we have 1.13.2 coming up with more fixes early next week, we can fix this in that one.

comment:3 by Adrian Pop, 6 years ago

Can you tell me what model did you translate to FMU?

by dariomangoni@…, 6 years ago

Attachment: test.mo added

Modelica code used to generate the FMU

comment:4 by dariomangoni@…, 6 years ago

Yes, it is a very very simple one (just a Modelica.Mechanics.Rotational.Sources.ConstantTorque + .Components.Inertia)

I'll add the attachment.

comment:6 by Adrian Pop, 6 years ago

I will port this to maintenance/v1.13 after is included in the master.

comment:7 by Adrian Pop, 6 years ago

Before:

adrpo33@ida-0030 MINGW64 /c/Users/adrpo33/Downloads/test/binaries/win64
$ /c/OMDev/bin/ntldd/mingw64/ntldd.exe test.dll
        libsundials_idas.dll => not found
        libsundials_kinsol.dll => not found
        libsundials_nvecserial.dll => not found
        ADVAPI32.dll => C:\WINDOWS\SYSTEM32\ADVAPI32.dll (0x00000000032c0000)
        imagehlp.dll => C:\WINDOWS\SYSTEM32\imagehlp.dll (0x00000000001d0000)
        KERNEL32.dll => C:\WINDOWS\SYSTEM32\KERNEL32.dll (0x0000000003360000)
        msvcrt.dll => C:\WINDOWS\SYSTEM32\msvcrt.dll (0x0000000003360000)
        USER32.dll => C:\WINDOWS\SYSTEM32\USER32.dll (0x0000000003610000)
        WS2_32.dll => C:\WINDOWS\SYSTEM32\WS2_32.dll (0x00000000034f0000)

After:

adrpo33@ida-0030 MINGW64 /tmp/OpenModelica/OMEdit/test/test/binaries/win64
$ /c/OMDev/bin/ntldd/mingw64/ntldd.exe test.dll
        KERNEL32.dll => C:\WINDOWS\SYSTEM32\KERNEL32.dll (0x0000000000660000)
        msvcrt.dll => C:\WINDOWS\SYSTEM32\msvcrt.dll (0x0000000000660000)
        USER32.dll => C:\WINDOWS\SYSTEM32\USER32.dll (0x00000000010b0000)

comment:8 by Adrian Pop, 6 years ago

@dario: can you check what happens if you change in OMEdit: Tools->Options->FMI->Platforms from Dynamic to Static? Do you still get these linking dependencies?

comment:9 by Adrian Pop, 6 years ago

Ouch, this doesn't work as if you choose Dynamic in the FMI settings you get linker errors because libSimulationRuntimeC.a is compiled to link with the sundials dlls, not the .a libs.
I'll see what I can do for the dynamic case.

comment:10 by Adrian Pop, 6 years ago

These PRs allows static linking of sundials on mingw and should fix the final problem:
https://github.com/OpenModelica/OMCompiler/pull/2894
https://github.com/OpenModelica/OMCompiler-3rdParty/pull/33

in reply to:  8 comment:11 by dariomangoni@…, 6 years ago

Replying to adrpo:

@dario: can you check what happens if you change in OMEdit: Tools->Options->FMI->Platforms from Dynamic to Static? Do you still get these linking dependencies?

I do not know if it is still useful for you or you already solved. In any case here are my dependencies (on Win, as you can see :-) )

Static linking

    KERNEL32.dll
    msvcrt.dll
    USER32.dll

Dynamic linking

    libsundials_idas.dll
    libsundials_kinsol.dll
    libsundials_nvecserial.dll
    ADVAPI32.dll
    imagehlp.dll
    KERNEL32.dll
    msvcrt.dll
    USER32.dll
    WS2_32.dll

comment:12 by Adrian Pop, 6 years ago

Resolution: fixed
Status: acceptedclosed

Ported all the needed commits to maintenance/v1.13 to be in 1.13.2 next week.

Note: See TracTickets for help on using tickets.