#245 git build on 'AT_BASE_PLATFORM'

None
closed
None
5
2014-09-11
2013-07-08
FredM
No

The build is broken on ppc64 functionality, doesn't seem usefull on arch != than ppc64 ?

/../../oprofile/libop/op_cpu_type.c:259:39: error: 'AT_BASE_PLATFORM' undeclared (first use in this function)

cat AT_BASE_PLATFORM.patch
--- /home/sah0027//oprofile/libop/op_cpu_type.c 2013-07-08 15:59:08.042966482 +0200
+++ /home/sah0027/ubuntu/worksets/5.1_build16_generic/sources/opensource/other/oprofile/vendor/oprofile.sourceforge.net/MAIN//oprofile/libop/op_cpu_type.c 2013-07-08 16:06:42.862973856 +0200
@@ -176,6 +176,7 @@ static char * _get_cpuinfo_cpu_type(char
return _get_cpuinfo_cpu_type_line(buf, len, prefix, 1);
}

+#ifdef PPC64
// The aux vector stuff below is currently only used by ppc64 arch
static ElfW(auxv_t) * auxv_buf = NULL;

@@ -221,7 +222,6 @@ static ElfW(auxv_t) * _auxv_fetch()
return (ElfW(auxv_t) *)auxv_temp;
}

-
static const char * fetch_at_hw_platform(ElfW(Addr) type)
{
int i = 0;
@@ -249,12 +249,14 @@ static void release_at_hw_platform(void)
auxv_buf = NULL;
}
}
+#endif

static op_cpu _try_ppc64_arch_generic_cpu(void)
{
- const char * platform, * base_platform;
op_cpu cpu_type = CPU_NO_GOOD;
-
+//../../oprofile/libop/op_cpu_type.c:259:39: error: 'AT_BASE_PLATFORM' undeclared (first use in this function)
+#ifdef PPC64
+ const char * platform, * base_platform;
platform = fetch_at_hw_platform(AT_PLATFORM);
base_platform = fetch_at_hw_platform(AT_BASE_PLATFORM);
if (!platform || !base_platform) {
@@ -284,6 +286,7 @@ static op_cpu _try_ppc64_arch_generic_cp
}
}
release_at_hw_platform();
+#endif
return cpu_type;
}

Related

Bugs: #245

