Hi Michael

On 28.03.2014 23:40, Michael Berry wrote:
Hi Kirill,

Ok, so with help from here (https://github.com/pgregory/libffi-msvc) I
think I've now got a VS project / makefile that builds libffi.lib, but I
can't work out how to get the build script to build the visual studio

The project is in modules\media\src\main\native\vs_project\libffi, and
I've updated FXMedia.sln to include it - this builds ok, but the
makefile then expects the object files in
modules\media\build\native\win\Release\obj\3rd_party\libffi-lite (I
deliberately kept this structure for consistency with the other
projects), and I can't seem to work out where in the script they're
copied across from the visual studio project (I feel like this should be
the easy bit of this step!)
FXMedia.sln is there just for debugging purposes. I wanted to switch to NetBeans C/C++ project for native code. You shouldn't consider the MSVS Solution as the build tool. Main build tools are makefiles. So start with the makefile and then fine tune the FXMedia.sln.

So now what you need is to create a Makefile in rt\modules\media\src\main\native\gstreamer\projects\win\glib-lite\Makefile.libffi by copying if from Makefile.glib for example. Then you should edit this new Makefile.libffi accordingly:
2) You may need to change COMPILER_FLAGS but generally they are ok.
3) Carefully change CFLAGS to what the vanilla build system uses. Here you can watch for output log and take those flags. Remember I told you to try to build with MSVS. That's why it's important - we build it all with MSVC not with gcc in Windows.

Then you need to edit Makefile in the same directory:
4) Add LIBFFI_TARGET with the target library name, and update MODULES variable (add LIBFFI_TARGET to it). See GLIB_TARGET for example. 5) Add dependent target for LIBFFI_TARGET at the bottom of the file. See GLIB_TARGET again.

If you feel you want give it a try. Open cygwin, go to rt ant type:
$ gradle clean
$ gradle -PCOMPILE_MEDIA=true :media:buildWinGlib

This should catch libffi changes.
Once you successfully do it you should be able to build rt\modules\media\build\native\win\{Release|Debug}\libffi.lib or whatever you assign at #4

After this step you can remove all files that don't participate in build and leave only source/headers. Just like glib.

If I copy them there manually it works and builds libffi-lite.lib, but
obviously this isn't ideal - if it's not too much hassle could someone
point me at the relevant place?

Many thanks,


On 27 March 2014 08:58, Kirill Kirichenko <kirill.kiriche...@oracle.com
<mailto:kirill.kiriche...@oracle.com>> wrote:

    On 27.03.2014 03:53, Michael Berry wrote:

        Unfortunately I seem to have become a bit stuck at step one! I'm
        probably missing a few things that are rather obvious, but haven't
        really got much experience at all in this area, so am relying on
        haphazard Googling and a bit of guesswork! It may well be that
        the framework is a bit beyond my skillset for the time I have
        at the moment, but I'll keep pushing on if anyone's willing to
        give me a
        bit of guidance on it.

    Yes. It's not trivial at all. You need to have enough patience to go
    through all the steps.

        Firstly libffi - I've downloaded that, put it in the 3rd_party
        and have run "./configure", "make", then "make install" (all under
        cygwin.) That seems fine; so I've now got "libffi.a" (as well as
        "cygffi-6.dll") in "3rd_party\libffi\i686-pc-__cygwin\.libs".

    The challenge here is first to build libffi with Mircosoft C
    compiler and linker. Here at the first stage you should take libffi
    and put it somewhere separately from javafx. Then try to build it
    with VisualStudio. Once you succeed you should create a makefile in
    the manner of javafx makefiles for Media. As the result of this step
    you'll get a bunch of C/Header files, the makefile. Everything else
    can be deleted. The resulting makefile should be able to build
    libffi.lib - statically linked library.

        I've then grabbed glib 2.40, placed that in the glib folder, and
        attempted the same process - this first complained about a lack of
        libiconv, so I grabbed that and set the appropriate flags to
        point to
        it, and now I get the following:

        /configure: error: in
        /configure: error: The pkg-config script could not be found or
        is too

        old.  Make sure it is in your PATH or set the PKG_CONFIG environment
        variable to the full path to pkg-config./
        /Alternatively, you may set the environment variables
        LIBFFI_CFLAGS and
        LIBFFI_LIBS to avoid the need to call pkg-config./

    For GLib you can disable iconv in configure. This is the next step.
    Let's start with libffi first.

        I'm assuming this is something to do with the fact it can't find
        but I'm unaware of how to tell it that libffi is in the given
        I'm also assuming that calling config / make etc. manually is
        the way to
        go for the time being - I think I'd be at even more of a loss
        trying to
        integrate it into the gradle build script.

    The reason for this to be "such non trivial" is/was the download
    size. We aimed the minimal possible download size. This is probably
    not an issue anymore and we can switch to simpler solutions like you
    originally did - download, unzip, run configure and here we go.


Reply via email to