On 05/17/2010 09:26 PM, Mark Allan wrote:
> Hi there,
> 
> I'm sending this to clamav-devel rather than clamav-users as I suspect I
> may have missed something during the configure/compile phase rather than
> at runtime.  If I'm wrong, I'll happily repost to the -users list.

Please open a bugreport, this situation should be detected and handled
automatically (for 0.96.2 probably).

> 
> I maintain a distribution of ClamAV for Mac OS X and have to generate a
> build which runs on both PPC and Intel architectures for the three most
> recent major releases of OS X.  I achieve this by using the following
> settings for the configure phase (after applying the appropriate patch
> for 0.96 clamd on PPC):
> 
> bash$ CC="/usr/bin/gcc-4.2" CXX="/usr/bin/g++-4.2" CFLAGS="-O2 -g
> -D_FILE_OFFSET_BITS=64 -mmacosx-version-min=10.4 -isysroot
> /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"  CXXFLAGS="-O2 -g
> -D_FILE_OFFSET_BITS=64 -mmacosx-version-min=10.4 -isysroot
> /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" ./configure
> --disable-dependency-tracking  --enable-llvm --enable-clamdtop
> --with-user=_clamav --with-group=_clamav
> 
> When I run clamscan on the same PPC machine I use for building it,
> everything runs fine, however, when I copy the build over to a machine
> with an Intel processor, I get the following warning about there not
> being any available targets.
> 
>> libclamav JIT: error creating execution engine: No available targets
>> are compatible with this triple, see -version for the available targets
> 
> 
> When I run clambc to see which targets are available, I get the following:
> 
>> bash$ ./clambc --version
>> Clam AntiVirus Bytecode Testing Tool 0.96
>> Low Level Virtual Machine (http://llvm.org/):
>>  llvm version 2.7
>>  Optimized build with assertions.
>>  Built May  9 2010 (01:15:14).
>>  Host: i386-apple-darwin10
>>  Host CPU: penryn
>>
>>  Registered Targets:
>>    ppc32 - PowerPC 32
>>    ppc64 - PowerPC 64
> 
> If I do the configure and compile on the Intel machine, it gives the
> following targets
>> Registered Targets:
>>     x86    - 32-bit X86: Pentium-Pro and above
>>     x86-64 - 64-bit X86: EM64T and AMD64
> 
> Predictably it then gives the same error message as earlier when I copy
> it over to the PowerPC machine.
> 
> Could someone tell me how to register both PPC and x86 targets please?

I completely forgot about this while writing configure.

Upstream LLVM builds by default with *all* backends. For ClamAV that
would be overkill (why compile the PPC backend on an x86 in general),
but for bi-arch builds it needs to build both backends, yes.

For now the easiest workaround is to pass --enable-all-jit-targets  to
configure (it'll build X86, PPC and ARM, although ARM is always disabled
at runtime).

A real fix would be to detect the Apple-style universal build (configure
does this already), and build both ppc and x86 then.
If you open a bugreport I'll try to do that for 0.96.2.

> 
> On a related note, I'm intrigued to know how it managed to register 64
> bit targets when I only specified 32bit architectures in the configure
> script.

The X86 backend knows to generate code for both 32 and 64-bit targets,
ditto for PPC backend. At runtime the correct target is chosen.
In fact if you build all backends you get nice (cross)compilers for all
targets.

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

Reply via email to