Discussion

  • Maynard Johnson

    Maynard Johnson - 2013-07-08

    What build problem are you having, specifically? No one else has reported problems on non-ppc64 architectures. What architecture and distro are you building on?

     
  • FredM

    FredM - 2013-07-08

    I am building on a cross-toolchain mipsel-uclibc-gcc 4.5.3 , and my pc is ubuntu 12.04 64bits.

    Regards,
    Frédéric


    De : Maynard Johnson maynardj@users.sf.net
    À : [oprofile:bugs] 245@bugs.oprofile.p.re.sf.net
    Envoyé le : Lundi 8 juillet 2013 17h07
    Objet : [oprofile:bugs] #245 git build on 'AT_BASE_PLATFORM'

    What build problem are you having, specifically? No one else has reported problems on non-ppc64 architectures. What architecture and distro are you building on?


    [bugs:#245] git build on 'AT_BASE_PLATFORM'
    Status: open
    Created: Mon Jul 08, 2013 02:14 PM UTC by FredM
    Last Updated: Mon Jul 08, 2013 02:14 PM UTC
    Owner: nobody
    The build is broken on ppc64 functionality, doesn't seem usefull on arch != than ppc64 ?
    /../../oprofile/libop/op_cpu_type.c:259:39: error: 'AT_BASE_PLATFORM' undeclared (first use in this function)
    cat AT_BASE_PLATFORM.patch
    --- /home/sah0027//oprofile/libop/op_cpu_type.c 2013-07-08 15:59:08.042966482 +0200
    +++ /home/sah0027/ubuntu/worksets/5.1_build16_generic/sources/opensource/other/oprofile/vendor/oprofile.sourceforge.net/MAIN//oprofile/libop/op_cpu_type.c 2013-07-08 16:06:42.862973856 +0200
    @@ -176,6 +176,7 @@ static char * _get_cpuinfo_cpu_type(char
    return _get_cpuinfo_cpu_type_line(buf, len, prefix, 1);
    }
    +#ifdef PPC64
    // The aux vector stuff below is currently only used by ppc64 arch
    static ElfW(auxv_t) * auxv_buf = NULL;
    @@ -221,7 +222,6 @@ static ElfW(auxv_t) * _auxv_fetch()
    return (ElfW(auxv_t) *)auxv_temp;
    }
    -
    static const char * fetch_at_hw_platform(ElfW(Addr) type)
    {
    int i = 0;
    @@ -249,12 +249,14 @@ static void release_at_hw_platform(void)
    auxv_buf = NULL;
    }
    }
    +#endif
    static op_cpu _try_ppc64_arch_generic_cpu(void)
    {
    - const char * platform, * base_platform;
    op_cpu cpu_type = CPU_NO_GOOD;
    -
    +//../../oprofile/libop/op_cpu_type.c:259:39: error: 'AT_BASE_PLATFORM' undeclared (first use in this function)
    +#ifdef PPC64
    + const char * platform, * base_platform;
    platform = fetch_at_hw_platform(AT_PLATFORM);
    base_platform = fetch_at_hw_platform(AT_BASE_PLATFORM);
    if (!platform || !base_platform) {
    @@ -284,6 +286,7 @@ static op_cpu _try_ppc64_arch_generic_cp
    }
    }
    release_at_hw_platform();
    +#endif
    return cpu_type;
    }
    ________

    Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/oprofile/bugs/245/
    To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

     

    Related

    Bugs: #245

  • Maynard Johnson

    Maynard Johnson - 2013-07-09

    "AT_BASE_PLATFORM" is declared in elf.h, which is typically included with glibc-headers (in every distro I'm familiar with, anyway). I don't know what package it would be located in for your distro, do you?

     
  • Maynard Johnson

    Maynard Johnson - 2013-07-17

    Are you still having a problem? Or is it OK to close this bug?

     
  • Rafał Miłecki

    Rafał Miłecki - 2013-08-08

    I experience this bug when compiling oprofile for OpenWrt "distribution":

    mipsel-openwrt-linux-uclibc-gcc -DHAVE_CONFIG_H -I. -I..  -I../libutil  -I/home/zajec/openwrt/openwrt.git/staging_dir/target-mipsel_uClibc-0.9.33.2/usr/include -I/home/zajec/openwrt/openwrt.git/staging_dir/target-mipsel_uClibc-0.9.33.2/include -I/home/zajec/openwrt/openwrt.git/staging_dir/toolchain-mipsel_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include -I/home/zajec/openwrt/openwrt.git/staging_dir/toolchain-mipsel_gcc-4.6-linaro_uClibc-0.9.33.2/include  -W -Wall -fno-common -Wdeclaration-after-statement -Os -pipe -mips32 -mtune=mips32 -fno-caller-saves -mno-branch-likely -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float  -MT op_cpu_type.o -MD -MP -MF .deps/op_cpu_type.Tpo -c -o op_cpu_type.o op_cpu_type.c
    op_cpu_type.c: In function '_try_ppc64_arch_generic_cpu':
    op_cpu_type.c:259:39: error: 'AT_BASE_PLATFORM' undeclared (first use in this function)
    op_cpu_type.c:259:39: note: each undeclared identifier is reported only once for each function it appears in
    make[6]: *** [op_cpu_type.o] Error 1
    
     
  • Rafał Miłecki

    Rafał Miłecki - 2013-08-08

    As you can see (from my mipsel-openwrt-linux-uclibc-gcc command) my toolchain is located in:
    /home/zajec/openwrt/openwrt.git/staging_dir/toolchain-mipsel_gcc-4.6-linaro_uClibc-0.9.33.2/

    Of course in this directory there is "include/elf.h", however it doesn't contain AT_BASE_PLATFORM :(

    So if you say that the valid elf.h is supposed to be part of glibc, maybe the problem is that OpenWrt uses uClibc?
    Could you make oprofile compatible with uClibc?

    Attaching my elf.h.

     
    Attachments
  • Maynard Johnson

    Maynard Johnson - 2013-08-08

    The elf.h file attached by Rafael differs from the elf.h file I see on x86 and ppc64, which both have the following:

    ~~~~~~~~~~~~~~

    define AT_BASE_PLATFORM 24 / String identifying real platforms./

    ~~~~~~~~~~~~~~~

    AFAICT, this marcro was defined back in 2008. If you're using a recent toolchain, you could file a bug to have AT_BASE_PLATFORM added to the distro-provided elf.h. On the other hand, since this error is occurring in code that is really intended only for the ppc64 architecture, we could wrap that code in an #ifdef, using a macro that would only be defined for ppc64. I'll put something together and attach a patch to this bug.

     
    Last edit: Maynard Johnson 2013-08-08
  • Maynard Johnson

    Maynard Johnson - 2013-08-08

    Please test the attached patch with oprofile 0.9.9. Thanks.

     
  • Rafał Miłecki

    Rafał Miłecki - 2013-08-08

    I compared glibc to uClibc (analyzed sources):

    > find ./glibc-2.17/ -name elf.h
    ./glibc-2.17/include/elf.h
    ./glibc-2.17/ports/sysdeps/unix/sysv/linux/aarch64/sys/elf.h
    ./glibc-2.17/ports/sysdeps/unix/sysv/linux/arm/sys/elf.h
    ./glibc-2.17/sysdeps/unix/sysv/linux/s390/sys/elf.h
    ./glibc-2.17/sysdeps/unix/sysv/linux/x86/sys/elf.h
    ./glibc-2.17/elf/elf.h
    
    > find ./glibc-2.17/ -name elf.h -exec grep -H "AT_BASE_PLATFORM" {} \;
    ./glibc-2.17/elf/elf.h:#define AT_BASE_PLATFORM 24              /* String identifying real platforms.*/
    
    > find ./uClibc-0.9.33.2/ -name elf.h
    ./uClibc-0.9.33.2/libc/sysdeps/linux/arm/sys/elf.h
    ./uClibc-0.9.33.2/libc/sysdeps/linux/i386/sys/elf.h
    ./uClibc-0.9.33.2/libc/sysdeps/linux/avr32/sys/elf.h
    ./uClibc-0.9.33.2/libc/sysdeps/linux/bfin/sys/elf.h
    ./uClibc-0.9.33.2/include/elf.h
    
    > find ./uClibc-0.9.33.2/ -name elf.h -exec grep -H "AT_BASE_PLATFORM" {} \;
    

    So yeah, the problem seems to be uClibc related.

     
  • Rafał Miłecki

    Rafał Miłecki - 2013-08-08

    @Maynard: this patch does the trick for me, thanks!

     
  • Rafał Miłecki

    Rafał Miłecki - 2013-08-08

    @Maynard: do you think we could try some alternative solution like a
    #ifndef AT_BASE_PLATFORM
    #define AT_BASE_PLATFORM 24
    #endif
    ?

    I also reported elf.h problem to the uClibc team:
    http://lists.uclibc.org/pipermail/uclibc/2013-August/047884.html

     
    • Maynard Johnson

      Maynard Johnson - 2013-08-09

      There's nothing prohibiting uClibc (or glibc, for that matter) assigning '24' to some other macro, since the values corresponding to the macros are implementation details that user code should never rely on. So, no -- I don't want to get in the middle of #define'ing ELF macros. Is there some reason you prefer such a solution over the patch I provided (other than it's simplicity)?

       
      • Rafał Miłecki

        Rafał Miłecki - 2013-08-09

        Absolutely not, I was just hacking around without full understanding on that, sorry.

        I'm OK with your solution.

         
  • Maynard Johnson

    Maynard Johnson - 2013-08-13

    FredM, as originator of this bug, it would be ideal if you could test the attached patch, too. Thanks.

     
  • FredM

    FredM - 2013-08-14

    Hi

    If it helps...  The 2 patches compile on my side.

    with the second one :

    opcontrol --init

    oprofile: using mips/bmips5000 performance monitoring.
    cpu_type 'unset' is not valid
    you should upgrade oprofile or force the use of timer mode

    I add oprofile.timer=1 the in the command line,

    and it works...

    Regards,

    Frédéric


    De : Maynard Johnson maynardj@users.sf.net
    À : [oprofile:bugs] 245@bugs.oprofile.p.re.sf.net
    Envoyé le : Mardi 13 août 2013 18h49
    Objet : [oprofile:bugs] #245 git build on 'AT_BASE_PLATFORM'

    FredM, as originator of this bug, it would be ideal if you could test the attached patch, too. Thanks.


    [bugs:#245] git build on 'AT_BASE_PLATFORM'
    Status: open
    Created: Mon Jul 08, 2013 02:14 PM UTC by FredM
    Last Updated: Thu Aug 08, 2013 09:21 PM UTC
    Owner: nobody
    The build is broken on ppc64 functionality, doesn't seem usefull on arch != than ppc64 ?
    /../../oprofile/libop/op_cpu_type.c:259:39: error: 'AT_BASE_PLATFORM' undeclared (first use in this function)
    cat AT_BASE_PLATFORM.patch
    --- /home/sah0027//oprofile/libop/op_cpu_type.c 2013-07-08 15:59:08.042966482 +0200
    +++ /home/sah0027/ubuntu/worksets/5.1_build16_generic/sources/opensource/other/oprofile/vendor/oprofile.sourceforge.net/MAIN//oprofile/libop/op_cpu_type.c 2013-07-08 16:06:42.862973856 +0200
    @@ -176,6 +176,7 @@ static char * _get_cpuinfo_cpu_type(char
    return _get_cpuinfo_cpu_type_line(buf, len, prefix, 1);
    }
    +#ifdef PPC64
    // The aux vector stuff below is currently only used by ppc64 arch
    static ElfW(auxv_t) * auxv_buf = NULL;
    @@ -221,7 +222,6 @@ static ElfW(auxv_t) * _auxv_fetch()
    return (ElfW(auxv_t) *)auxv_temp;
    }
    -
    static const char * fetch_at_hw_platform(ElfW(Addr) type)
    {
    int i = 0;
    @@ -249,12 +249,14 @@ static void release_at_hw_platform(void)
    auxv_buf = NULL;
    }
    }
    +#endif
    static op_cpu _try_ppc64_arch_generic_cpu(void)
    {
    - const char * platform, * base_platform;
    op_cpu cpu_type = CPU_NO_GOOD;
    -
    +//../../oprofile/libop/op_cpu_type.c:259:39: error: 'AT_BASE_PLATFORM' undeclared (first use in this function)
    +#ifdef PPC64
    + const char * platform, * base_platform;
    platform = fetch_at_hw_platform(AT_PLATFORM);
    base_platform = fetch_at_hw_platform(AT_BASE_PLATFORM);
    if (!platform || !base_platform) {
    @@ -284,6 +286,7 @@ static op_cpu _try_ppc64_arch_generic_cp
    }
    }
    release_at_hw_platform();
    +#endif
    return cpu_type;
    }
    ________

    Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/oprofile/bugs/245/
    To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

     

    Related

    Bugs: #245

  • Maynard Johnson

    Maynard Johnson - 2013-08-14

    Patch committed. Thanks for reporting the bug.

     
  • Maynard Johnson

    Maynard Johnson - 2013-08-14
    • status: open --> open-fixed
    • Group: -->
     
  • Maynard Johnson

    Maynard Johnson - 2013-10-09
    • assigned_to: Maynard Johnson
     
  • Maynard Johnson

    Maynard Johnson - 2014-09-11
    • Status: open-fixed --> closed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks