Is there any settings to be done to use clang++ instead of g++ on RHEL 6.1?
The compilation was fine except the linker complains (gnu ld).
what I did was
#export CXX = path/to/clang++/
then make for the project.
If these goes through clang will be supported for our project.
This is holding back
–Dev
Devchandra L Meetei <dlmeetei@gmail.com>
writes:
Is there any settings to be done to use clang++ instead of g++ on RHEL 6.1?
what I did was
#export CXX = path/to/clang++/
then make for the project.
That's basically enough in my experience, but it sort of depends on
your program. Clang tries hard to be gcc-compatible, but sometimes
random differences do crop up (typically due to bugs or areas of
active development).
The biggest area I've found is c++0x features, as gcc seems farther
along in c++0x support. E.g., if you use std::thread with gcc, you
might want to use boost::thread instead in clang. If you only use
C++98 features, you're probably on fairly safe ground.
[You might want to set CC as well, if your code base includes C code.]
The compilation was fine except the linker complains (gnu ld).
Er, what are the error messages?
-Miles
history |grep export gave this and error message are below
export CC=/home/deleisha/Downloads/clang+llvm-2.9-x86_64-linux.tar/bin/clang
export CXX=/home/deleisha/Downloads/clang+llvm-2.9-x86_64-linux.tar/bin/clang++
Er, what are the error messages?
/home/deleisha/CodeSpace/pegasus/pkg/obj/Pegasus/General/MofWriter.o: In function Pegasus::MofWriter::appendValueElement(Pegasus::Buffer&, Pegasus::CIMValue const&)': /home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:387: undefined reference to
Pegasus::ArrayPegasus::CIMObject::Array()’
/home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:389: undefined reference to Pegasus::Array<Pegasus::CIMObject>::getData() const' /home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:389: undefined reference to
Pegasus::ArrayPegasus::CIMObject::size() const’
/home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:391: undefined reference to Pegasus::Array<Pegasus::CIMObject>::~Array()' /home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:391: undefined reference to
Pegasus::ArrayPegasus::CIMObject::~Array()’
/home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:394: undefined reference to Pegasus::Array<Pegasus::CIMInstance>::Array()' /home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:396: undefined reference to
Pegasus::ArrayPegasus::CIMInstance::getData() const’
/home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:396: undefined reference to Pegasus::Array<Pegasus::CIMInstance>::size() const' /home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:398: undefined reference to
Pegasus::ArrayPegasus::CIMInstance::~Array()’
/home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:398: undefined reference to Pegasus::Array<Pegasus::CIMInstance>::~Array()' /usr/bin/ld: /home/deleisha/CodeSpace/pegasus/pkg/lib/libpeggeneral.so.1: hidden symbol
_ZN7Pegasus5ArrayINS_9CIMObjectEEixEj’ isn’t defined
/usr/bin/ld: final link failed: Nonrepresentable section on output
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [/home/deleisha/CodeSpace/pegasus/pkg/lib/libpeggeneral.so.1] Error 1
make[3]: Leaving directory /home/deleisha/CodeSpace/pegasus/src/Pegasus/General' make[2]: *** [all] Error 2 make[2]: Leaving directory
/home/deleisha/CodeSpace/pegasus/src/Pegasus’
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/deleisha/CodeSpace/pegasus/src’
make: *** [all] Error 2
Clang’s handling of visibility has improved greatly since Clang 2.9. Please try the latest Clang trunk and see if that works for you.
Sure Douglas, Let me try and update on that
—Dev
I was trying with 2.9 release. linker problem persists
–Dev
I was trying with 2.9 release. linker problem persists
Are you saying that you compiled the latest Clang from Subversion, and the problem still remains? If so, please file a bug with preprocessed sources so we can reproduce the problem.
I use the binary one(precompiled version 2.9) found at http://llvm.org/releases/ for X86_64. Now I am compiling the released version 2.9 from the same site
I use the binary one(precompiled version 2.9) found at http://llvm.org/releases/ for X86_64. Now I am compiling the released version 2.9 from the same site
That won’t help. Clang 2.9 is ancient in Clang-time; I’m suggesting that you get the latest development version of Clang from Subversion.
Downloaded the latest code base from svn and did make -ENABLED_OPTIMISED=1
The resultant binary compiles and linked perfectly
However,
very preliminary comparison results with time command
Downloaded the latest code base from svn and did make -ENABLED_OPTIMISED=1
The resultant binary compiles and linked perfectly
However,
very preliminary comparison results with time command
clang++
real 5m44.626s
user 4m54.984s
sys 0m42.463s
g++
real 5m16.298s
user 4m10.836s
sys 0m47.825s
You should also disable assertions to get an optimal release build.
./configure --enable-optimized --disable-assertions
The resultant binaries of my project with clang is 319 MB and whereas g++ one is 302 MB
Sent from my iPhone
I use the binary one(precompiled version 2.9) found at http://llvm.org/releases/ for X86_64. Now I am compiling the released version 2.9 from the same site
That won’t help. Clang 2.9 is ancient in Clang-time; I’m suggesting that you get the latest development version of Clang from Subversion.
I was trying with 2.9 release. linker problem persists
Are you saying that you compiled the latest Clang from Subversion, and the problem still remains? If so, please file a bug with preprocessed sources so we can reproduce the problem.
–Dev
Sure Douglas, Let me try and update on that
—Dev
history |grep export gave this and error message are below
export CC=/home/deleisha/Downloads/clang+llvm-2.9-x86_64-linux.tar/bin/clang
export CXX=/home/deleisha/Downloads/clang+llvm-2.9-x86_64-linux.tar/bin/clang++
Er, what are the error messages?
/home/deleisha/CodeSpace/pegasus/pkg/obj/Pegasus/General/MofWriter.o: In function Pegasus::MofWriter::appendValueElement(Pegasus::Buffer&, Pegasus::CIMValue const&)': /home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:387: undefined reference to
Pegasus::ArrayPegasus::CIMObject::Array()’
/home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:389: undefined reference to Pegasus::Array<Pegasus::CIMObject>::getData() const' /home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:389: undefined reference to
Pegasus::ArrayPegasus::CIMObject::size() const’
/home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:391: undefined reference to Pegasus::Array<Pegasus::CIMObject>::~Array()' /home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:391: undefined reference to
Pegasus::ArrayPegasus::CIMObject::~Array()’
/home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:394: undefined reference to Pegasus::Array<Pegasus::CIMInstance>::Array()' /home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:396: undefined reference to
Pegasus::ArrayPegasus::CIMInstance::getData() const’
/home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:396: undefined reference to Pegasus::Array<Pegasus::CIMInstance>::size() const' /home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:398: undefined reference to
Pegasus::ArrayPegasus::CIMInstance::~Array()’
/home/deleisha/CodeSpace/pegasus/src/Pegasus/General/MofWriter.cpp:398: undefined reference to Pegasus::Array<Pegasus::CIMInstance>::~Array()' /usr/bin/ld: /home/deleisha/CodeSpace/pegasus/pkg/lib/libpeggeneral.so.1: hidden symbol
_ZN7Pegasus5ArrayINS_9CIMObjectEEixEj’ isn’t defined
/usr/bin/ld: final link failed: Nonrepresentable section on output
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [/home/deleisha/CodeSpace/pegasus/pkg/lib/libpeggeneral.so.1] Error 1
make[3]: Leaving directory /home/deleisha/CodeSpace/pegasus/src/Pegasus/General' make[2]: *** [all] Error 2 make[2]: Leaving directory
/home/deleisha/CodeSpace/pegasus/src/Pegasus’
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/deleisha/CodeSpace/pegasus/src’
make: *** [all] Error 2
Clang’s handling of visibility has improved greatly since Clang 2.9. Please try the latest Clang trunk and see if that works for you.
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
– Jean-Daniel
Thanks Daniel
Let me try that and update on the same
–Dev
Without asserts.
clang now takes
real 4m53.073s
user 4m1.323s
sys 0m40.077s
which is faster than g++
but still the memory foot print is more now with 238 MB
This is the memory footprint of clang vs g++? What are the comparisons? How are you compiling? How are you measuring the footprint? What system are you on?
-eric
I have compiled clang by checking out from svn today morning
./configure --enable-optimized --disable-assertions
make
Then I exported CXX and CC to the path to binary clang
then compile the pegasus code.
Memory footprint for clang vs g++(4.4.5)
clang
Which flags did you use to compile it? Is debug info enabled ("-g")?
Did you compile your code with or without optimization?
- Ben
Aha, forgot to mention, debug is enebled in both the clang++ and g++.
All the flags are same in both the clang++ and g++
–Dev
"All flags the same" means nothing to us. That debug info is on means a bit, is there a significant difference with it turned on? Let me be precise: "How are you compiling this program? What exact flags are you using? What are you using to make the comparisons?"
-eric
These are the flags being used and -Wno-unused and -Wno-unused-parameter are repeated.
The comparision is very naive, for compilation time time command is being used and for du -h dir for the size.
Let me give the comparison without the -g options shortly
g++ -c -o /home/deleisha/CodeSpace/pegasus/pkg/obj/utils/cnv2rootbundle/cnv2rootbundle.o -W -Wall -Wno-unused -Wno-unused-parameter -D_GNU_SOURCE -DTHREAD_SAFE -D_REENTRANT -g -m64 -fvisibility=hidden -fPIE -DPEGASUS_PLATFORM_LINUX_GENERIC_GNU -DPEGASUS_PLATFORM_LINUX_X86_64_GNU -DPEGASUS_USE_SYSLOGS -DPEGASUS_ARCH_LIB="lib64" -DPEGASUS_USE_SQLITE_REPOSITORY -DPEGASUS_ENABLE_CQL -DPEGASUS_DEFAULT_ENABLE_OOP -DPEGASUS_DISABLE_PROV_USERCTXT -DPEGASUS_DISABLE_EXECQUERY -DPEGASUS_ENABLE_AUDIT_LOGGER -DPEGASUS_ENABLE_IPV6 -DPEGASUS_ENABLE_INDICATION_COUNT -DPEGASUS_ENABLE_INTEROP_PROVIDER -DPEGASUS_DEBUG -DPEGASUS_USE_EXPERIMENTAL_INTERFACES -DPEGASUS_USE_DEPRECATED_INTERFACES -DPEGASUS_ENABLE_CMPI_PROVIDER_MANAGER -DPEGASUS_DEST_LIB_DIR="lib" -DPEGASUS_ENABLE_PROTOCOL_WSMAN -DPEGASUS_EXTRA_PROVIDER_LIB_DIR="" -DPLATFORM_COMPONENT_NAME="cnv2rootbundle" -I/home/deleisha/CodeSpace/pegasus/src cnv2rootbundle.cpp
Eric
Extract from the clang++ compile without debug info. See the warnings which follows also.
Is there a better way to improve on this.
/home/deleisha/CodeSpace/build/Release/bin/clang++ -c -o /home/deleisha/CodeSpace/pegasus/pkg/obj/Pegasus/DynListener/Service/cimlistener.o -W -Wall -Wno-unused -Wno-unused-parameter -D_GNU_SOURCE -DTHREAD_SAFE -D_REENTRANT -s -O2 -m64 -fvisibility=hidden -fPIE -fno-enforce-eh-specs -DPEGASUS_INTERNALONLY -DPEGASUS_CONSUMER_INTERNAL -DPEGASUS_PLATFORM_LINUX_GENERIC_GNU -DPEGASUS_PLATFORM_LINUX_X86_64_GNU -DPEGASUS_USE_SYSLOGS -DPEGASUS_ARCH_LIB="lib64" -DPEGASUS_USE_SQLITE_REPOSITORY -DPEGASUS_ENABLE_CQL -DPEGASUS_DEFAULT_ENABLE_OOP -DPEGASUS_DISABLE_PROV_USERCTXT -DPEGASUS_DISABLE_EXECQUERY -DPEGASUS_ENABLE_AUDIT_LOGGER -DPEGASUS_ENABLE_IPV6 -DPEGASUS_ENABLE_INDICATION_COUNT -DPEGASUS_ENABLE_INTEROP_PROVIDER -DPEGASUS_USE_EXPERIMENTAL_INTERFACES -DPEGASUS_USE_DEPRECATED_INTERFACES -DPEGASUS_ENABLE_CMPI_PROVIDER_MANAGER -DPEGASUS_DEST_LIB_DIR="lib" -DPEGASUS_ENABLE_PROTOCOL_WSMAN -DPEGASUS_EXTRA_PROVIDER_LIB_DIR="" -DPLATFORM_COMPONENT_NAME="cimlistener" -I/home/deleisha/CodeSpace/pegasus/src cimlistener.cpp
clang: warning: argument unused during compilation: ‘-s’
clang: warning: argument unused during compilation: ‘-fno-enforce-eh-specs’
g++ without -g