Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ClamAV: devel

Building ClamAV with external/system LLVM

 

 

ClamAV devel RSS feed   Index | Next | Previous | View Threaded


edwin at clamav

Sep 28, 2010, 6:57 AM

Post #1 of 3 (814 views)
Permalink
Building ClamAV with external/system LLVM

Hi,

I just committed some changes to configure and the bytecode2llvm.cpp to
allow building with an external LLVM.
This will allow you to build against LLVM 2.8 when it is released
(right now you can test with LLVM 2.8 rc2).
It won't work if you try linking against LLVM 2.7 for obvious reasons
(upstream's 2.7 doesn't have our patches).

How to use it:
./configure --enable-llvm --with-system-llvm=/path/to/llvm-config

What it does:
Skip building internal LLVM, link against external LLVM *statically*.
So LLVM will stay a build-time only dependency, and upgrading the
LLVM .so won't suddenly break ClamAV

Let me know if this is enough to create packages for your distribution
that links to system's LLVM, or if any other changes are needed.

For example on Debian:
./configure --enable-llvm
--with-system-llvm=/usr/lib/llvm-snapshot/bin/llvm-config
(it should be /usr/bin/llvm-config-2.8 once its packaged)

What I tested:
- building with upstream LLVM 2.8 rc2 on amd64, Release and
Release+Asserts build
- building against llvm2.8rc2 Debian package (updated manually [*])

[*] Since there is no llvm 2.8 rc2 package in Debian, and the -snapshot
is too old, I did this to build an up-to-date llvm 2.8 rc2 package the
same way the snapshot was built:

apt-get source llvm-snapshot
export
LLVMURL=http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_28/rc2/
svn co $LLVMURL llvm2.8rc2
cd llvm2.8rc2
zcat ../llvm-snapshot_20100418-1.diff.gz |patch -p1
rm debian/patches/0013-Fix-mips-FTBFS.patch
dpkg-buildpackage -us -uc -b -j6
sudo dpkg -i ../llvm-snapshot_20100418-1_amd64.deb
# workaround debian bug #578483
sudo ln -s /usr/lib/llvm-snapshot/ /usr/lib/llvm

Best regards,
--Edwin
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net


rbgarga at gmail

Sep 28, 2010, 8:05 AM

Post #2 of 3 (792 views)
Permalink
Re: Building ClamAV with external/system LLVM [In reply to]

2010/9/28 Török Edwin <edwin [at] clamav>:
> Hi,
>
> I just committed some changes to configure and the bytecode2llvm.cpp to
> allow building with an external LLVM.
> This will allow you to build against LLVM 2.8 when it is released
> (right now you can test with LLVM 2.8 rc2).
> It won't work if you try linking against LLVM 2.7 for obvious reasons
> (upstream's 2.7 doesn't have our patches).
>
> How to use it:
> ./configure --enable-llvm --with-system-llvm=/path/to/llvm-config

FreeBSD has llvm 2.8 imported on src tree (just on 9.0-CURRENT),
but llvm-config is not installed into the system, is there a way to test
it without llvm-config installed?

--
Renato Botelho
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net


edwintorok at gmail

Sep 28, 2010, 8:23 AM

Post #3 of 3 (791 views)
Permalink
Re: Building ClamAV with external/system LLVM [In reply to]

On Tue, 28 Sep 2010 12:05:04 -0300
Renato Botelho <rbgarga [at] gmail> wrote:

> 2010/9/28 Török Edwin <edwin [at] clamav>:
> > Hi,
> >
> > I just committed some changes to configure and the
> > bytecode2llvm.cpp to allow building with an external LLVM.
> > This will allow you to build against LLVM 2.8 when it is released
> > (right now you can test with LLVM 2.8 rc2).
> > It won't work if you try linking against LLVM 2.7 for obvious
> > reasons (upstream's 2.7 doesn't have our patches).
> >
> > How to use it:
> > ./configure --enable-llvm --with-system-llvm=/path/to/llvm-config
>
> FreeBSD has llvm 2.8 imported on src tree (just on 9.0-CURRENT),

Good.

> but llvm-config is not installed into the system, is there a way to
> test it without llvm-config installed?

Not really, ClamAV must know how LLVM was built because a +Asserts
build is not ABI compatible with a -Asserts build for example.
Also some other flags, like -frtti or not must probably agree too.

You can try writing a script that fakes llvm-config:
llvm-config --cxxflags
-I/path/to/llvmincludes -DNDEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS -fno-exceptions -fno-rtti -fPIC

llvm-config --ldflags
/path/to/llvm.so

llvm-config --libfiles
<nothing>

llvm-config --libs
<nothing>

Best regards,
--Edwin
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net

ClamAV devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.