compile fail as regular user but ok as root on linux

Discussion in 'Java' started by powah, Apr 13, 2009.

  1. powah

    powah Guest

    I compile my java programs with tomcat & axis successfully as root on
    linux.
    I setup myself with sudo privilege but compiling them as regular (non-
    root) user fail.

    $ set |grep HOME
    ANT_HOME=/usr/local/ant/apache-ant-1.7.1
    AXIS2_HOME=/opt/axis2-1.1.1
    CATALINA_HOME=/usr/local/apache-tomcat-6.0.13
    HOME=/home/powah
    JAVA_HOME=/home/powah/jdk1.6.0_06


    # visudo
    ....
    powah ALL= /usr/src/redhat/, /bin/touch, /bin/mv, /bin/rm, /usr/bin/
    perl makeMY.pl

    $ sudo perl makeMY.pl

    ....
    /usr/tomcat/bin/tomcat-native-1.1.8-src/jni/native/include -I/home/
    powah/jdk1.6.0_06/include -I/home/powah/jdk1.6.0_06/include/linux -I/
    usr/local/apr/include/apr-1 -o os/unix/system.lo -c os/unix/system.c
    && touch os/unix/system.lo
    /bin/sh /usr/local/apr/build-1/libtool --silent --mode=link gcc -g -
    O2 -pthread -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -
    D_LARGEFILE64_SOURCE -g -O2 -DHAVE_OPENSSL -I/usr/tomcat/bin/
    tomcat-native-1.1.8-src/jni/native/include -I/home/powah/jdk1.6.0_06/
    include -I/home/powah/jdk1.6.0_06/include/linux -I/usr/local/apr/
    include/apr-1 -version-info 1:8:1 -o libtcnative-1.la -rpath /usr/
    local/apr/lib src/multicast.lo src/os.lo src/info.lo src/address.lo
    src/poll.lo src/pool.lo src/misc.lo src/error.lo src/shm.lo src/
    proc.lo src/mmap.lo src/network.lo src/sslcontext.lo src/dir.lo src/
    user.lo src/sslnetwork.lo src/sslutils.lo src/thread.lo src/ssl.lo src/
    file.lo src/sslinfo.lo src/stdlib.lo src/lock.lo src/jnilib.lo os/unix/
    uxpipe.lo os/unix/system.lo /usr/local/apr/lib/libapr-1.la -luuid -
    lrt -lcrypt -lpthread -ldl -lssl -lcrypto
    make[1]: Leaving directory `/usr/tomcat/bin/tomcat-native-1.1.8-src/
    jni/native'
    make[1]: Entering directory `/usr/tomcat/bin/tomcat-native-1.1.8-src/
    jni/native'
    make[1]: Nothing to be done for `local-all'.
    make[1]: Leaving directory `/usr/tomcat/bin/tomcat-native-1.1.8-src/
    jni/native'
    /usr/local/apr/build-1/mkdir.sh /usr/local/apr/include/apr-1 /usr/
    local/apr/lib/pkgconfig \
    /usr/local/apr/lib /usr/local/apr/bin
    /usr/bin/install -c -m 644 tcnative.pc /usr/local/apr/lib/pkgconfig/
    tcnative-1.pc
    list=''; for i in $list; do \
    ( cd $i ; make DESTDIR= install ); \
    done
    /bin/sh /usr/local/apr/build-1/libtool --mode=install /usr/bin/install
    -c -m 755 libtcnative-1.la /usr/local/apr/lib
    /usr/bin/install -c -m 755 .libs/libtcnative-1.so.0.1.8 /usr/local/apr/
    lib/libtcnative-1.so.0.1.8
    (cd /usr/local/apr/lib && { ln -s -f libtcnative-1.so.0.1.8
    libtcnative-1.so.0 || { rm -f libtcnative-1.so.0 && ln -s
    libtcnative-1.so.0.1.8 libtcnative-1.so.0; }; })
    (cd /usr/local/apr/lib && { ln -s -f libtcnative-1.so.0.1.8
    libtcnative-1.so || { rm -f libtcnative-1.so && ln -s libtcnative-1.so.
    0.1.8 libtcnative-1.so; }; })
    /usr/bin/install -c -m 755 .libs/libtcnative-1.lai /usr/local/apr/lib/
    libtcnative-1.la
    /usr/bin/install -c -m 755 .libs/libtcnative-1.a /usr/local/apr/lib/
    libtcnative-1.a
    ranlib /usr/local/apr/lib/libtcnative-1.a
    chmod 644 /usr/local/apr/lib/libtcnative-1.a
    PATH="$PATH:/sbin" ldconfig -n /usr/local/apr/lib
    ----------------------------------------------------------------------
    Libraries have been installed in:
    /usr/local/apr/lib

    If you ever happen to want to link against installed libraries
    in a given directory, LIBDIR, you must either use libtool, and
    specify the full pathname of the library, or use the `-LLIBDIR'
    flag during linking and do at least one of the following:
    - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
    during execution
    - add LIBDIR to the `LD_RUN_PATH' environment variable
    during linking
    - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
    - have your system administrator add LIBDIR to `/etc/ld.so.conf'

    See any operating system documentation about shared libraries for
    more information, such as the ld(1) and ld.so(8) manual pages.
    ----------------------------------------------------------------------
    Buildfile: build.xml

    init:

    pre.compile.test:

    BUILD FAILED
    /home/powah/myproj_1.1rose/myproj_src/myCrypto/build.xml:30: /home/
    powah/myproj_1.1rose/myproj_src/myCrypto/${env.AXIS2_HOME} not found.

    Total time: 0 seconds
    Building the MyCryptoService failed! Return Code: 256 at makeMY.pl
    line 362.



    makeMY.pl line 362 is:
    system("ant") == 0
    or die "Building the XmCryptoService failed! Return Code: $?";

    build.xml is:
    <project basedir="." default="jar.server">
    <!--Auto generated ant build file-->
    <property environment="env"/>
    <property name="axis2.home" value="${env.AXIS2_HOME}"/>
    <property name="project.base.dir" value="."/>
    <property name="maven.class.path" value=""/>
    <property name="name" value="XmCryptoService"/>
    <property name="src" value="${project.base.dir}/src"/>
    <property name="test" value="${project.base.dir}/test"/>
    <property name="build" value="${project.base.dir}/build"/>
    <property name="classes" value="${build}/classes"/>
    <property name="lib" value="${build}/lib"/>
    <property name="resources" value="${project.base.dir}/resources"/>
    <property name="jars.ok" value=""/>
    <path id="axis2.class.path">
    <pathelement path="${java.class.path}:${project.base.dir}/lib/
    MycompJCASP.jar:${project.base.dir}/lib/MycompJCESP.jar:$
    {project.base.dir}/lib/xmlsec-1.4.1.jar:${project.base.dir}/lib/
    log4j-1.2.14.jar:${project.base.dir}/lib/bcprov-jdk16-139.jar"/>
    <pathelement path="${maven.class.path}"/>
    <fileset dir="${axis2.home}">
    <include name="lib/*.jar"/>
    </fileset>
    </path>
    <target name="init">
    <mkdir dir="${build}"/>
    <mkdir dir="${classes}"/>
    <mkdir dir="${lib}"/>
    <mkdir dir="${test}"/>
    </target>
    <target name="pre.compile.test" depends="init">
    <!--Test the classpath for the availability of necesary classes-->
    <available classname="javax.xml.stream.XMLStreamReader"
    property="stax.available" classpathref="axis2.class.path"/>
    <available classname="org.apache.axis2.engine.AxisEngine"
    property="axis2.available" classpathref="axis2.class.path"/>
    ....


    $ uname -a
    Linux linuxpc 2.6.22.14-72.fc6 #1 SMP Wed Nov 21 15:12:59 EST 2007
    i686 i686 i386 GNU/Linux
     
    powah, Apr 13, 2009
    #1
    1. Advertising

  2. On Mon, 13 Apr 2009 08:36:25 -0700, powah wrote:

    > I compile my java programs with tomcat & axis successfully as root on
    > linux.
    > I setup myself with sudo privilege but compiling them as regular (non-
    > root) user fail.
    >

    Then your setup is borked by you or somebody else. A fresh Linux install
    doesn't have those problems and there's no reason why carefully
    installing Sun Java would cause them.

    The only part of development you should need to do as root is installing
    jar libs for general use - and that should be doable with sudo.

    Have you used scripts in /etc/profile.d to define your login environment,
    PATH variable, etc? Are they being exported? Did you test the steps as
    you set them up and fix the bits that were wrong?


    --
    martin@ | Martin Gregorie
    gregorie. | Essex, UK
    org |
     
    Martin Gregorie, Apr 13, 2009
    #2
    1. Advertising

  3. powah

    powah Guest

    On Apr 13, 5:04 pm, Martin Gregorie
    <> wrote:
    > On Mon, 13 Apr 2009 08:36:25 -0700, powah wrote:
    > > I compile my java programs with tomcat & axis successfully as root on
    > > linux.
    > > I setup myself with sudo privilege but compiling them as regular (non-
    > > root) user fail.

    >
    > Then your setup is borked by you or somebody else. A fresh Linux install
    > doesn't have those problems and there's no reason why carefully
    > installing Sun Java would cause them.
    >
    > The only part of development you should need to do as root is installing
    > jar libs for general use - and that should be doable with sudo.
    >
    > Have you used scripts in /etc/profile.d to define your login environment,
    > PATH variable, etc? Are they being exported? Did you test the steps as
    > you set them up and fix the bits that were wrong?
    >
    > --
    > martin@   | Martin Gregorie
    > gregorie. | Essex, UK
    > org       |


    I define the environment variables in the /etc/profile file as
    follows:
    export JAVA_HOME=/home/powah/jdk1.6.0_06
    export AXIS2_HOME=/opt/axis2-1.1.1
    export ANT_HOME=/usr/local/ant/apache-ant-1.7.1
    export CATALINA_HOME=/usr/local/apache-tomcat-6.0.13
     
    powah, Apr 14, 2009
    #3
  4. In article
    <>,
    powah <> wrote:

    > On Apr 13, 5:04 pm, Martin Gregorie
    > <> wrote:
    > > On Mon, 13 Apr 2009 08:36:25 -0700, powah wrote:
    > > > I compile my java programs with tomcat & axis successfully as
    > > > root on linux. I setup myself with sudo privilege but compiling
    > > > them as regular (non- root) user fail.

    > >
    > > Then your setup is borked by you or somebody else. A fresh Linux
    > > install doesn't have those problems and there's no reason why
    > > carefully installing Sun Java would cause them.
    > >
    > > The only part of development you should need to do as root is
    > > installing jar libs for general use - and that should be doable
    > > with sudo.
    > >
    > > Have you used scripts in /etc/profile.d to define your login
    > > environment, PATH variable, etc? Are they being exported? Did you
    > > test the steps as you set them up and fix the bits that were wrong?

    >
    > I define the environment variables in the /etc/profile file as
    > follows:
    > export JAVA_HOME=/home/powah/jdk1.6.0_06
    > export AXIS2_HOME=/opt/axis2-1.1.1
    > export ANT_HOME=/usr/local/ant/apache-ant-1.7.1
    > export CATALINA_HOME=/usr/local/apache-tomcat-6.0.13


    This what they are supposed to be, but you might look for spurious,
    non-printing characters. Also, check directory permissions on /opt if
    you are writing to AXIS2_HOME.

    --
    John B. Matthews
    trashgod at gmail dot com
    <http://sites.google.com/site/drjohnbmatthews>
     
    John B. Matthews, Apr 14, 2009
    #4
  5. On Tue, 14 Apr 2009 07:30:54 -0700, powah wrote:

    > On Apr 13, 5:04 pm, Martin Gregorie
    > <> wrote:
    >> On Mon, 13 Apr 2009 08:36:25 -0700, powah wrote:
    >> > I compile my java programs with tomcat & axis successfully as root on
    >> > linux.
    >> > I setup myself with sudo privilege but compiling them as regular
    >> > (non- root) user fail.

    >>
    >> Then your setup is borked by you or somebody else. A fresh Linux
    >> install doesn't have those problems and there's no reason why carefully
    >> installing Sun Java would cause them.
    >>
    >> The only part of development you should need to do as root is
    >> installing jar libs for general use - and that should be doable with
    >> sudo.
    >>
    >> Have you used scripts in /etc/profile.d to define your login
    >> environment, PATH variable, etc? Are they being exported? Did you test
    >> the steps as you set them up and fix the bits that were wrong?
    >>
    >> --
    >> martin@   | Martin Gregorie
    >> gregorie. | Essex, UK
    >> org       |

    >
    > I define the environment variables in the /etc/profile file as follows:
    > export JAVA_HOME=/home/powah/jdk1.6.0_06 export
    > AXIS2_HOME=/opt/axis2-1.1.1
    > export ANT_HOME=/usr/local/ant/apache-ant-1.7.1 export
    > CATALINA_HOME=/usr/local/apache-tomcat-6.0.13
    >

    OK, so why don't they work? Are all the ownerships and permissions
    correct for the files you reference?

    Going back to basics, in a normal login:
    - does env show them correctly?
    - can you compile and run a 'Hello World' program?

    If not, rince, wash and repeat until you can.


    --
    martin@ | Martin Gregorie
    gregorie. | Essex, UK
    org |
     
    Martin Gregorie, Apr 14, 2009
    #5
  6. powah

    powah Guest

    On Apr 14, 10:48 am, "John B. Matthews" <> wrote:
    > In article
    > <>,
    >
    >
    >
    >
    >
    >  powah <> wrote:
    > > On Apr 13, 5:04 pm, Martin Gregorie
    > > <> wrote:
    > > > On Mon, 13 Apr 2009 08:36:25 -0700, powah wrote:
    > > > > I compile my java programs with tomcat & axis successfully as
    > > > > root on linux. I setup myself with sudo privilege but compiling
    > > > > them as regular (non- root) user fail.

    >
    > > > Then your setup is borked by you or somebody else. A fresh Linux
    > > > install doesn't have those problems and there's no reason why
    > > > carefully installing Sun Java would cause them.

    >
    > > > The only part of development you should need to do as root is
    > > > installing jar libs for general use - and that should be doable
    > > > with sudo.

    >
    > > > Have you used scripts in /etc/profile.d to define your login
    > > > environment, PATH variable, etc? Are they being exported? Did you
    > > > test the steps as you set them up and fix the bits that were wrong?

    >
    > > I define the environment variables in the /etc/profile file as
    > > follows:
    > > export JAVA_HOME=/home/powah/jdk1.6.0_06
    > > export AXIS2_HOME=/opt/axis2-1.1.1
    > > export ANT_HOME=/usr/local/ant/apache-ant-1.7.1
    > > export CATALINA_HOME=/usr/local/apache-tomcat-6.0.13

    >
    > This what they are supposed to be, but you might look for spurious,
    > non-printing characters. Also, check directory permissions on /opt if
    > you are writing to AXIS2_HOME.
    >
    > --
    > John B. Matthews
    > trashgod at gmail dot com
    > <http://sites.google.com/site/drjohnbmatthews>


    I added /opt/axis2-1.1.1 to sudo.
    # visudo
    powah ALL= /usr/src/redhat/, /opt/axis2-1.1.1, /bin/touch, /bin/mv, /
    bin/rm, /usr/bin/, perl makeMY.pl

    # ls -ld /opt/axis2-1.1.1
    drwxr-xr-x 8 powah powah 4096 Sep 7 2007 /opt/axis2-1.1.1

    # ls -l /opt/axis2-1.1.1
    total 56
    drwxr-xr-x 2 powah powah 4096 Jan 9 2007 bin
    drwxr-xr-x 2 powah powah 4096 Jan 9 2007 conf
    -rw-r--r-- 1 powah powah 5524 Jan 9 2007 INSTALL.txt
    drwxr-xr-x 2 powah powah 4096 Jan 9 2007 lib
    -rw-r--r-- 1 powah powah 11359 Jan 9 2007 LICENSE.txt
    -rw-r--r-- 1 powah powah 656 Jan 9 2007 NOTICE.txt
    -rw-r--r-- 1 powah powah 1460 Jan 9 2007 README.txt
    -rw-r--r-- 1 powah powah 3695 Jan 9 2007 release-notes.html
    drwxr-xr-x 4 powah powah 4096 Jan 9 2007 repository
    drwxr-xr-x 19 powah powah 4096 Jan 9 2007 samples
    drwxr-xr-x 4 powah powah 4096 Jan 9 2007 webapp

    Recompiling all still fail with the same /home/
    powah/myproj_1.1rose/myproj_src/myCrypto/${env.AXIS2_HOME} not found.
     
    powah, Apr 14, 2009
    #6
  7. powah

    powah Guest

    On Apr 14, 11:03 am, Martin Gregorie
    <> wrote:
    > On Tue, 14 Apr 2009 07:30:54 -0700, powah wrote:
    > > On Apr 13, 5:04 pm, Martin Gregorie
    > > <> wrote:
    > >> On Mon, 13 Apr 2009 08:36:25 -0700, powah wrote:
    > >> > I compile my java programs with tomcat & axis successfully as root on
    > >> > linux.
    > >> > I setup myself with sudo privilege but compiling them as regular
    > >> > (non- root) user fail.

    >
    > >> Then your setup is borked by you or somebody else. A fresh Linux
    > >> install doesn't have those problems and there's no reason why carefully
    > >> installing Sun Java would cause them.

    >
    > >> The only part of development you should need to do as root is
    > >> installing jar libs for general use - and that should be doable with
    > >> sudo.

    >
    > >> Have you used scripts in /etc/profile.d to define your login
    > >> environment, PATH variable, etc? Are they being exported? Did you test
    > >> the steps as you set them up and fix the bits that were wrong?

    >
    > >> --
    > >> martin@   | Martin Gregorie
    > >> gregorie. | Essex, UK
    > >> org       |

    >
    > > I define the environment variables in the /etc/profile file as follows:
    > > export JAVA_HOME=/home/powah/jdk1.6.0_06 export
    > > AXIS2_HOME=/opt/axis2-1.1.1
    > > export ANT_HOME=/usr/local/ant/apache-ant-1.7.1 export
    > > CATALINA_HOME=/usr/local/apache-tomcat-6.0.13

    >
    > OK, so why don't they work? Are all the ownerships and permissions
    > correct for the files you reference?
    >
    > Going back to basics, in a normal login:
    > - does env show them correctly?
    > - can you compile and run a 'Hello World' program?
    >
    > If not, rince, wash and repeat until you can.
    >
    > --
    > martin@   | Martin Gregorie
    > gregorie. | Essex, UK
    > org       |


    me:
    $ env |grep HOME
    ANT_HOME=/usr/local/ant/apache-ant-1.7.1
    AXIS2_HOME=/opt/axis2-1.1.1
    CATALINA_HOME=/usr/local/apache-tomcat-6.0.13
    HOME=/home/powah
    JAVA_HOME=/home/powah/jdk1.6.0_06

    root:
    # env |grep HOME
    ANT_HOME=/usr/local/ant/apache-ant-1.7.1
    AXIS2_HOME=/opt/axis2-1.1.1
    CATALINA_HOME=/usr/local/apache-tomcat-6.0.13
    HOME=/root
    JAVA_HOME=/home/powah/jdk1.6.0_06

    The only difference is in $HOME (/home/powah vs /root).
    I (non-root) can compile and run a 'Hello World' program.
    I do not understand why I get this error:
    /home/powah/myproj_1.1rose/myproj_src/myCrypto/build.xml:30: /home/
    powah/myproj_1.1rose/myproj_src/myCrypto/${env.AXIS2_HOME} not found
     
    powah, Apr 14, 2009
    #7
  8. In article
    <>,
    powah <> wrote:

    > On Apr 14, 10:48 am, "John B. Matthews" <> wrote:
    > > In article
    > > <>,

    [...]
    > > Also, check directory permissions on /opt if
    > > you are writing to AXIS2_HOME.


    [Please trim signatures lines when responding.]

    > # ls -ld /opt/axis2-1.1.1
    > drwxr-xr-x 8 powah powah 4096 Sep 7 2007 /opt/axis2-1.1.1
    >
    > # ls -l /opt/axis2-1.1.1
    > total 56
    > drwxr-xr-x 2 powah powah 4096 Jan 9 2007 bin
    > drwxr-xr-x 2 powah powah 4096 Jan 9 2007 conf
    > -rw-r--r-- 1 powah powah 5524 Jan 9 2007 INSTALL.txt
    > drwxr-xr-x 2 powah powah 4096 Jan 9 2007 lib
    > -rw-r--r-- 1 powah powah 11359 Jan 9 2007 LICENSE.txt
    > -rw-r--r-- 1 powah powah 656 Jan 9 2007 NOTICE.txt
    > -rw-r--r-- 1 powah powah 1460 Jan 9 2007 README.txt
    > -rw-r--r-- 1 powah powah 3695 Jan 9 2007 release-notes.html
    > drwxr-xr-x 4 powah powah 4096 Jan 9 2007 repository
    > drwxr-xr-x 19 powah powah 4096 Jan 9 2007 samples
    > drwxr-xr-x 4 powah powah 4096 Jan 9 2007 webapp
    >
    > Recompiling all still fail with the same /home/
    > powah/myproj_1.1rose/myproj_src/myCrypto/${env.AXIS2_HOME} not found.


    Surely you have access to axis2-1.1.1 , but I don't see the ownership
    and permissions on the parent directory, /opt. Try 'ls -l /opt'.

    --
    John B. Matthews
    trashgod at gmail dot com
    <http://sites.google.com/site/drjohnbmatthews>
     
    John B. Matthews, Apr 14, 2009
    #8
  9. powah <> wrote:
    > [env says:] AXIS2_HOME=/opt/axis2-1.1.1
    > I do not understand why I get this error:
    > /home/powah/myproj_1.1rose/myproj_src/myCrypto/build.xml:30: /home/
    > powah/myproj_1.1rose/myproj_src/myCrypto/${env.AXIS2_HOME} not found


    Even if the env-var got substituted, the complete path would then be
    /home/powah/myproj_1.1rose/myproj_src/myCrypto//opt/axis2-1.1.1
    Does this exist? Why is the value of ${env.AXIS2_HOME} appended to
    that subdir rather than used itself?

    PS: I haven't read the whole thread, so, sorry if I missed something.
     
    Andreas Leitgeb, Apr 14, 2009
    #9
  10. powah <> wrote:
    > me:
    > $ env |grep HOME
    > AXIS2_HOME=/opt/axis2-1.1.1
    > ...


    Ok, now I did reread this thread, and I wonder, why two things haven't
    yet been addressed:

    - what do the perl script and the build.xml look like around
    the line numbers indicated by the error messages?

    - could you add some code to the perl script to print out the
    environment which it really sees?
    I don't know perl well enough, but I'd guess that
    system("env > /dev/tty");
    (before it starts ant build) should do it.
     
    Andreas Leitgeb, Apr 14, 2009
    #10
  11. On Tue, 14 Apr 2009 10:22:57 -0700, powah wrote:

    >
    > Recompiling all still fail with the same /home/
    > powah/myproj_1.1rose/myproj_src/myCrypto/${env.AXIS2_HOME} not found.
    >

    Was SELinux part of FC6? If so:

    - what mode is it running in?
    - If its running in Enforcing mode does disabling it and rebooting help?


    --
    martin@ | Martin Gregorie
    gregorie. | Essex, UK
    org |
     
    Martin Gregorie, Apr 14, 2009
    #11
  12. powah

    powah Guest

    On Apr 14, 6:24 pm, Martin Gregorie
    <> wrote:
    > On Tue, 14 Apr 2009 10:22:57 -0700, powah wrote:
    >
    > > Recompiling all still fail with the same /home/
    > > powah/myproj_1.1rose/myproj_src/myCrypto/${env.AXIS2_HOME} not found.

    >
    > Was SELinux part of FC6? If so:
    >
    > - what mode is it running in?
    > - If its running in Enforcing mode does disabling it and rebooting help?
    >

    No. SELinux is not installed on FC6.
     
    powah, Apr 15, 2009
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nagaraj
    Replies:
    1
    Views:
    871
    Lionel B
    Mar 1, 2007
  2. mpnordland
    Replies:
    24
    Views:
    897
  3. Ian Collins
    Replies:
    0
    Views:
    226
    Ian Collins
    Nov 21, 2012
  4. Replies:
    0
    Views:
    220
  5. DFS
    Replies:
    2
    Views:
    79
Loading...

Share This Page