[Mingw-w64-public] Building LLVM with mingw-w64

2014-03-17 Thread Etienne Sandré-Chardonnal
Dear all,

I'm trying to build LLVM with 64-bit mingw.
I use a MinGW build from ruben :
[...]/gcc-4.8-release/x86_64-w64-mingw32-gcc-4.8.0-win64_rubenvb.7z


LLVM is configured with:
./configure --disable-threads --prefix=/mingw/x86_64-w64-mingw32
--enable-targets=x86,x86_64 --host=x86_64-w64-mingw32

LLVM 3.4 compiles without issue, but I cannot manage to link with the libs.
The errors look like:
DynamicLibrary.cpp:-1: error: undefined reference to
`__imp_EnumerateLoadedModules64'
I have searched and found that a bug was filed short after the release :
http://comments.gmane.org/gmane.comp.compilers.llvm.bugs/27463
So I tried with LLVM 3.3


LLVM 3.3 does not compile and issues errors such as:
[...]/llvm-3.3/Release+Asserts/lib/libLLVMMCJIT.a(SectionMemoryManager.o):SectionMemoryManager.cpp:(.text+0x3b):
undefined reference to `__register_frame'
[...]/llvm-3.3/Release+Asserts/lib/libLLVMJIT.a(JIT.o
):JIT.cpp:(.text+0x65df): undefined reference to `__register_frame'
[...]/llvm-3.3/Release+Asserts/lib/libLLVMJIT.a(JIT.o
):JIT.cpp:(.text+0x65f0): undefined reference to `__deregister_frame'

Did someone manage to build LLVM with mingw?

Thanks in advance,

Etienne
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Building LLVM with mingw-w64

2014-03-17 Thread Alexpux

17 марта 2014 г., в 14:19, Etienne Sandré-Chardonnal  
написал(а):

> Dear all,
> 
> I'm trying to build LLVM with 64-bit mingw.
> I use a MinGW build from ruben : 
> [...]/gcc-4.8-release/x86_64-w64-mingw32-gcc-4.8.0-win64_rubenvb.7z
> 
> 
> LLVM is configured with:
> ./configure --disable-threads --prefix=/mingw/x86_64-w64-mingw32 
> --enable-targets=x86,x86_64 --host=x86_64-w64-mingw32 
> 
> LLVM 3.4 compiles without issue, but I cannot manage to link with the libs.
> The errors look like:
> DynamicLibrary.cpp:-1: error: undefined reference to 
> `__imp_EnumerateLoadedModules64'
> I have searched and found that a bug was filed short after the release : 
> http://comments.gmane.org/gmane.comp.compilers.llvm.bugs/27463
> So I tried with LLVM 3.3
> 
> 
> LLVM 3.3 does not compile and issues errors such as:
> [...]/llvm-3.3/Release+Asserts/lib/libLLVMMCJIT.a(SectionMemoryManager.o):SectionMemoryManager.cpp:(.text+0x3b):
>  undefined reference to `__register_frame'
> [...]/llvm-3.3/Release+Asserts/lib/libLLVMJIT.a(JIT.o
> ):JIT.cpp:(.text+0x65df): undefined reference to `__register_frame'
> [...]/llvm-3.3/Release+Asserts/lib/libLLVMJIT.a(JIT.o
> ):JIT.cpp:(.text+0x65f0): undefined reference to `__deregister_frame'
> 
> Did someone manage to build LLVM with mingw? 
> 
You can try to get precompiled LLVM from MSYS2/pacman repository via MSYS2.
Or download it here:
https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/
But you also need download all necessary dependencies by hand in this case.

How we build it is here:
https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-clang

Regards,
Alexey.

> Thanks in advance,
> 
> Etienne
> 
> 
> 
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Building LLVM with mingw-w64

2014-03-17 Thread Etienne Sandré-Chardonnal
Dear Alexey,

Thanks for the information.

Do you build this using mingw-clang or mingw-gcc?
I believe I will have to build it myself as things such as exception
handling or thread support make linking rarely work between mingw versions.

Regards,

Etienne





You can try to get precompiled LLVM from MSYS2/pacman repository via MSYS2.
> Or download it here:
> https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/
> But you also need download all necessary dependencies by hand in this case.
>
> How we build it is here:
> https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-clang
>
> Regards,
> Alexey.
>
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Building LLVM with mingw-w64

2014-03-17 Thread Alexpux

17 марта 2014 г., в 15:49, Etienne Sandré-Chardonnal  
написал(а):

> Dear Alexey,
> 
> Thanks for the information.
> 
> Do you build this using mingw-clang or mingw-gcc?

With mingw-gcc.

> I believe I will have to build it myself as things such as exception handling 
> or thread support make linking rarely work between mingw versions.
> 
> Regards,
> 
> Etienne
> 
> 
> 
> 
> 
> You can try to get precompiled LLVM from MSYS2/pacman repository via MSYS2.
> Or download it here:
> https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/
> But you also need download all necessary dependencies by hand in this case.
> 
> How we build it is here:
> https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-clang
> 
> Regards,
> Alexey.
> 
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Building LLVM with mingw-w64

