clm971910 / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

gtest doesn't build inside Native Client #329

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Attempt to build gtest using the Native Client toolchain.  (See 
http://code.google.com/p/nativeclient/)

What is the expected output?

gtest builds and links.

What do you see instead?

gtest fails to build and link.

What version of Google Test are you using?

Top-of-tree.

On what operating system?

Mac OS X

Here is the patch to fix the issue:

diff --git a/testing/gtest/include/gtest/internal/gtest-port.h 
b/testing/gtest/include/gtest/internal/gtest-port.h
index a9c7cae..a8c24ec 100644
--- a/testing/gtest/include/gtest/internal/gtest-port.h
+++ b/testing/gtest/include/gtest/internal/gtest-port.h
@@ -222,6 +222,8 @@
 #endif  // _WIN32_WCE
 #elif defined __APPLE__
 #define GTEST_OS_MAC 1
+#elif defined __native_client__
+#define GTEST_OS_NACL 1
 #elif defined __linux__
 #define GTEST_OS_LINUX 1
 #elif defined __MVS__
@@ -240,7 +242,9 @@
 // is not the case, we need to include headers that provide the functions
 // mentioned above.
 #include <unistd.h>
+#if !GTEST_OS_NACL
 #include <strings.h>
+#endif
 #elif !GTEST_OS_WINDOWS_MOBILE
 #include <direct.h>
 #include <io.h>
diff --git a/testing/gtest/src/gtest-filepath.cc 
b/testing/gtest/src/gtest-filepath.cc
index 96557f3..118848a 100644
--- a/testing/gtest/src/gtest-filepath.cc
+++ b/testing/gtest/src/gtest-filepath.cc
@@ -39,8 +39,8 @@
 #elif GTEST_OS_WINDOWS
 #include <direct.h>
 #include <io.h>
-#elif GTEST_OS_SYMBIAN
-// Symbian OpenC has PATH_MAX in sys/syslimits.h
+#elif GTEST_OS_SYMBIAN || GTEST_OS_NACL
+// Symbian OpenC and NaCl have PATH_MAX in sys/syslimits.h
 #include <sys/syslimits.h>
 #else
 #include <limits.h>

Original issue reported on code.google.com by abarth@chromium.org on 13 Nov 2010 at 6:24

GoogleCodeExporter commented 9 years ago
BTW, that patch is written by Eric Seidel and licensed to you under whatever 
license you want.

Original comment by abarth@chromium.org on 13 Nov 2010 at 6:25

GoogleCodeExporter commented 9 years ago
Yup.  It's public domain as far as I'm concerned. :)

Original comment by macd...@gmail.com on 13 Nov 2010 at 6:28

GoogleCodeExporter commented 9 years ago
Re-affirmation of public-domain-ness from my @chromium account. :)  Heck, it 
just falls under the Google copyright anyway.

Original comment by esei...@chromium.org on 13 Nov 2010 at 6:36

GoogleCodeExporter commented 9 years ago

Original comment by vladlosev on 13 Nov 2010 at 6:53

GoogleCodeExporter commented 9 years ago
Fixed in revision 524.

Original comment by vladlosev on 30 Nov 2010 at 10:12