g++ compiling paramter -static on Solaris sparc
-
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.
-
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.
It seems that u r missing some static libraries
-
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.
Why not remove -static ?
-
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.
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
-
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
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.
-
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
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.
-
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.
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