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

1.5.0 (pre) doesn't compile by default with Sun Studio 12.1 on Solaris #278

Closed
GoogleCodeExporter opened this issue Jul 28, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link
Contributor


What steps will reproduce the problem?
1. Get the Subversion source for 1.5.0 (rev 417)
2. Install Sun Studio 12.1 for OpenSolaris
3. Set BASH environment "export CC=cc CXX=CC" (make sure cc and CC point to
SunStudio C and C++)
4. In the gtest source directory, type 'cmake .'

What is the expected output? What do you see instead?
This is supposed to run.  Instead, it gives the following compilation error
(summarized):

".../include/gtest/internal/gtest-param-util-generated.h", line 61: Error:
iterator_traits is not a member of std
...
".../include/gtest/gtest-param-test.h", line 279: Error: iterator_traits is
not a member of std.


What version of Google Test are you using? On what operating system?
gtest subversion 143 (1.5.0 pre) on OpenSolaris snv_134 (2010.3 pre)

Please provide any additional information below, such as a code snippet.

It appears that the problem is that gtest now uses the 'iterator_traits'
STL feature.  By default, this is not enabled in Sun Studio because of
backwards compatibility issues.  

As a work-around, it is possible to use the '-library=stlport4' CXXFLAG to
tell Sun Studio to enable iterator_traits:

 export CC=cc CXX=CC CXXFLAGS='-library=stlport4'
 cmake .

After making this change, gtest_unittest successfully runs 352 tests (with
13 tests disabled).

It would be much nicer if gtest could find a way to enable this by default.
 This could be done by finding a way to add the -library=stlport4 CXXFLAG
whenever the CMake or Autotools system detects that the compiler is Sun Studio.

(Note: This probably applies to all versions of Sun Studio and to Solaris 10.)

Original issue reported on code.google.com by Matthew....@gmail.com on 16 Apr 2010 at 7:28

@GoogleCodeExporter
Copy link
Contributor Author

Hady- as our Solaris expert at large, can you please comment on this bug? Do 
you see this in your setup?

Original comment by vladlosev on 16 Apr 2010 at 10:06

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Contributor Author

Well, I don't see this in my setup cause I also set -library-stlport4 in my 
CXXFLAGS...

I hesitated at first about adding the option to the CMakeLists.txt, but had 
finally 
decided that the option shouldn't be forced on the user. There are many out 
there that 
build with non-standard STLs like stlport5, stdcxx, etc...

Original comment by hady.za...@gmail.com on 19 Apr 2010 at 4:22

@GoogleCodeExporter
Copy link
Contributor Author

If there isn't a good way to make this into a code or configuration fix, could 
it be
a documentation fix?  I know Solaris isn't an officially supported target, but 
it
would still be useful to have this information readily available somehow, 
perhaps in
a README.solaris file or something, for all the Solaris users who are going to 
use
gtest anyway.

Original comment by Matthew....@gmail.com on 19 Apr 2010 at 4:51

@GoogleCodeExporter
Copy link
Contributor Author

Vlad, can we add an FAQ entry for this to the wiki?  Thanks.

Original comment by w...@google.com on 19 Apr 2010 at 9:03

  • Added labels: OpSys-Other, Type-Enhancement, Usability
  • Removed labels: Type-Defect

@GoogleCodeExporter
Copy link
Contributor Author

Matthew, what are the exact command sequences - both for CMake and for 
Autotools?

Original comment by vl...@google.com on 20 Apr 2010 at 5:09

@GoogleCodeExporter
Copy link
Contributor Author

The important part is to set the environment up:

export CC=cc CXX=CC CXXFLAGS='-library=stlport4'

After that, it's just a matter of running either cmake . or ./configure.  This 
works,
assuming that SunStudio is mapped to the cc and CC commands.

Original comment by Matthew....@gmail.com on 21 Apr 2010 at 7:41

@GoogleCodeExporter
Copy link
Contributor Author

FAQ updated in rev 419.

Original comment by vladlosev on 22 Apr 2010 at 11:02

  • Changed state: Fixed

hanneskaeufler pushed a commit to hanneskaeufler/googletest that referenced this issue Jan 6, 2023
Co-authored-by: Sahin Yort <sahin@aspect.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant