Neo-Hookean Plugin Failed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • maryrose
    Member
    • May 2019
    • 32

    Neo-Hookean Plugin Failed

    Hi,

    I used this command to compile the plugin on Ubuntu 18.04:

    g++ -fPIC -shared -o NeoHookeanPi.so FENeoHookeanPI.cpp FENeoHookeanPI.h dllmain.cpp -I/home/xx/FEBio-2.9.0/sdk/include -L/home/xx/FEBio-2.9.0/sdk/lib -lfebiomech_gcc64 -lfecore_gcc64

    When I try to run the example co01.feb file I receive the following:

    Success loading plugin NeoHookeanPi.so (version 0.0.0)
    Reading file co01.feb ...FAILED!
    FATAL ERROR: invalid value "neohookeanpi" for attribute "material.type" (line 35)

    Any suggestions for this?

    Many thanks,
    Maryrose
  • mherron
    Developer
    • Aug 2016
    • 95

    #2
    Maryrose,

    I'm not quite sure what's going on here. I copied the command that you used and built the library on my machine, and it's working just fine with the example file. If you'd like, you can send me a copy of the library that you built and I can see if I can figure out what's going on with it. You should just be able to attach it to your reply.

    Thanks,

    Michael Herron

    Comment

    • maryrose
      Member
      • May 2019
      • 32

      #3
      Hi Michael,

      I've attached my library.

      Many thanks,
      Maryrose
      Attached Files

      Comment

      • mherron
        Developer
        • Aug 2016
        • 95

        #4
        Maryrose,

        I downloaded your library, and it works without any problems on my machine. It read and ran the example file that's included in the plugin download. I also ran it on a machine that was running Ubuntu 18.04 just to see if there were any problems, and it worked there as well. I'm not sure what could be causing the problem on your machine.

        I'd recommend uninstalling FEBio, and grabbing the newest version from our website. Install that and see if your problem persists.

        Thanks,

        Michael Herron

        Comment

        • maryrose
          Member
          • May 2019
          • 32

          #5
          Hi Michael,

          It works on the newest version of the software.
          Thanks for your help.

          Maryrose

          Comment

          • kdwyer
            Junior Member
            • Jun 2020
            • 20

            #6
            Hi Maryrose and Michael,
            I am new to using plugins on FEBio and was trying to follow the way you (Maryrose) compiled the FENeoHookean plugin. I apologize if this is more of a basic coding question but how did you choose the paths for -I and -L and what does the last part of your compilation code "-lfebiomech_gcc64 -lfecore_gcc64" mean? I am stumped and would be really appreciative of your help!

            Hope you have a great day,
            Kiera

            Comment

            • mherron
              Developer
              • Aug 2016
              • 95

              #7
              Kiera,

              In order to compile a plugin for FEBio, you'll first need to download our Software Developer Kit (SDK) from our website. You can find it by logging in on this page https://febio.org/febio/febio-downloads/ and then scrolling down to the bottom. The SDK includes header files and libraries that you'll need to reference during your compilation. You'll choose where to install the SDK, and in that folder, there will be a folder called include and one called lib.

              The -I flag (<-- that's an upper-case i), tells the compiler where to look for additional include files, and so you'll want to follow that flag with the path to your sdk/include folder (e.g. -I/path/to/FEBio/sdk/include).

              The -L flag tells the linker where it can find libraries to link into your plugin code. You'll want to follow that with the path to your sdk/lib folder (e.g. -L/path/to/FEBio/sdk/lib).

              Please not that there is not a space between the flag and the path for either of these options.

              Finally, you need to specify which libraries in particular you want to link into your plugin. For a mechanical material plugin, you'll want to link FEMech and FECore. You could do this by passing the entire path to the library to the linker, but that's not necessary. You've told the linker what folder your libraries are going to be in with the -L flag, and so all you need to do now is specify which libraries you want to link with. If you open the sdk/lib folder you'll see that there are two copies of each library, one that ends in _lnx64, and the other that ends in _gcc64. The lnx64 ones were compiled with the intel compiler, and it is very unlikely that you are using that, so you want to specify the ones that end in gcc64.

              This part can be a bit strange if you're not familiar with it. All Linux libraries start with lib and end with either .so (for dynamic libraries) or .a (for static libraries). To tell the linker which libraries to include you prepend the library name with the -l flag (<-- that's a lower-case L) and then follow that with the library name without lib on the front, and without the extension on the end. For example, to tell it to link to libfecore_gcc64.a, you'd remove lib and the extension (.a) and prepend -l to make it: -lfecore_gcc64.

              If you have additional questions, please refer to this post where I explain similar information.

              If you're still struggling to understand any of this please leave a reply here and I will get back to you.

              Thanks,

              Michael Herron

              Comment

              • kdwyer
                Junior Member
                • Jun 2020
                • 20

                #8
                Hi Michael,
                Thank you so very much for your response, you cleared so much of what I was struggling with up.

                One place where I was confused was that I am trying to compile on a Mac and was using the appropriate sdk so I couldn’t find where the _gcc64 files. So using the appropriate names for the Mac sdk FECore and FEbiomech should work? Also I wasn’t able to find any posts about compilation on a Mac but if you have already answered this and point me to that post that would be very much appreciated!

                Again thank you so much for you insight and patience!

                Comment

                • mherron
                  Developer
                  • Aug 2016
                  • 95

                  #9
                  Kierra,

                  Oh, for macOS, I'm pretty sure that we only have one version of each library, and so you shouldn't have to worry about the _lnx64 or _gcc64 suffixes. Your final arguments to the compiler should be -lfebiomech -lfecore

                  Hopefully that helps.

                  Michael Herron

                  Comment

                  • kdwyer
                    Junior Member
                    • Jun 2020
                    • 20

                    #10
                    Hi Michael,
                    One more follow-up to that. While running this in my terminal there is an error that states error: cannot specify -o when generating multiple output files. Do you have any suggestion on what I could be missing?

                    g++ -fPIC -shared -o NeoHookeanPiEx1.so FENeoHookeanPI.cpp FENeoHookeanPI.h dllmain.cpp -I/Users/xx/FEbio2.6.2/sdk/include -L/Users/xx/FEBio2.6.2/sdk/lib -lfebiomech -lfecore

                    Again, I really appreciate your help!

                    Comment

                    • mherron
                      Developer
                      • Aug 2016
                      • 95

                      #11
                      Kiera,

                      I'm not actually sure what's going on here, and googling this error didn't help much. Since you're compiling on macOS, you're not actually using the g++ compiler (even though you're using the g++ command), but rather the clang compiler. It may be that clang is interpreting some of these flags slightly differently than g++ does. I think what's going on is that it thinks that you're specifying multiple output files by listing several files after the -o flag. You should, in theory, be able to just move that -o flag and its argument to the very end of your command to make it look like this instead:

                      Code:
                      g++ -fPIC -shared FENeoHookeanPI.cpp FENeoHookeanPI.h dllmain.cpp -I/Users/xx/FEbio2.6.2/sdk/include -L/Users/xx/FEBio2.6.2/sdk/lib -lfebiomech -lfecore -o NeoHookeanPiEx1.so
                      If that doesn't help, you can simply remove that part of the command, and it should run fine:

                      Code:
                      g++ -fPIC -shared FENeoHookeanPI.cpp FENeoHookeanPI.h dllmain.cpp -I/Users/xx/FEbio2.6.2/sdk/include -L/Users/xx/FEBio2.6.2/sdk/lib -lfebiomech -lfecore
                      In this case, however, the output of your compilation will have the default filename of something like "a.out", "a.dylib", or "a.so". If this works, then you should just be able to rename the file however you'd like after the compilation.

                      Hopefully that helps,

                      Michael Herron

                      Comment

                      • kdwyer
                        Junior Member
                        • Jun 2020
                        • 20

                        #12
                        Hi Michael,
                        Thank you so much! Taking out the command worked. I am trying it on an example now using FEBio 2.9.1 following the User Manual Version 2.9 as well as Developer's Manual. However, my febio terminal is saying the -i and -import commands aren't recognized. When I tried the load command I got this error:


                        febio> load ['NeoHookeanPIEx1.so']
                        Failed loading plugin ['NeoHookeanPIEx1.so']
                        Reason: Failed to load the file.

                        dlopen failed: dlopen(['NeoHookeanPIEx1.so'], 2): image not found


                        I am worried this is an issue on my end. Do you have any advice? Again, I am so appreciative of your help - I am new to this and am trying my best to learn but often am finding myself stuck so I am very grateful for your advice!!

                        Kiera

                        Comment

                        • mherron
                          Developer
                          • Aug 2016
                          • 95

                          #13
                          Kiera,

                          The error message

                          dlopen failed: dlopen(['NeoHookeanPIEx1.so'], 2): image not found

                          means that FEBio was unable to find the plugin that you compiled. When you launch FEBio, you'll need to pass the full path of the plugin to FEBio via the -import flag

                          e.g. febio3 -import /path/to/your/plugin/NeoHookeanPIEx1.so -i /path/to/your/input/file/input.feb

                          If you don't want to have to specify the full path to the plugin each time, you can simply copy the plugin into the directory in which you are running FEBio.

                          Hopefully that helps,

                          Michael Herron

                          Comment

                          Working...
                          X
                          😀
                          😂
                          🥰
                          😘
                          🤢
                          😎
                          😞
                          😡
                          👍
                          👎