[LLVMdev] OpenBSD. (Was: 1.7 Pre-Release Ready for Testing)

Ralph Corderoy ralph at inputplus.co.uk
Mon Apr 17 08:17:31 PDT 2006


Hi again,

I wrote:
> > I would like to test but the I modigied the configure to make
> > unknown = OpenBSD and Unix
> 
> Have you looked at ./config.log.  ./configure creates this as it runs
> as a trace of the path it took through ./configure.  Work backwards
> from the end to find out what it didn't like.

I remember SourceForge's compile farm has an OpenBSD x86 machine so
thought I'd give it a go with a recent CVS check-out.

    $ ./configure
    configure: WARNING: Unknown project (HowToUseJIT) won't be configured automatically
    configure: WARNING: Unknown project (ModuleMaker) won't be configured automatically
    configure: WARNING: Unknown project (SmallExamples) won't be configured automatically
    checking build system type... i386-unknown-openbsd3.8
    checking host system type... i386-unknown-openbsd3.8
    checking target system type... i386-unknown-openbsd3.8
    checking type of operating system we're on... Unknown
    configure: error: Operating system is unknown, configure can't continue

LLVM's configure.ac has a hard-coded list of supported platforms, which
is a shame, and `openbsd' isn't in it.

    [case $build in
      *-*-aix*) 
        llvm_cv_os_type="AIX" 
        llvm_cv_platform_type="Unix" ;;
    ...
      *-*-freebsd*) 
        llvm_cv_os_type="FreeBSD" 
        llvm_cv_platform_type="Unix" ;;

So I forged `freebsd'

    $ ./configure --build=i386-unknown-freebsd3.8

and ./configure completed successfully.  gmake stopped with

    llvm[1]: Compiling Mutex.cpp for Debug build
    Mutex.cpp:55: warning: the address of `int pthread_mutex_init(volatile
       pthread_mutex**, pthread_mutex_attr* const*)', will always be `true'
    Mutex.cpp: In constructor `llvm::sys::Mutex::Mutex(bool)':
    Mutex.cpp:80: error: `pthread_mutexattr_setpshared' undeclared (first use this
       function)
    Mutex.cpp:80: error: (Each undeclared identifier is reported only once for each
       function it appears in.)

    78  #ifndef __FreeBSD__
    79      // Make it a process local mutex
    80      errorcode = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE);
    81  #endif

So I modified both occurrences of __FreeBSD__ to also check for
__OpenBSD__.

The next problem was INT8_MAX, etc., weren't being defined.
include/llvm/Support/DataTypes.h.in is inadequate for this platform.  I
dumped a set of definitions into each file that wanted them as a bodge.
Better autoconf tests could set up INT8_MAX, etc., on all platforms that
don't define them.

After that, the build completed and I could run llvm-{as,dis} and lli.

So with a little work, OpenBSD looks like it could be supported out of
the box.  I've only a low-bandwidth Internet connection at the moment so
it won't be by me but is there a `how to submit a patch for LLVM'
document somewhere?

Cheers,


Ralph.





More information about the llvm-dev mailing list