[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Condor-users] Compiling Condor 7.6.6 under OSX 10.7 Lion



Hi,

I upgraded to Lion and there seems to be a few problems with compiling
Condor (I'm using the V7_6_6-branch). Here is the experience:

In OSX 10.7 there is a conflict with the Condor's dprintf and the POSIX
dprintf defined in stdio.h:

    [  3%] Building CXX object
src/condor_utils/CMakeFiles/utils.dir/access.cpp.oIn file included from
/Users/krikava/Temp/condor-compile-lion-test/src/condor_utils/classy_counted_ptr.h:91,
                     from
/Users/krikava/Temp/condor-compile-lion-test/src/condor_includes/stream.h:30,
                     from
/Users/krikava/Temp/condor-compile-lion-test/src/condor_includes/condor_io.h:25,
                     from
/Users/krikava/Temp/condor-compile-lion-test/src/condor_utils/access.cpp:22:

/Users/krikava/Temp/condor-compile-lion-test/src/condor_includes/condor_debug.h:97:
error: declaration of C function ‘void dprintf(int, const char*, ...)’
conflicts with
    /usr/include/stdio.h:446: error: previous declaration ‘int
dprintf(int, const char*, ...)’ here
    make[2]: *** [src/condor_utils/CMakeFiles/utils.dir/access.cpp.o]
Error 1
    make[1]: *** [src/condor_utils/CMakeFiles/utils.dir/all] Error 2

In my /usr/include/stdio.h I have:

    /* Additional functionality provided by:
     * POSIX.1-2008
     */

    #if __DARWIN_C_LEVEL >= 200809L
    #ifndef _SSIZE_T
    #define _SSIZE_T
    typedef __darwin_ssize_t        ssize_t;
    #endif

    __BEGIN_DECLS
    int dprintf(int, const char * __restrict, ...)
__DARWIN_LDBL_COMPAT(dprintf) __printflike(2, 3)
__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
    int vdprintf(int, const char * __restrict, va_list)
__DARWIN_LDBL_COMPAT(vdprintf) __printflike(2, 0)
__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
    ssize_t getdelim(char ** __restrict, size_t * __restrict, int, FILE
* __restrict) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
    ssize_t getline(char ** __restrict, size_t * __restrict, FILE *
__restrict) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
    __END_DECLS
    #endif [> __DARWIN_C_LEVEL >= 200809L <]


2. In OSX by default the the default C/C++ compilers are linked to llvm:

    $ ls -l /usr/bin/{gcc,g++,c++}
    lrwxr-xr-x 1 root wheel 12 oct 26 00:45 /usr/bin/c++ -> llvm-g++-4.2
    lrwxr-xr-x 1 root wheel 12 oct 26 00:45 /usr/bin/g++ -> llvm-g++-4.2
    lrwxr-xr-x 1 root wheel 12 oct 26 00:45 /usr/bin/gcc -> llvm-gcc-4.2

and that brings another compile problems:

    [ 50%] Building CXX object
src/condor_io/CMakeFiles/cedar.dir/shared_port_client.cpp.o

/Users/krikava/Temp/condor-compile-lion-test/src/condor_io/shared_port_client.cpp:
In member function ‘bool SharedPortClient::PassSocket(Sock*, const
char*, const char*)’:

/Users/krikava/Temp/condor-compile-lion-test/src/condor_io/shared_port_client.cpp:309:
error: size of array ‘buf’ is not an integral constant-expression
    make[2]: ***
[src/condor_io/CMakeFiles/cedar.dir/shared_port_client.cpp.o] Error 1
    make[1]: *** [src/condor_io/CMakeFiles/cedar.dir/all] Error 2

I tried the clang/clang++ which should be the Apple new C/C++ front-ends
compatible with gcc but the clang does support the variable length
arrays only in POD [1].

    [ 10%] Building CXX object
src/condor_utils/CMakeFiles/utils.dir/condor_config.cpp.o
    clang: warning: argument unused during compilation:
'-fnostack-protector'
    clang: warning: argument unused during compilation: '-rdynamic'

/Users/krikava/Temp/condor-compile-lion-test/src/condor_utils/condor_config.cpp:1141:21:
error: variable length array of non-POD element
          type 'MyString'
                    MyString locations[locations_length];
                                      ^
    1 error generated.
    make[2]: ***
[src/condor_utils/CMakeFiles/utils.dir/condor_config.cpp.o] Error 1
    make[1]: *** [src/condor_utils/CMakeFiles/utils.dir/all] Error 2
    make: *** [all] Error 2

Finally, I installed regular gcc 4.6 (from [2]) and that works just fine.

/cheers
Filip

[1] http://clang.llvm.org/compatibility.html
[2] https://raw.github.com/adamv/homebrew-alt/master/duplicates/gcc.rb