[opensource-dev] Review Request: VWR-24366: CMAKE_EXE_LINKER_FLAGS not honored when linking the viewer binary if -DLL_TESTS:BOOL=ON

2011-01-14 Thread Aleric Inglewood

---
This is an automatically generated e-mail. To reply, visit:
http://codereview.secondlife.com/r/95/
---

Review request for Viewer.


Summary
---

Setting CMAKE_EXE_LINKER_FLAGS to  because the tests need that is pretty
hard measure. Not only is it not necessary to do so, it also changes how
the viewer is linked depending on a whether or not the tests are compiled
and that is not good.

The reason that this was needed is that libgmock is underlinked
(see http://wiki.mandriva.com/en/Underlinking), which is not compatible
with -Wl,--as-needed that is being used on linux. libgmock.so.0 needs
a symbol that is defined in libgtest.so.o, but -lgtest was not passed
to the linker when creating libgmock.so.0:

Underlinked (no libgtest.so.o):
$ objdump -p /usr/lib/libgmock.so.0 | grep NEEDED
NEEDED libstdc++.so.6
NEEDED libm.so.6
NEEDED libc.so.6
NEEDED libgcc_s.so.1

The solution is to wrap between -Wl,--no-as-needed -lgtest -Wl,--as-needed
causing it to be added again. This is only needed on linux, since that
the only platform that we use -Wl,--as-needed on. Moreover, we can just
set GOOGLEMOCK_LIBRARIES to gmock -Wl,--no-as-needed gtest -Wl,--as-needed
since that is only passed to TARGET_LINK_LIBRARIES which only adds -l
in front of 'things' that don't start with '-', to allow you do pass
special flags like this.


This addresses bug VWR-24366.
http://jira.secondlife.com/browse/VWR-24366


Diffs
-

  doc/contributions.txt 422f636c3343 
  indra/cmake/GoogleMock.cmake 422f636c3343 
  indra/cmake/LLAddBuildTest.cmake 422f636c3343 

Diff: http://codereview.secondlife.com/r/95/diff


Testing
---


Thanks,

Aleric

___
Policies and (un)subscribe information available here:
http://wiki.secondlife.com/wiki/OpenSource-Dev
Please read the policies before posting to keep unmoderated posting privileges

Re: [opensource-dev] Review Request: VWR-24366: CMAKE_EXE_LINKER_FLAGS not honored when linking the viewer binary if -DLL_TESTS:BOOL=ON

2011-01-14 Thread Boroondas Gupte

---
This is an automatically generated e-mail. To reply, visit:
http://codereview.secondlife.com/r/95/#review162
---

Ship it!


Looks sane and your explanation makes sense.

- Boroondas


On Jan. 14, 2011, 1:15 p.m., Aleric Inglewood wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 http://codereview.secondlife.com/r/95/
 ---
 
 (Updated Jan. 14, 2011, 1:15 p.m.)
 
 
 Review request for Viewer.
 
 
 Summary
 ---
 
 Setting CMAKE_EXE_LINKER_FLAGS to  because the tests need that is pretty
 hard measure. Not only is it not necessary to do so, it also changes how
 the viewer is linked depending on a whether or not the tests are compiled
 and that is not good.
 
 The reason that this was needed is that libgmock is underlinked
 (see http://wiki.mandriva.com/en/Underlinking), which is not compatible
 with -Wl,--as-needed that is being used on linux. libgmock.so.0 needs
 a symbol that is defined in libgtest.so.o, but -lgtest was not passed
 to the linker when creating libgmock.so.0:
 
 Underlinked (no libgtest.so.o):
 $ objdump -p /usr/lib/libgmock.so.0 | grep NEEDED
 NEEDED libstdc++.so.6
 NEEDED libm.so.6
 NEEDED libc.so.6
 NEEDED libgcc_s.so.1
 
 The solution is to wrap between -Wl,--no-as-needed -lgtest -Wl,--as-needed
 causing it to be added again. This is only needed on linux, since that
 the only platform that we use -Wl,--as-needed on. Moreover, we can just
 set GOOGLEMOCK_LIBRARIES to gmock -Wl,--no-as-needed gtest -Wl,--as-needed
 since that is only passed to TARGET_LINK_LIBRARIES which only adds -l
 in front of 'things' that don't start with '-', to allow you do pass
 special flags like this.
 
 
 This addresses bug VWR-24366.
 http://jira.secondlife.com/browse/VWR-24366
 
 
 Diffs
 -
 
   doc/contributions.txt 422f636c3343 
   indra/cmake/GoogleMock.cmake 422f636c3343 
   indra/cmake/LLAddBuildTest.cmake 422f636c3343 
 
 Diff: http://codereview.secondlife.com/r/95/diff
 
 
 Testing
 ---
 
 
 Thanks,
 
 Aleric
 


___
Policies and (un)subscribe information available here:
http://wiki.secondlife.com/wiki/OpenSource-Dev
Please read the policies before posting to keep unmoderated posting privileges

Re: [opensource-dev] Review Request: VWR-24366: CMAKE_EXE_LINKER_FLAGS not honored when linking the viewer binary if -DLL_TESTS:BOOL=ON

2011-01-14 Thread Merov Linden

---
This is an automatically generated e-mail. To reply, visit:
http://codereview.secondlife.com/r/95/#review163
---

Ship it!


Makes sense.

- Merov


On Jan. 14, 2011, 1:15 p.m., Aleric Inglewood wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 http://codereview.secondlife.com/r/95/
 ---
 
 (Updated Jan. 14, 2011, 1:15 p.m.)
 
 
 Review request for Viewer.
 
 
 Summary
 ---
 
 Setting CMAKE_EXE_LINKER_FLAGS to  because the tests need that is pretty
 hard measure. Not only is it not necessary to do so, it also changes how
 the viewer is linked depending on a whether or not the tests are compiled
 and that is not good.
 
 The reason that this was needed is that libgmock is underlinked
 (see http://wiki.mandriva.com/en/Underlinking), which is not compatible
 with -Wl,--as-needed that is being used on linux. libgmock.so.0 needs
 a symbol that is defined in libgtest.so.o, but -lgtest was not passed
 to the linker when creating libgmock.so.0:
 
 Underlinked (no libgtest.so.o):
 $ objdump -p /usr/lib/libgmock.so.0 | grep NEEDED
 NEEDED libstdc++.so.6
 NEEDED libm.so.6
 NEEDED libc.so.6
 NEEDED libgcc_s.so.1
 
 The solution is to wrap between -Wl,--no-as-needed -lgtest -Wl,--as-needed
 causing it to be added again. This is only needed on linux, since that
 the only platform that we use -Wl,--as-needed on. Moreover, we can just
 set GOOGLEMOCK_LIBRARIES to gmock -Wl,--no-as-needed gtest -Wl,--as-needed
 since that is only passed to TARGET_LINK_LIBRARIES which only adds -l
 in front of 'things' that don't start with '-', to allow you do pass
 special flags like this.
 
 
 This addresses bug VWR-24366.
 http://jira.secondlife.com/browse/VWR-24366
 
 
 Diffs
 -
 
   doc/contributions.txt 422f636c3343 
   indra/cmake/GoogleMock.cmake 422f636c3343 
   indra/cmake/LLAddBuildTest.cmake 422f636c3343 
 
 Diff: http://codereview.secondlife.com/r/95/diff
 
 
 Testing
 ---
 
 
 Thanks,
 
 Aleric
 


___
Policies and (un)subscribe information available here:
http://wiki.secondlife.com/wiki/OpenSource-Dev
Please read the policies before posting to keep unmoderated posting privileges