Ad Widget

Collapse

Compiling on Solaris 9 with Sun Studio 10

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • darcuri
    Junior Member
    • Jun 2005
    • 3

    #1

    Compiling on Solaris 9 with Sun Studio 10

    I don't believe your Makefiles work at all with Sun's compiler. I'd love to use this product but I will not be installing gcc simply to compile one application out of the many I have to maintain here. I've already had to remove -Wall from one Makefile as the option is not recognized by cc. Do you plan to have support for building with Sun Studio? Or am I missing something here?

    Here's an example of the many errors I'm getting:

    Making all in src/zabbix_agent
    make[1]: Entering directory `/export/src/zabbix-1.1alpha10/src/zabbix_agent'
    cc -o ../../bin/zabbix_agent -g -I../../include -I/usr/local/include zabbix_agent.c sysinfo.c ../../include/log.c ../../include/cfg.c ../../include/security.c ../../include/snprintf.c ../../include/md5.c -lnsl -lkstat -lsocket -L/usr/local/lib -lldap
    zabbix_agent.c:
    sysinfo.c:
    "sysinfo.c", line 289: warning: assignment type mismatch:
    pointer to function() returning int "=" pointer to void
    "sysinfo.c", line 290: warning: assignment type mismatch:
    pointer to function() returning int "=" pointer to void
    "sysinfo.c", line 342: warning: argument #2 is incompatible with prototype:
    prototype: pointer to void : "sysinfo.c", line 270
    argument : pointer to function() returning int
    "sysinfo.c", line 342: warning: argument #3 is incompatible with prototype:
    prototype: pointer to void : "sysinfo.c", line 270
    argument : pointer to function() returning int
    "sysinfo.c", line 588: warning: argument #1 is incompatible with prototype:
    prototype: pointer to char : "/usr/include/iso/stdio_iso.h", line 183
    argument : pointer to unsigned char
    "sysinfo.c", line 590: warning: argument #1 is incompatible with prototype:
    prototype: pointer to const char : "/usr/include/string.h", line 79
    argument : pointer to unsigned char
    ../../include/log.c:
    ../../include/cfg.c:
    ../../include/security.c:
    ../../include/snprintf.c:
    "../../include/snprintf.c", line 182: warning: implicit function declaration: __va_copy
    "../../include/snprintf.c", line 823: warning: implicit function declaration: vsnprintf
    ../../include/md5.c:
    Undefined first referenced
    symbol in file
    __va_copy snprintf.o
    ber_free sysinfo.o (symbol belongs to implicit dependency /usr/local/lib/liblber-2.2.so.7)
    ld: fatal: Symbol referencing errors. No output written to ../../bin/zabbix_agent
    make[1]: *** [all] Error 1
    make[1]: Leaving directory `/export/src/zabbix-1.1alpha10/src/zabbix_agent'
    make: *** [all] Error 1
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    Please try to replace (in file include/snprintf.c):

    #ifdef HAVE___VA_COPY
    #define VA_COPY(dest, src) __va_copy(dest, src)
    #else
    #define VA_COPY(dest, src) (dest) = (src)
    #endif

    by

    #define VA_COPY(dest, src) (dest) = (src)

    The warnings can be ignored for now, I've already fixed some on them.

    Try to recompile and let me know about results. Thanks!
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • darcuri
      Junior Member
      • Jun 2005
      • 3

      #3
      Ahh

      That worked. In addition, I modified the cc lines in the Makefile to remove -Wall, and added -llber and -lresolv to the LIBS definition:

      LIBS = -lnsl -lkstat -lsocket -L/usr/local/lib -lldap -llber -lresolv

      That gets me compiling fine with the Sun compiler. I'm not sure why the #ifdef HAVE___VA_COPY block is being treated differently with cc than with gcc.

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #4
        I don't think -lresov is required. What is -llber?
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • darcuri
          Junior Member
          • Jun 2005
          • 3

          #5
          -lresolv fixes this link error:

          Undefined first referenced
          symbol in file
          hstrerror active.o (symbol belongs to implicit dependency /lib/libresolv.so.2)
          ld: fatal: Symbol referencing errors. No output written to ../../bin/zabbix_agentd

          -llber fixed one of the link errors in my original post, where ber_free is referenced:

          Undefined first referenced
          symbol in file
          __va_copy snprintf.o
          ber_free sysinfo.o (symbol belongs to implicit dependency /usr/local/lib/liblber-2.2.so.7)
          ld: fatal: Symbol referencing errors. No output written to ../../bin/zabbix_agent

          Comment

          • welshpjw
            Member
            • Mar 2005
            • 50

            #6
            Happens to HP-UX 11.x also

            Just an FYI, the hstrerror ldd problem also happens on hpux 11.0...

            Comment

            • Neo
              Member
              • Jun 2005
              • 59

              #7
              I tried compiling Zabbix 1.0 on a HP UX 10.2 machine and this is what i get. The sys did not have GCC but used CC with these flags i think checking
              whether make sets $(MAKE)... yes
              checking for gcc... no
              checking for cc... cc
              checking for C compiler default output... a.out
              checking whether the C compiler works... yes
              checking whether we are cross compiling... no
              checking for suffix of executables...
              checking for suffix of object files... o
              checking whether we are using the GNU C compiler... no
              checking whether cc accepts -g... yes
              checking for cc option to accept ANSI C... -Ae
              checking for main in -lsocket... no
              checking for main in -lkstat... no
              checking for main in -lnsl... no
              checking how to run the C preprocessor... cc -Ae -E
              checking for egrep... grep -E
              .........
              The make commands output was this
              Making all in src/zabbix_agent
              Make: line 5: syntax error. Stop.
              *** Error exit code 1

              Stop.
              And the makefile in src/zabbix_agent is
              Code:
              # Build rules
              
              all:
              
                      cc -Ae -o ../../bin/zabbix_agent  -g -I../../include zabbix_agent.c sysinfo.c ../../include/log.c ../../include/
              cfg.c ../../include/security.c ../../include/snprintf.c -Wall
                      cc -Ae -o ../../bin/zabbix_agentd -g -I../../include zabbix_agentd.c sysinfo.c stats.c interfaces.c diskdevices.
              c ../../include/log.c ../../include/cfg.c ../../include/security.c ../../include/pid.c ../../include/snprintf.c -Wall
              
              clean:
                      rm -f *.o
                      rm -f ../../bin/zabbix_agent
                      rm -f ../../bin/zabbix_agentd

              Comment

              • Alexei
                Founder, CEO
                Zabbix Certified Trainer
                Zabbix Certified SpecialistZabbix Certified Professional
                • Sep 2004
                • 5654

                #8
                Use GNU make, not standard make bundled with HP-UX.
                Alexei Vladishev
                Creator of Zabbix, Product manager
                New York | Tokyo | Riga
                My Twitter

                Comment

                • Neo
                  Member
                  • Jun 2005
                  • 59

                  #9
                  Ok I managed to do that compilation manually and I've got it working now. Thanks a lot Alexi.

                  Comment

                  Working...