Results 1 to 4 of 4

Thread: Building native libraries on MacOS X

  1. #1
    ajmas is offline New Member
    Join Date
    Oct 2005
    Posts
    4
    Rep Power
    9

    Question Building native libraries on MacOS X

    I just downloaded the source (zcs-3.0.M1_21) on my MacOS X 10.4. At this point I have compiled all the java source and attempted to build the C/C++ code in the ZimbraNative directory, but failed with errors.

    Just to document what I did, from the source base directory:

    ant -f Ajax/build.xml
    ant -f ZimbraCharset/build.xml
    ant -f ZimbraServer/build.xml
    ant -f ZimbraWebClient/build.xml
    cd ZimbraBuild
    make
    cd ../ZimbraNative
    make

    The last few lines of the 'make' output of ZimbraBuild follows:
    Code:
    echo "%attr(-, zimbra, zimbra) /opt/zimbra/db" >> \
            /Users/ajmas/Desktop/zcs-3.0.M1_21-src/ZimbraBuild/zimbracore.spec
    echo "%attr(-, zimbra, zimbra) /opt/zimbra/jdk1.5.0_04" >> \
            /Users/ajmas/Desktop/zcs-3.0.M1_21-src/ZimbraBuild/zimbracore.spec
    echo "%attr(-, zimbra, zimbra) /opt/zimbra/lib" >> \
            /Users/ajmas/Desktop/zcs-3.0.M1_21-src/ZimbraBuild/zimbracore.spec
    echo "%attr(-, zimbra, zimbra) /opt/zimbra/zimbramon" >> \
            /Users/ajmas/Desktop/zcs-3.0.M1_21-src/ZimbraBuild/zimbracore.spec
    (cd /Users/ajmas/Desktop/zcs-3.0.M1_21-src/ZimbraBuild/corebuild;\
            rpmbuild  --target i386 --quiet --define '_rpmdir /Users/ajmas/Desktop/zcs-3.0.M1_21-src/ZimbraBuild' \
            --buildroot=/Users/ajmas/Desktop/zcs-3.0.M1_21-src/ZimbraBuild/corebuild -bb /Users/ajmas/Desktop/zcs-3.0.M1_21-src/ZimbraBuild/zimbracore.spec )
    /bin/sh: line 1: rpmbuild: command not found
    make: *** [core] Error 127
    The 'make' output of ZimbraNative follows:
    Code:
    mkdir -p build/classes
    javac -source 1.4 -target 1.4 -d build/classes src/java/com/zimbra/znative/IO.java src/java/com/zimbra/znative/tests/HardLinkTest.java src/java/com/zimbra/znative/tests/LinkCountTest.java
    rm -f build/zimbra-native.jar
    jar c0vf build/zimbra-native.jar -C build/classes com
    added manifest
    adding: com/(in = 0) (out= 0)(stored 0%)
    adding: com/zimbra/(in = 0) (out= 0)(stored 0%)
    adding: com/zimbra/znative/(in = 0) (out= 0)(stored 0%)
    adding: com/zimbra/znative/IO.class(in = 1300) (out= 1300)(stored 0%)
    adding: com/zimbra/znative/tests/(in = 0) (out= 0)(stored 0%)
    adding: com/zimbra/znative/tests/HardLinkTest.class(in = 1779) (out= 1779)(stored 0%)
    adding: com/zimbra/znative/tests/LinkCountTest.class(in = 952) (out= 952)(stored 0%)
    mkdir -p build
    rm -f build/IO.h
    javah -o build/IO.h -classpath build/classes com.zimbra.znative.IO
    gcc -Ibuild -Wall -Wmissing-prototypes -c -o build/IO.o src/native/IO.c
    src/native/IO.c:26:17: error: jni.h: No such file or directory
    In file included from src/native/IO.c:35:
    build/IO.h:16: error: syntax error before "void"
    build/IO.h:17: error: parse error before '*' token
    build/IO.h:17: warning: type defaults to 'int' in declaration of 'Java_com_zimbra_znative_IO_link0'
    build/IO.h:17: warning: data definition has no type or storage class
    build/IO.h:24: error: parse error before "jint"
    build/IO.h:25: error: parse error before '*' token
    build/IO.h:25: warning: type defaults to 'int' in declaration of 'Java_com_zimbra_znative_IO_linkCount0'
    build/IO.h:25: warning: data definition has no type or storage class
    src/native/IO.c:38: error: parse error before '*' token
    src/native/IO.c: In function 'ThrowNPE':
    src/native/IO.c:40: error: 'jclass' undeclared (first use in this function)
    src/native/IO.c:40: error: (Each undeclared identifier is reported only once
    src/native/IO.c:40: error: for each function it appears in.)
    src/native/IO.c:40: error: parse error before "cls"
    src/native/IO.c:42: error: 'cls' undeclared (first use in this function)
    src/native/IO.c:43: error: 'env' undeclared (first use in this function)
    src/native/IO.c:43: error: 'msg' undeclared (first use in this function)
    src/native/IO.c: At top level:
    src/native/IO.c:47: error: parse error before '*' token
    src/native/IO.c: In function 'ThrowIAE':
    src/native/IO.c:49: error: 'jclass' undeclared (first use in this function)
    src/native/IO.c:49: error: parse error before "cls"
    src/native/IO.c:51: error: 'cls' undeclared (first use in this function)
    src/native/IO.c:52: error: 'env' undeclared (first use in this function)
    src/native/IO.c:52: error: 'msg' undeclared (first use in this function)
    src/native/IO.c: At top level:
    src/native/IO.c:56: error: parse error before '*' token
    src/native/IO.c: In function 'ThrowIOE':
    src/native/IO.c:58: error: 'jclass' undeclared (first use in this function)
    src/native/IO.c:58: error: parse error before "cls"
    src/native/IO.c:59: error: 'cls' undeclared (first use in this function)
    src/native/IO.c:60: error: 'env' undeclared (first use in this function)
    src/native/IO.c:60: error: 'msg' undeclared (first use in this function)
    src/native/IO.c: At top level:
    src/native/IO.c:63: error: syntax error before "void"
    src/native/IO.c:64: error: parse error before '*' token
    src/native/IO.c:69: warning: return type defaults to 'int'
    src/native/IO.c:69: warning: no previous prototype for 'Java_com_zimbra_znative_IO_link0'
    src/native/IO.c: In function 'Java_com_zimbra_znative_IO_link0':
    src/native/IO.c:75: error: 'joldpath' undeclared (first use in this function)
    src/native/IO.c:76: error: 'env' undeclared (first use in this function)
    src/native/IO.c:77: warning: 'return' with no value, in function returning non-void
    src/native/IO.c:80: error: 'jnewpath' undeclared (first use in this function)
    src/native/IO.c:82: warning: 'return' with no value, in function returning non-void
    src/native/IO.c:88: warning: 'return' with no value, in function returning non-void
    src/native/IO.c:94: warning: 'return' with no value, in function returning non-void
    src/native/IO.c:106: warning: 'return' with no value, in function returning non-void
    src/native/IO.c:109: warning: implicit declaration of function 'snprintf'
    src/native/IO.c:109: warning: incompatible implicit declaration of built-in function 'snprintf'
    src/native/IO.c:113: warning: control reaches end of non-void function
    src/native/IO.c: At top level:
    src/native/IO.c:115: error: parse error before "jint"
    src/native/IO.c:116: error: parse error before '*' token
    src/native/IO.c:117: warning: return type defaults to 'int'
    src/native/IO.c:117: warning: no previous prototype for 'Java_com_zimbra_znative_IO_linkCount0'
    src/native/IO.c: In function 'Java_com_zimbra_znative_IO_linkCount0':
    src/native/IO.c:122: error: 'jpath' undeclared (first use in this function)
    src/native/IO.c:123: error: 'env' undeclared (first use in this function)
    src/native/IO.c:138: error: 'jint' undeclared (first use in this function)
    src/native/IO.c:138: error: parse error before "sb"
    src/native/IO.c:141: warning: incompatible implicit declaration of built-in function 'snprintf'
    src/native/IO.c:145: warning: control reaches end of non-void function
    make: *** [build/IO.o] Error 1
    'gcc -v' gives:
    Code:
    Reading specs from /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/specs
    Configured with: /private/var/tmp/gcc/gcc-4061.obj~8/src/configure --disable-checking --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^+.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/gcc/darwin/4.0/c++ --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8
    Thread model: posix
    gcc version 4.0.0 20041026 (Apple Computer, Inc. build 4061)

  2. #2
    ajmas is offline New Member
    Join Date
    Oct 2005
    Posts
    4
    Rep Power
    9

    Default

    I modified the make file so that the gcc command for '$(BUILD)/IO.o' now reads:
    Code:
    gcc -I$(BUILD) -I$(JAVA_HOME)/include -Wall -Wmissing-prototypes -c -o $@ $<
    This removes all of the dependency related errors, leaves a few warnings and then fails since gcc on Darwin/MacOS X does not suport the '-shared' option. I think think it should be '-dynamiclib', so I changed that in the make file and that resolves the build issues there.

    As to ZimbraBuild, the blocking point at the moment seems to be RPM creation. Maybe we need to create a generic version that will create a tarball distribution. That should allow most platforms to have a working solution, even if it is not the ideal one.

  3. #3
    KevinH's Avatar
    KevinH is offline Expert Member
    Join Date
    Aug 2005
    Location
    San Mateo, CA
    Posts
    4,789
    Rep Power
    18

    Default

    As of now the source has been setup to compile on Red Hat and Fedora. We are working on more ports so you can build an installable pkg for other OS's. MacOS X is on that list.

  4. #4
    riegersteve is offline Senior Member
    Join Date
    Sep 2005
    Location
    Los Angeles
    Posts
    51
    Rep Power
    9

    Default

    i actually just started getting it up and running on solaris 10 sparc. give me a week and i will have some more details.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Zimbra fails after working for 2 weeks
    By Linsys in forum Administrators
    Replies: 10
    Last Post: 10-07-2008, 12:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •