You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "David Reiss (JIRA)" <ji...@apache.org> on 2008/11/25 00:37:44 UTC

[jira] Commented: (THRIFT-214) PosixThreadFactory.cpp fails 64 bit compile with gcc on Mac OS X 10.5

    [ https://issues.apache.org/jira/browse/THRIFT-214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12650384#action_12650384 ] 

David Reiss commented on THRIFT-214:
------------------------------------

What g++ version are you using?  I'm confused as to why this doesn't happen on FreeBSD, which also uses a pointer type for pthread_t.

Unfortunately, we cannot use a reinterpret cast here because Linux uses an integer type for pthread_t and reinterpret_cast cannot be used for casting between integer types, even if they are the exact same type, as they are in this case.  I thought that a C-style cast would work in all cases based on <http://www.open-std.org/jtc1/sc22/open/n2356/expr.html#expr.cast>, but I guess not.  I don't really understand how the cast in this case can be "interpreted" as a static_cast or const_cast, but I guess that what is going on, otherwise the compiler should try to treat it as a reinterpret_cast.  Do you know what type _opaque_pthread_t is?

I had a plan to create a templated function that would reinterpret_cast pointers but static_cast integers.  I guess I'll have to do it after all.

> PosixThreadFactory.cpp fails 64 bit compile with gcc on Mac OS X 10.5
> ---------------------------------------------------------------------
>
>                 Key: THRIFT-214
>                 URL: https://issues.apache.org/jira/browse/THRIFT-214
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>         Environment: Mac Os X 10.5 compiling for 64 bit
>            Reporter: Rush Manbert
>         Attachments: patch.txt
>
>
> We are building quad libraries for the Mac. (32/64 bit PPC/Intel)
> Project was configure this way:
> CFLAGS: -g  -O0  -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -arch i386 -arch x86_64 -arch ppc -arch ppc64  -fvisibility=hidden -DYYLMAX=1048576
> CPPFLAGS: 
> CXXFLAGS: -g  -O0  -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -arch i386 -arch x86_64 -arch ppc -arch ppc64  -fvisibility=hidden -DYYLMAX=1048576 -fvisibility-inlines-hidden
> LDFLAGS:  -syslibroot,/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -arch i386 -arch x86_64 -arch ppc -arch ppc64  -Wl,-dead_strip -no_dead_strip_inits_and_terms -Wl,-search_paths_first 
> CONFIGURE_OPTIONS: --without-java --without-py --without-ruby --with-boost=/Users/rmanbert/development/trunkHead/client/thirdPartyLibs/sources/thrift/SUBSYS_TOP/thirdPartyLibs/installedMac/individual/boost --with-zlib=/Users/rmanbert/development/trunkHead/client/thirdPartyLibs/sources/thrift/SUBSYS_TOP/thirdPartyLibs/installedMac/individual/zlib/Debug --with-libevent=/Users/rmanbert/development/trunkHead/client/thirdPartyLibs/sources/thrift/SUBSYS_TOP/thirdPartyLibs/installedMac/individual/libevent/Debug --disable-dependency-tracking --enable-static --disable-shared --enable-debug --prefix=/Users/rmanbert/development/trunkHead/client/thirdPartyLibs/sources/thrift/SUBSYS_TOP/thirdPartyLibs/installedMac/individual/thrift/Debug
> The compile command line and error output is:
>  g++ -DHAVE_CONFIG_H -I. -I../.. -I/Users/rmanbert/development/trunkHead/client/thirdPartyLibs/sources/thrift/lib/cpp -I/Users/rmanbert/development/trunkHead/client/thirdPartyLibs/sources/thrift/SUBSYS_TOP/thirdPartyLibs/installedMac/individual/boost/include -I/Users/rmanbert/development/trunkHead/client/thirdPartyLibs/sources/thrift/lib/cpp/src -Wall -g -O0 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -arch i386 -arch x86_64 -arch ppc -arch ppc64 -fvisibility=hidden -DYYLMAX=1048576 -fvisibility-inlines-hidden -c /Users/rmanbert/development/trunkHead/client/thirdPartyLibs/sources/thrift/lib/cpp/src/concurrency/PosixThreadFactory.cpp -o PosixThreadFactory.o
> /Users/rmanbert/development/trunkHead/client/thirdPartyLibs/sources/thrift/lib/cpp/src/concurrency/PosixThreadFactory.cpp: In member function 'uint64_t facebook::thrift::concurrency::PosixThreadFactory::Impl::getCurrentThreadId() const':
> /Users/rmanbert/development/trunkHead/client/thirdPartyLibs/sources/thrift/lib/cpp/src/concurrency/PosixThreadFactory.cpp:273: error: cast from '_opaque_pthread_t*' to 'id_t' loses precision
> /Users/rmanbert/development/trunkHead/client/thirdPartyLibs/sources/thrift/lib/cpp/src/concurrency/PosixThreadFactory.cpp: In member function 'uint64_t facebook::thrift::concurrency::PosixThreadFactory::Impl::getCurrentThreadId() const':
> /Users/rmanbert/development/trunkHead/client/thirdPartyLibs/sources/thrift/lib/cpp/src/concurrency/PosixThreadFactory.cpp:273: error: cast from '_opaque_pthread_t*' to 'id_t' loses precision

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.