Re: building tog-pegasus for ARM on Fedora 19

David Marlin <[email protected]> Mon, 29 Apr 2013 12:16:07 -0500
Newsgroups gmane.network.open-pegasus.general
Organization Red Hat
Message-ID <[email protected]>
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/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],          
>              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
> 
> 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)