Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. g++ compiling paramter -static on Solaris sparc

g++ compiling paramter -static on Solaris sparc

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++mysqlquestion
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    David Wong RZ
    wrote on last edited by
    #1

    Hello, everyone Recently I use g++ to compile cpp files with a -static paramter, and I got an compiler error as below: /homes/judge/source/31.cpp:7:2: warning: no newline at end of file ld: fatal: library -lm: not found ld: fatal: library -lc: not found ld: fatal: library -lc: not found ld: fatal: File processing errors. No output written to /homes/judge/exe/4090 collect2: ld returned 1 exit status I guess may be it happened by problem of system environment, the /etc/profile list out here: MANPATH=$MANPATH:/usr/local/man LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/ld:/usr/lib LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/export/home/mysql/mysql-5.1.32/lib CC=gcc export LD_LIBRARY_PATH export CC export MANPATH JAVA_HOME=/Desktop/jdk1.6.0_12 CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib export CLASSPATH CATALINA_BASE=/usr/local/tomcat CATALINA_HOME=/usr/local/tomcat PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$CATALINA_HOME/bin:/usr/sfw/bin:/usr/local/bin:/usr/bin:/usr/ccs/bin:/sur/sbin export PATH Any suggestion for this problem? Thanks in advance!

    no cross no crown.

    J S 3 Replies Last reply
    0
    • D David Wong RZ

      Hello, everyone Recently I use g++ to compile cpp files with a -static paramter, and I got an compiler error as below: /homes/judge/source/31.cpp:7:2: warning: no newline at end of file ld: fatal: library -lm: not found ld: fatal: library -lc: not found ld: fatal: library -lc: not found ld: fatal: File processing errors. No output written to /homes/judge/exe/4090 collect2: ld returned 1 exit status I guess may be it happened by problem of system environment, the /etc/profile list out here: MANPATH=$MANPATH:/usr/local/man LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/ld:/usr/lib LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/export/home/mysql/mysql-5.1.32/lib CC=gcc export LD_LIBRARY_PATH export CC export MANPATH JAVA_HOME=/Desktop/jdk1.6.0_12 CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib export CLASSPATH CATALINA_BASE=/usr/local/tomcat CATALINA_HOME=/usr/local/tomcat PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$CATALINA_HOME/bin:/usr/sfw/bin:/usr/local/bin:/usr/bin:/usr/ccs/bin:/sur/sbin export PATH Any suggestion for this problem? Thanks in advance!

      no cross no crown.

      J Offline
      J Offline
      Jerry Wang
      wrote on last edited by
      #2

      It seems that u r missing some static libraries

      1 Reply Last reply
      0
      • D David Wong RZ

        Hello, everyone Recently I use g++ to compile cpp files with a -static paramter, and I got an compiler error as below: /homes/judge/source/31.cpp:7:2: warning: no newline at end of file ld: fatal: library -lm: not found ld: fatal: library -lc: not found ld: fatal: library -lc: not found ld: fatal: File processing errors. No output written to /homes/judge/exe/4090 collect2: ld returned 1 exit status I guess may be it happened by problem of system environment, the /etc/profile list out here: MANPATH=$MANPATH:/usr/local/man LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/ld:/usr/lib LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/export/home/mysql/mysql-5.1.32/lib CC=gcc export LD_LIBRARY_PATH export CC export MANPATH JAVA_HOME=/Desktop/jdk1.6.0_12 CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib export CLASSPATH CATALINA_BASE=/usr/local/tomcat CATALINA_HOME=/usr/local/tomcat PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$CATALINA_HOME/bin:/usr/sfw/bin:/usr/local/bin:/usr/bin:/usr/ccs/bin:/sur/sbin export PATH Any suggestion for this problem? Thanks in advance!

        no cross no crown.

        J Offline
        J Offline
        Jerry Wang
        wrote on last edited by
        #3

        Why not remove -static ?

        1 Reply Last reply
        0
        • D David Wong RZ

          Hello, everyone Recently I use g++ to compile cpp files with a -static paramter, and I got an compiler error as below: /homes/judge/source/31.cpp:7:2: warning: no newline at end of file ld: fatal: library -lm: not found ld: fatal: library -lc: not found ld: fatal: library -lc: not found ld: fatal: File processing errors. No output written to /homes/judge/exe/4090 collect2: ld returned 1 exit status I guess may be it happened by problem of system environment, the /etc/profile list out here: MANPATH=$MANPATH:/usr/local/man LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/ld:/usr/lib LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/export/home/mysql/mysql-5.1.32/lib CC=gcc export LD_LIBRARY_PATH export CC export MANPATH JAVA_HOME=/Desktop/jdk1.6.0_12 CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib export CLASSPATH CATALINA_BASE=/usr/local/tomcat CATALINA_HOME=/usr/local/tomcat PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$CATALINA_HOME/bin:/usr/sfw/bin:/usr/local/bin:/usr/bin:/usr/ccs/bin:/sur/sbin export PATH Any suggestion for this problem? Thanks in advance!

          no cross no crown.

          S Offline
          S Offline
          Stuart Dootson
          wrote on last edited by
          #4

          g++ should be able to find libc and libm (those are the two that you're having issues with). Are you sure Solaris supports static linking? I've just tried the same test on OS X (10.5.6) and, while gcc accepts -static, not all static libraries are present.

          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

          D 2 Replies Last reply
          0
          • S Stuart Dootson

            g++ should be able to find libc and libm (those are the two that you're having issues with). Are you sure Solaris supports static linking? I've just tried the same test on OS X (10.5.6) and, while gcc accepts -static, not all static libraries are present.

            Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

            D Offline
            D Offline
            David Wong RZ
            wrote on last edited by
            #5

            Stuart Dootson wrote:

            g++ should be able to find libc and libm

            You mean that I need add the path include the libc&libm into system environment? When I use -lm parameter it works, isn't -lm says g++ compiler is using the math library compiling code, namely the libm? But with a -static will occur that error.I confused that a little.

            Stuart Dootson wrote:

            Are you sure Solaris supports static linking

            I think the -static is belong to g++ and independence of platform(solaris/fedora..), but I am too new one to confirm this. I guess it due to a library g++ can't find. The key is that I try writting a program about online judge program(some thing like ACM), it did not work well without the -static parameter while compiling period. I have to compile like this: g++ %s/%d.cpp -o %s/%d -ansi -fno-asm -Wall -lm -DONLINE_JUDGE --static 2> %s/%d.txt I am very need your suggestions, thanks for your time! :)

            no cross no crown.

            1 Reply Last reply
            0
            • S Stuart Dootson

              g++ should be able to find libc and libm (those are the two that you're having issues with). Are you sure Solaris supports static linking? I've just tried the same test on OS X (10.5.6) and, while gcc accepts -static, not all static libraries are present.

              Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

              D Offline
              D Offline
              David Wong RZ
              wrote on last edited by
              #6

              Sorry, I google it, finally find the static linking on Solaris 10 was removed. Now, I need to think changing to a linux server. Thank you sir.

              no cross no crown.

              S 1 Reply Last reply
              0
              • D David Wong RZ

                Sorry, I google it, finally find the static linking on Solaris 10 was removed. Now, I need to think changing to a linux server. Thank you sir.

                no cross no crown.

                S Offline
                S Offline
                Stuart Dootson
                wrote on last edited by
                #7

                David Wong RZ wrote:

                Sorry, I google it, finally find the static linking on Solaris 10 was removed

                No worries - glad you found an explanation for your problem!

                Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups