Ad Widget

Collapse

Incorrect build on Solaris 10 with cc

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ptribble
    Junior Member
    • May 2006
    • 6

    #1

    Incorrect build on Solaris 10 with cc

    The ./configure script incorrectly sets up the linker flags for the server build on Solaris 10, if the Sun compiler (Studio 11, but I suspect it's generic to all compilers):

    setenv CC cc
    ./configure --enable-server --with-mysql=/usr/sfw

    This fails to link when it comes to (trimmed):

    cc -g -o zabbix_server -L/usr/sfw/lib/mysql
    ...
    -lmysqlclient
    ...

    There are actually two errors here:

    - It's looking in /usr/sfw/lib/mysql when the library is in /usr/sfw/lib. The extra mysql in the path is incorrect

    - There's no corresponding -R, so that even if it were to link it would be unable to find the library at runtime

    If I use /usr/sfw/bin/gcc, then the build succeeds. But this is by accident, because that gcc happens to look in /usr/sfw/lib anyway.

    Furthermore, as far as I can tell the build with cc is unoptimized - I can't see any -O being specified (although -g is). Mind you, the gcc build has the optimization turned down to -O2 from the normal -O.
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    Thanks for your post. What -R stands for? Is it GCC parameter?
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • ptribble
      Junior Member
      • May 2006
      • 6

      #3
      -R flags

      The rule on most unix variants is:

      -L directory to look for libraries at compile time
      -R directory in which the binary should look for libraries when it runs

      Now ./configure ought to work this out, but it rarely manages to get it right (your software would be much easier to build if you didn't use autoconf, but that's another discussion).

      Comment

      Working...