Re: building tog-pegasus for ARM on Fedora 19

David Marlin <[email protected]> Mon, 29 Apr 2013 18:06:12 -0500
Newsgroups gmane.network.open-pegasus.general
Organization Red Hat
Message-ID <[email protected]>
Devchandra L Meetei wrote:
>  >>..Would a patch that only used these operations for gcc-4.7+ be an 
> acceptable solution?  If so, would you prefer it apply to all 
> architectures (that use gcc-4.7+) or only ARM?
> Yes, definitely, We would be happy. <<<<
> 
> An ideal patch will be one which is gcc version agnostic. A patch which 
> would work with all versions( gcc 4.7 and above and lesser also) will be 
> ideal.

Unfortunately, these built-in atomic operations are relatively new to 
gcc, so the best I could come up with is to use them only for gcc-4.7 
and above, and use the existing platform-specific atomic operations for 
all older versions.

> As most of the pegasus developer works with gcc which come with RHEL or 
> SLES which is usually gcc 4.4, we miss this earlier.
> 
> Thanks for initiating this,
>  
> Have opened a bug to track this
> http://bugzilla.openpegasus.org/show_bug.cgi?id=9646

Thank you for creating the BZ entry.

> as I did not find your name in the registered user list, Could not add 
> you in the bugzilla, :)

I am now registered, and have updated the BZ with a revised patch. 
Please let me know if this is a more acceptable option.


Thank you,

d.marlin
===========