2014-03-17 Thread Ruben Van Boxem
2014-03-17 11:19 GMT+01:00 Etienne Sandré-Chardonnal :

> Dear all,
>
> I'm trying to build LLVM with 64-bit mingw.
> I use a MinGW build from ruben :
> [...]/gcc-4.8-release/x86_64-w64-mingw32-gcc-4.8.0-win64_rubenvb.7z
>
>
> LLVM is configured with:
> ./configure --disable-threads --prefix=/mingw/x86_64-w64-mingw32
> --enable-targets=x86,x86_64 --host=x86_64-w64-mingw32
>
> LLVM 3.4 compiles without issue, but I cannot manage to link with the libs.
> The errors look like:
> DynamicLibrary.cpp:-1: error: undefined reference to
> `__imp_EnumerateLoadedModules64'
> I have searched and found that a bug was filed short after the release :
> http://comments.gmane.org/gmane.comp.compilers.llvm.bugs/27463
> So I tried with LLVM 3.3
>
>
> LLVM 3.3 does not compile and issues errors such as:
> [...]/llvm-3.3/Release+Asserts/lib/libLLVMMCJIT.a(SectionMemoryManager.o):SectionMemoryManager.cpp:(.text+0x3b):
> undefined reference to `__register_frame'
> [...]/llvm-3.3/Release+Asserts/lib/libLLVMJIT.a(JIT.o
> ):JIT.cpp:(.text+0x65df): undefined reference to `__register_frame'
> [...]/llvm-3.3/Release+Asserts/lib/libLLVMJIT.a(JIT.o
> ):JIT.cpp:(.text+0x65f0): undefined reference to `__deregister_frame'
>

LLVM still assumes SJLJ or DW2 exception handling, and does not bother to
check this at configure time. Well, the reason is that someone hasn't
written a simple test for that and implemented the proper #ifdef stuff.

So you can just use this patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120924/151822.html

Problem with the patch is that it also affects non-seh 64-bit GCC's, so
only use it when you are building with GCC 4.8+ with seh.

Cheers,

Ruben

>
> Did someone manage to build LLVM with mingw?
>
> Thanks in advance,
>
> Etienne
>
>
>
>
>
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Building LLVM with mingw-w64

2014-03-17 Thread Etienne Sandré-Chardonnal
Dear Alexey,

I have problems compiling LLVM 3.3, but LLVM 3.4 compiles fine.
The issue with 3.4 occurs when linking my project compiled llvm libs.

I tried with the pre build libs from your link, and I get the exact same
error from the linker such as:

error: undefined reference to `__imp_EnumerateLoadedModules64'
error: undefined reference to `__imp_SymSetOptions'
etc...

Is there specific options to pass to gcc when linking with these binaries?

Thanks,

Etienne





You can try to get precompiled LLVM from MSYS2/pacman repository via MSYS2.
Or download it here:
https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/
But you also need download all necessary dependencies by hand in this case.

How we build it is here:
https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-clang

Regards,
Alexey.


2014-03-17 12:49 GMT+01:00 Etienne Sandré-Chardonnal :

> Dear Alexey,
>
> Thanks for the information.
>
> Do you build this using mingw-clang or mingw-gcc?
> I believe I will have to build it myself as things such as exception
> handling or thread support make linking rarely work between mingw versions.
>
> Regards,
>
> Etienne
>
>
>
>
>
> You can try to get precompiled LLVM from MSYS2/pacman repository via MSYS2.
>> Or download it here:
>> https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/
>> But you also need download all necessary dependencies by hand in this
>> case.
>>
>> How we build it is here:
>> https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-clang
>>
>> Regards,
>> Alexey.
>>
>
>
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Building LLVM with mingw-w64

2014-03-17 Thread Ray Donnelly
Here's a WIP patch for 'better' exception handling, but I've not had
time to finish it (nor will I for a good while - hoping the LLVM/Clang
developers fix it all properly first). It's mostly based on other
peoples' work too, as-per the commit message .. you may find more up
to date stuff if you follow the links.

https://github.com/diorcety/crosstool-ng/blob/master/patches/llvm/head/160-Add-Win64-exception-handling.patch

The stage I got to was that it was emitting a weird mix of dw2 and SEH.

Caveat emptor.

On Mon, Mar 17, 2014 at 12:40 PM, Etienne Sandré-Chardonnal
 wrote:
> Dear Alexey,
>
> I have problems compiling LLVM 3.3, but LLVM 3.4 compiles fine.
> The issue with 3.4 occurs when linking my project compiled llvm libs.
>
> I tried with the pre build libs from your link, and I get the exact same
> error from the linker such as:
>
>
> error: undefined reference to `__imp_EnumerateLoadedModules64'
> error: undefined reference to `__imp_SymSetOptions'
> etc...
>
> Is there specific options to pass to gcc when linking with these binaries?
>
> Thanks,
>
>
> Etienne
>
>
>
>
>
> You can try to get precompiled LLVM from MSYS2/pacman repository via MSYS2.
> Or download it here:
> https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/
> But you also need download all necessary dependencies by hand in this case.
>
> How we build it is here:
> https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-clang
>
> Regards,
> Alexey.
>
>
> 2014-03-17 12:49 GMT+01:00 Etienne Sandré-Chardonnal
> :
>
>> Dear Alexey,
>>
>> Thanks for the information.
>>
>> Do you build this using mingw-clang or mingw-gcc?
>> I believe I will have to build it myself as things such as exception
>> handling or thread support make linking rarely work between mingw versions.
>>
>> Regards,
>>
>> Etienne
>>
>>
>>
>>
>>
>>> You can try to get precompiled LLVM from MSYS2/pacman repository via
>>> MSYS2.
>>> Or download it here:
>>> https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/
>>> But you also need download all necessary dependencies by hand in this
>>> case.
>>>
>>> How we build it is here:
>>> https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-clang
>>>
>>> Regards,
>>> Alexey.
>>
>>
>
>
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Building LLVM with mingw-w64

2014-03-17 Thread Ruben Van Boxem
2014-03-17 13:45 GMT+01:00 Ray Donnelly :

> Here's a WIP patch for 'better' exception handling, but I've not had
> time to finish it (nor will I for a good while - hoping the LLVM/Clang
> developers fix it all properly first). It's mostly based on other
> peoples' work too, as-per the commit message .. you may find more up
> to date stuff if you follow the links.
>
>
> https://github.com/diorcety/crosstool-ng/blob/master/patches/llvm/head/160-Add-Win64-exception-handling.patch
>
> The stage I got to was that it was emitting a weird mix of dw2 and SEH.
>
> Caveat emptor.
>

I attempted a similar thing based also on redstar's work:
Clang part: http://llvm.org/bugs/show_bug.cgi?id=18654
LLVM part: http://www.redstar.de/ldc/win64eh_all_20140201.diff (latest
version should be linked on http://redstar.de/)

AFAICT, the code is emitted, but is faulty.

Also, feel free to try my Driver code as well, which removes all the silly
InitHeaderSearch junk from the MinGW-w64 code path:
http://llvm.org/bugs/show_bug.cgi?id=18546

This needs tests so it can be submitted. But I have not found the time nor
interest to write these, although they should be simple enough.

Cheers,

Ruben


>
> On Mon, Mar 17, 2014 at 12:40 PM, Etienne Sandré-Chardonnal
>  wrote:
> > Dear Alexey,
> >
> > I have problems compiling LLVM 3.3, but LLVM 3.4 compiles fine.
> > The issue with 3.4 occurs when linking my project compiled llvm libs.
> >
> > I tried with the pre build libs from your link, and I get the exact same
> > error from the linker such as:
> >
> >
> > error: undefined reference to `__imp_EnumerateLoadedModules64'
> > error: undefined reference to `__imp_SymSetOptions'
> > etc...
> >
> > Is there specific options to pass to gcc when linking with these
> binaries?
> >
> > Thanks,
> >
> >
> > Etienne
> >
> >
> >
> >
> >
> > You can try to get precompiled LLVM from MSYS2/pacman repository via
> MSYS2.
> > Or download it here:
> > https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/
> > But you also need download all necessary dependencies by hand in this
> case.
> >
> > How we build it is here:
> > https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-clang
> >
> > Regards,
> > Alexey.
> >
> >
> > 2014-03-17 12:49 GMT+01:00 Etienne Sandré-Chardonnal
> > :
> >
> >> Dear Alexey,
> >>
> >> Thanks for the information.
> >>
> >> Do you build this using mingw-clang or mingw-gcc?
> >> I believe I will have to build it myself as things such as exception
> >> handling or thread support make linking rarely work between mingw
> versions.
> >>
> >> Regards,
> >>
> >> Etienne
> >>
> >>
> >>
> >>
> >>
> >>> You can try to get precompiled LLVM from MSYS2/pacman repository via
> >>> MSYS2.
> >>> Or download it here:
> >>> https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/
> >>> But you also need download all necessary dependencies by hand in this
> >>> case.
> >>>
> >>> How we build it is here:
> >>> https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-clang
> >>>
> >>> Regards,
> >>> Alexey.
> >>
> >>
> >
> >
> >
> --
> > Learn Graph Databases - Download FREE O'Reilly Book
> > "Graph Databases" is the definitive new guide to graph databases and
> their
> > applications. Written by three acclaimed leaders in the field,
> > this first edition is now available. Download your free book today!
> > http://p.sf.net/sfu/13534_NeoTech
> > ___
> > Mingw-w64-public mailing list
> > Mingw-w64-public@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
> >
>
>
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public