[LLVMdev] Compile dll on Mingw

83 views
Skip to first unread message

yuan zheng

unread,
Sep 1, 2010, 10:57:52 PM9/1/10
to llv...@cs.uiuc.edu
Hello, everyone!
请键入文字或网站地址,或者上传文档

I'm a newbie about llvm. Now, our project need the dynamic link library(dll) about all of llvm library, such as libLLVMCore.dll, libLLVMSupport.dll, and so on. How should I do?


Thanks,
yuanzheng.

NAKAMURA Takumi

unread,
Sep 1, 2010, 11:36:39 PM9/1/10
to yuan zheng, llvmdev
Hello, Yuan

> I'm a newbie about llvm. Now, our project need the dynamic link library(dll)
> about all of llvm library, such as libLLVMCore.dll, libLLVMSupport.dll, and
> so on. How should I do?

You may do, "/path/to/configure --enable-shared=yes",
to build LLVM-2.8svn.dll.
On your project, you have to specify to linker,
"-L/path/to/dll -lLLVM-2.8svn"
(maybe with -Wl,--enable-auto-import)

We provide not individual DLLs but a "BIG" one.
We don't provide import libraries.

I think "DLL" feature is still experimental, and I need more feedback.
When you met any troubles with DLL, ask here or file bugs!

Have fun!


...Takumi
_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

yuan zheng

unread,
Sep 2, 2010, 2:06:17 AM9/2/10
to NAKAMURA Takumi, llv...@cs.uiuc.edu, tsingh...@googlegroups.com
Hi,  NAKAMURA Takumi

Thank you, and thanks for your answer.

1.First of all, I test it on Linux . As you said, I have attempted to do,
 "/path/to/configure --enable-shared=yes" on ubuntu9.10.
After compiling, it generates lots of static libraries(.a) and only three
shared library(.so) , libLTO.so,  LLVMHello.so,  profile_rt.so. Is there
anyone which is the "BIG" one as you said? 

2.And I find it seems that the option of "--enable-shared=yes" is defult
option. Command: $ ./configure --help ,  it will display this message:
--------------------------------------------------------------------------------------------------
Optional Features:
....
--enable-shared[=PKGS]  build shared libraries
                                      [default=yes]
....
--------------------------------------------------------------------------------------------------
I don't know if I consider is right? 

3.By the way, my work environment:
OS : Ubuntu9.10
VirtualBox virtual machion
Virtual OS:  Windows XP
Compile environment:   MinGW and MSYS.
Our need is that: Compile a dynamic module with LLVM on MinGW,
                         So, we need dynamic library of LLVM, that is ".dll" files.
If you compile LLVM on MinGW ever before? If there is some process
about it ?  Thanks.

4.On MinGW, we configure with "--enable-shared=yes" and compile,
but there is no ".dll" file generate. These are some advice on other websites.
For instance,  using the tool of "cmake", when configure, add the macro
-DBUILD_SHARED_LIBS=ON.  With this method, it generates some
".dll.a" files --- libLLVMCore.dll.a  libLLVMSupport.dll.a  libLLVMSystem.dll.a.
Meanwhile, it would also appear lot's of errors.
What library types of "dll.a" file? Static or dynamic?  If this method feasible?

Sorry for those plenty of questions, expect your answer, thanks.


Thanks,
yuanzheng.

2010/9/2 NAKAMURA Takumi <geek4...@gmail.com>

yuan zheng

unread,
Sep 2, 2010, 4:16:25 AM9/2/10
to NAKAMURA Takumi, llvmdev
Hello, NAKAMURA Takumi

As you said, I check out the head from svn trunk.
I build the source code as the following steps:
   $./configure --enable-shared   
  $ make

After  1 hour,  the building procedure is stopped and appear the following error message:

c:/strawberry/c/bin/../lib/gcc/i686-w64-mingw32/4.4.3/../../../../i686-w64-mingw
32/bin/ld.exe: F:/msys/1.0/home/MK/llvm-2.8/llvm/tools/llvm-shlib/Debug+Asserts/
LLVM-2.8svn.a.o: too many sections (63677)
c:/strawberry/c/bin/../lib/gcc/i686-w64-mingw32/4.4.3/../../../../i686-w64-mingw
32/bin/ld.exe: final link failed: File too big
collect2: ld returned 1 exit status
make[1]: *** [/usr/home/MK/llvm-2.8/llvm/tools/llvm-shlib/Debug+Asserts/LLVM-2.8
svn.a.o] Error 1
make[1]: Leaving directory `/home/MK/llvm-2.8/llvm/tools/llvm-shlib'
make: *** [all] Error 1
 
Expect your answer.



Thanks,
yuanzheng.


2010/9/2 NAKAMURA Takumi <geek4...@gmail.com>
Hello, Yuan

NAKAMURA Takumi

unread,
Sep 2, 2010, 5:26:15 AM9/2/10
to yuan zheng, llvmdev
Good evening, Yuan

Excuse me, I gave up Debug build earlier due to my poor hosts.
I will improve able to build Debug ;)

You may build with --enable-optimized=yes
(or, make ENABLE_OPTIMIZED=1)

btw, DLL builder has implemented since Aug.
It might be easier to port DLL stuff to 2.6 :) Do you try?


...Takumi


2010年9月2日 17:16:25 UTC+9 yuan zheng <tsinghu...@gmail.com>:

Michael.Kang

unread,
Sep 2, 2010, 7:06:16 AM9/2/10
to NAKAMURA Takumi, yuan zheng, llvmdev
2010/9/2 NAKAMURA Takumi <geek4...@gmail.com>:

> Good evening, Yuan
>
> Excuse me, I gave up Debug build earlier due to my poor hosts.
> I will improve able to build Debug ;)
>
> You may build with --enable-optimized=yes
> (or, make ENABLE_OPTIMIZED=1)
>
> btw, DLL builder has implemented since Aug.
> It might be easier to port DLL stuff to 2.6 :) Do you try?

I am also interesting on llvm with MingW.
I do not understand why "easier" for build DLL on llvm-2.6. Is there
any one who can build dll library of llvm-2.6 in MingW development
environment?

Thanks
MK

--
www.skyeye.org

Óscar Fuentes

unread,
Sep 2, 2010, 8:53:48 AM9/2/10
to llv...@cs.uiuc.edu
"Michael.Kang" <blackf...@gmail.com> writes:

> I am also interesting on llvm with MingW.
> I do not understand why "easier" for build DLL on llvm-2.6. Is there
> any one who can build dll library of llvm-2.6 in MingW development
> environment?

Maybe this helps:

http://article.gmane.org/gmane.comp.compilers.llvm.devel/10660/

LLVM changed a bit since I wrote that post and some files no longer
exists (the standalone .o files that acted as libraries, for instance)
but the procedure consisting on extracting all object files from the
static libraries and relink them into a single dll should still apply.

yuan zheng

unread,
Sep 2, 2010, 9:07:48 AM9/2/10
to NAKAMURA Takumi, llvmdev
Hi, NAKAMURA Takumi

According to your prompt, I'm very glad that it can generate llvm-2.8svn.dll !

But there is still some compatibility problem between llvm-2.8
and our project. If we use llvm-2.6, there is no problem.

I would study the code of LLVM to find the difference recently,
and I will contact you if I make some progress.

Thanks for your
enthusiastic  and timely answer.
Reply all
Reply to author
Forward
0 new messages