>  
> 
> 
> On Mon, Apr 29, 2013 at 10:46 PM, David Marlin <[email protected] 
> <mailto:[email protected]>> wrote:
> 
> 
>     Ashok K Pathak wrote:
> 
>         Thanks for patch and write to OpenPegasus Community.
> 
> 
>     Thank you for reviewing the patch.
> 
> 
>         In think to make it easy to write proratable code that will work for
>         different version of  GCC , we generally use  GCC_VERSION macro
>         that  was
>         defined  in Pegasus/Common/Config.h
> 
>         as
> 
>         #if defined(__GNUC__)
>         #define GCC_VERSION (__GNUC__ * 10000 \
>                                        + __GNUC_MINOR__ * 100 \
>                                        + __GNUC_PATCHLEVEL__)
> 
> 
>         & use below idiom to take advantage of the GCC version that will
>         provide
>         better API  to write better code
> 
>         //test for version for GCC > 4.4.0
> 
>         #if defined(__GNUC__) && GCC_VERSION >= 40400
> 
>         Looking the below links I have different perception regarding   GCC
>         vesrsion in which  atomic_*  are available.
> 
>         __atomic_*  (http://gcc.gnu.org/wiki/__Atomic/GCCMM
>         <http://gcc.gnu.org/wiki/Atomic/GCCMM>)
> 
>         http://gcc.gnu.org/gcc-4.7/__changes.html
>         <http://gcc.gnu.org/gcc-4.7/changes.html>
>         Support for atomic operations specifying the C++11/C11 memory
>         model has
>         been added. These new __atomic routines replace the existing __sync
>         built-in routines.
>         <<<
> 
>          .
>         I have taken the latest Pegasus code and applied the patch . I
>         tried to
>         build  the code and get the following  build error
>         (PEGASUS_PLATFORM_LINUX___GENERIC_GNU)
> 
>         g++ -c -o
>         /home/ashokpathak/latest/__pegasus/obj/Pegasus/Common/__SCMO.o -W
>         -Wall -Wno-unused -Wunused-variable -Werror=unused-variable
>         -D_GNU_SOURCE
>         -DTHREAD_SAFE -D_REENTRANT -g -m64 -fvisibility=hidden -fPIC
>         -DPEGASUS_COMMON_INTERNAL -DPEGASUS_INTERNALONLY
>         -DPEGASUS_PLATFORM_LINUX___GENERIC_GNU
>         -DPEGASUS_PLATFORM_LINUX_X86___64_GNU
>         -DPEGASUS_USE_SYSLOGS -DPEGASUS_ARCH_LIB=\"lib\"
>         -DPEGASUS_ENABLE_CQL
>         -DPEGASUS_DEFAULT_ENABLE_OOP -DPEGASUS_DISABLE_EXECQUERY
>         -DPEGASUS_HAS_SSL
>         -DPEGASUS_SSL_RANDOMFILE -DPEGASUS_ENABLE_SSL_CRL___VERIFICATION
>         -DPEGASUS_ENABLE_AUDIT_LOGGER -DPEGASUS_ENABLE_IPV6
>         -DPEGASUS_ENABLE_INDICATION___COUNT
>         -DPEGASUS_ENABLE_DMTF___INDICATION_PROFILE_SUPPORT
>         -DPEGASUS_ENABLE_INDICATION___ORDERING
>         -DPEGASUS_ENABLE_INTEROP___PROVIDER
>         -DPEGASUS_DEBUG -DPEGASUS_USE_EXPERIMENTAL___INTERFACES
>         -DPEGASUS_USE_DEPRECATED___INTERFACES
>         -DPEGASUS_ENABLE_CMPI___PROVIDER_MANAGER
>         -DPEGASUS_DEST_LIB_DIR=\"lib\" -DPEGASUS_ENABLE_PROTOCOL___WSMAN
>         -DPEGASUS_EXTRA_PROVIDER_LIB___DIR=\"\"
>         -DPLATFORM_COMPONENT_NAME=\"__pegcommon
>         \"  -I/home/ashokpathak/latest/__pegasus/src  SCMO.cpp
> 
>         ’:
>         /home/ashokpathak/latest/__pegasus/src/Pegasus/Common/__AtomicInt.h:126:
>         error:
>         ‘__ATOMIC_SEQ_CST’ was not declared in this scope
>         /home/ashokpathak/latest/__pegasus/src/Pegasus/Common/__AtomicInt.h:126:
>         error:
>         ‘__atomic_store_n’ was not declared in this scope
>         /home/ashokpathak/latest/__pegasus/src/Pegasus/Common/__AtomicInt.h:
>         In member
>         function ‘Pegasus::Uint32
>         Pegasus::AtomicIntTemplate<__ATOMIC_TYPE>::get()
>         const [with ATOMIC_TYPE = Pegasus::AtomicType]’:
>         /home/ashokpathak/latest/__pegasus/src/Pegasus/Common/__AtomicInt.h:137:
>         error:
>         ‘__ATOMIC_SEQ_CST’ was not declared in this scope
>         /home/ashokpathak/latest/__pegasus/src/Pegasus/Common/__AtomicInt.h:137:
>         error:
>         ‘__atomic_load_n’ was not declared in this scope
>         /home/ashokpathak/latest/__pegasus/src/Pegasus/Common/__AtomicInt.h:
>         In member
>         function ‘void Pegasus::AtomicIntTemplate<__ATOMIC_TYPE>::set
>         (Pegasus::Uint32) [with ATOMIC_TYPE = Pegasus::AtomicType]’:
>         /home/ashokpathak/latest/__pegasus/src/Pegasus/Common/__AtomicInt.h:143:
>         error:
>         ‘__ATOMIC_SEQ_CST’ was not declared in this scope
>         /home/ashokpathak/latest/__pegasus/src/Pegasus/Common/__AtomicInt.h:143:
>         error:
>         ‘__atomic_store_n’ was not declared in this scope
>         /home/ashokpathak/latest/__pegasus/src/Pegasus/Common/__AtomicInt.h:
>         In member
>         function ‘void Pegasus::AtomicIntTemplate<__ATOMIC_TYPE>::inc()
>         [with
>         ATOMIC_TYPE = Pegasus::AtomicType]’:
>         .....
>         ...
> 
>         make[3]: Leaving directory
>         `/home/ashokpathak/latest/__pegasus/src/Pegasus/Common'
> 
>         <<<<
> 
>         Using gcc version 4.4.6
> 
>          &
> 
>         Red Hat Enterprise Linux Workstation release 6.3 (Santiago)
>         Kernel \r on an \m
> 
>         Let me know if I misunderstood it.
> 
> 
>     I think you are correct.  I was initially trying to use the __sync_*
>     built-in atomic operations (available in gcc-4.1), but they were
>     lacking some functionality, and did not verify the the version when
>     I switched to __atomic_*.  I apologize for the confusion.
> 
>     Would a patch that only used these operations for gcc-4.7+ be an
>     acceptable solution?  If so, would you prefer it apply to all
>     architectures (that use gcc-4.7+) or only ARM?
> 
>     If this would be acceptable, I will rewrite the patch and submit the
>     new version for review.  Please let me know how I should proceed.
> 
> 
>     Thank you,
> 
>     d.marlin
>     ============
> 
> 
> 
> 
> 
>         Regards
>         Ashok
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>                                                                        
>                                 "David A. Marlin"                      
>                                            <[email protected]            
>                                                      om>                
>                                                To                      
>                          [email protected]
>         <mailto:[email protected]>,                      
>         04/26/2013 10:22                                           cc  
>                    PM                                                  
>                                                                        
>                     Subject                                      
>          building tog-pegasus for ARM on                                
>                    Fedora 19                                            
>                                                                        
>                                                                        
>                                                                        
>                                                                        
>                                                                        
>                                                                        
>                                                        
> 
> 
> 
> 
>         tog-pegasus-2.2.3-4 fails to build successfully for ARM on
>         Fedora 19.  It
>         is based on pegasus-2.12.1.  The failure is due to failing test
>         cases which
>         uses atomic operations for synchronization (Tracer).  The atomic
>         operation
>         code indicates it is for XScale, which is an older ARM platform.
> 
>         To address this, I replaced the platform-specific code with GCC
>         built-in
>         atomic operations (libatomic).
> 
>          
>          http://gcc.gnu.org/onlinedocs/__gcc/_005f_005fatomic-Builtins.__html
>         <http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html>
> 
>         This worked for ARM, so since this was architecture-neutral code
>         I combined
>         x86 and ARM to use the same (new) code.  This also passed on ARM and
>         x86_64.  In theory it should work for other architectures as
>         well, but I
>         don't have access to test.  The only restriction is that it
>         requires a
>         recent version of GCC (4.1 or newer).
> 
>         Attached is the patch I used to make these changes.  Please let
>         me know if
>         this is an acceptable approach.
> 
> 
>         Thank you,
> 
>         d.marlin
>         (See attached file: tog-pegasus-arm.patch)
> 
> 
> 
> 
> 
> -- 
> Warm Regards
> --Dev
> OpenPegasus Developer/Committer
> 
> (\__/)
> (='.'=) This is Bunny. Copy and paste bunny
> (")_(") to help him gain world domination.