Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unittest compile error #102

Open
GoogleCodeExporter opened this issue Aug 4, 2015 · 4 comments
Open

unittest compile error #102

GoogleCodeExporter opened this issue Aug 4, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

hello,

i've been trying to compile unittests;


..
Checked out external at revision 146.

Checked out revision 4197.
acer@acer-AOD255 ~/courses/58q/project $ cd tsan_test/unittest
acer@acer-AOD255 ~/courses/58q/project/tsan_test/unittest $ make
make all OS=linux ARCH=amd64
make[1]: Entering directory `/home/acer/courses/58q/project/tsan_test/unittest'
mkdir -p bin
g++ -g -O0 -m64 -Wall -Werror -Wno-sign-compare -Wshadow -Wno-unused-function 
-std=c++0x -DOS_linux -DARCH_amd64  \
         -I../dynamic_annotations -I../third_party/googletest/include -I. \
         -DDYNAMIC_ANNOTATIONS_ENABLED=1 -c racecheck_unittest.cc -obin/racecheck_unittest-linux-amd64-O0.o
racecheck_unittest.cc: In member function ‘virtual void 
StressTests_ManyLockSetsTest::StressTests_EvenMoreLockSetsTest_Test::TestBody()�
��:
racecheck_unittest.cc:1487:36: error: cast to pointer from integer of different 
size [-Werror=int-to-pointer-cast]
racecheck_unittest.cc: In function ‘void NegativeTests_Strlen::WorkerX()’:
racecheck_unittest.cc:3177:3: error: passing NULL to non-pointer argument 3 of 
‘static testing::AssertionResult 
testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, 
T2*) [with T1 = long int, T2 = char]’ [-Werror=conversion-null]
racecheck_unittest.cc:3177:3: error: passing NULL to non-pointer argument 3 of 
‘static testing::AssertionResult 
testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, 
T2*) [with T1 = long int, T2 = char]’ [-Werror=conversion-null]
racecheck_unittest.cc:3181:3: error: passing NULL to non-pointer argument 3 of 
‘static testing::AssertionResult 
testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, 
T2*) [with T1 = long int, T2 = char]’ [-Werror=conversion-null]
racecheck_unittest.cc:3181:3: error: passing NULL to non-pointer argument 3 of 
‘static testing::AssertionResult 
testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, 
T2*) [with T1 = long int, T2 = char]’ [-Werror=conversion-null]
racecheck_unittest.cc:3189:3: error: passing NULL to non-pointer argument 3 of 
‘static testing::AssertionResult 
testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, 
T2*) [with T1 = long int, T2 = char]’ [-Werror=conversion-null]
racecheck_unittest.cc:3189:3: error: passing NULL to non-pointer argument 3 of 
‘static testing::AssertionResult 
testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, 
T2*) [with T1 = long int, T2 = char]’ [-Werror=conversion-null]
racecheck_unittest.cc:3220:3: error: passing NULL to non-pointer argument 3 of 
‘static testing::AssertionResult 
testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, 
T2*) [with T1 = long int, T2 = char]’ [-Werror=conversion-null]
racecheck_unittest.cc:3220:3: error: passing NULL to non-pointer argument 3 of 
‘static testing::AssertionResult 
testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, 
T2*) [with T1 = long int, T2 = char]’ [-Werror=conversion-null]
racecheck_unittest.cc: In member function ‘virtual void 
NegativeTests_Strlen::NegativeTests_StrlenAndFriends_Test::TestBody()’:
racecheck_unittest.cc:3255:3: error: passing NULL to non-pointer argument 3 of 
‘static testing::AssertionResult 
testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, 
T2*) [with T1 = long int, T2 = char]’ [-Werror=conversion-null]
racecheck_unittest.cc:3255:3: error: passing NULL to non-pointer argument 3 of 
‘static testing::AssertionResult 
testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, 
T2*) [with T1 = long int, T2 = char]’ [-Werror=conversion-null]
racecheck_unittest.cc:3272:3: error: passing NULL to non-pointer argument 3 of 
‘static testing::AssertionResult 
testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, 
T2*) [with T1 = long int, T2 = char]’ [-Werror=conversion-null]
racecheck_unittest.cc:3272:3: error: passing NULL to non-pointer argument 3 of 
‘static testing::AssertionResult 
testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, 
T2*) [with T1 = long int, T2 = char]’ [-Werror=conversion-null]
racecheck_unittest.cc: In function ‘void 
LibcStringFuncitonsTests::CheckStrrchrResult()’:
racecheck_unittest.cc:8359:3: error: passing NULL to non-pointer argument 3 of 
‘static testing::AssertionResult 
testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, 
T2*) [with T1 = long int, T2 = char]’ [-Werror=conversion-null]
racecheck_unittest.cc:8359:3: error: passing NULL to non-pointer argument 3 of 
‘static testing::AssertionResult 
testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, 
T2*) [with T1 = long int, T2 = char]’ [-Werror=conversion-null]
cc1plus: all warnings being treated as errors

make[1]: *** [bin/racecheck_unittest-linux-amd64-O0.o] Error 1
make[1]: Leaving directory `/home/acer/courses/58q/project/tsan_test/unittest'
make: *** [l64] Error 2
acer@acer-AOD255 ~/courses/58q/project/tsan_test/unittest $ uname -a
Linux acer-AOD255 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 
x86_64 x86_64 x86_64 GNU/Linux
acer@acer-AOD255 ~/courses/58q/project/tsan_test/unittest $ gcc --version
gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


i have also tried get_and_build_tsan.sh script following 
"http://code.google.com/p/data-race-test/wiki/BuildingThreadSanitizer", same 
errors. any ideas?

Original issue reported on code.google.com by [email protected] on 15 Apr 2012 at 3:20

@GoogleCodeExporter
Copy link
Author

Looks like the googletest revision we're using is not compileable with gcc 4.6 
bundled with the Ubuntu you're using (is it 12.04?).

Possible solutions:
1) Do `svn up ../third_party/googletest` to update googletest to the most 
recent revision (may break some other things)
2) Disable `-Werror=conversion-null` gcc option with CFLAGS=...

Original comment by timurrrr on 16 Apr 2012 at 8:32

@GoogleCodeExporter
Copy link
Author

mint 12 (ubuntu 11.10)

tried g++-4.5 (4.5.3) -> no luck..
tried g++-4.4 (4.4.6) -> seems to be working
(changed from '../common.mk')

(4.4 and 4.5 binaries available in ubuntu repo along with respective multilibs)

thanks

Original comment by [email protected] on 16 Apr 2012 at 7:00

@GoogleCodeExporter
Copy link
Author

I have tried to update the google test but only using g++4.4 solved the problem

Original comment by [email protected] on 2 Aug 2013 at 6:23

@GoogleCodeExporter
Copy link
Author

Thank you!

Original comment by [email protected] on 2 Aug 2013 at 6:24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant