Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

compilation errors of 9.13 on Arm board

Ken Yee
2011-01-06
2013-05-28
  • Ken Yee
    Ken Yee
    2011-01-06

    FYI, I got this:

    In file included from ../../UI/Console/ExtractCallbackConsole.cpp:11:
    ../../../Windows/FileDir.h: In member function `bool
       NWindows::NFile::NDirectory::CTempDirectory::Remove()':
    ../../../Windows/FileDir.h:102: error: invalid initialization of reference of
       type 'const UString&' from expression of type 'CSysString'
    ../../../Windows/FileDir.h:44: error: in passing argument 1 of `bool
       NWindows::NFile::NDirectory::RemoveDirectoryWithSubItems(const UString&)'
    make[1]: *** [ExtractCallbackConsole.o] Error 1
    make[1]: Leaving directory `/home/kenyee/p7zip_9.13/CPP/7zip/Bundles/Alone7z'
    make: *** [7zr] Error 2
    

    Changed CTempDirectory in FileDir.h and replaced CSysString w/ UString at lines 92/94

    then I got this:

    ../../../Common/StdInStream.cpp: In member function `bool
       CStdInStream::Open(const TCHAR*)':
    ../../../Common/StdInStream.cpp:37: error: `nameWindowToUnix' undeclared (first
       use this function)
    ../../../Common/StdInStream.cpp:37: error: (Each undeclared identifier is
       reported only once for each function it appears in.)
    make[1]: *** [StdInStream.o] Error 1
    make[1]: Leaving directory `/home/kenyee/p7zip_9.13/CPP/7zip/Bundles/Alone'
    make: *** [7za] Error 2
    

    this inline function was in myWindow/myPrivate.h but this appears to be a Windows only file, so I added
    #ifdef NEED_NAME_WINDOWS_TO_UNIX
    in Common/StdInStream.cpp line 34 to get rid of the call to that function and assigned fileName to a const char*name variable.

    then finally hit this

    ../../../Windows/FileDir.cpp: In function `bool
       NWindows::NFile::NDirectory::MyRemoveDirectory(const TCHAR*)':
    ../../../Windows/FileDir.cpp:408: error: `::RemoveDirectory' undeclared (first
       use here)
    ../../../Windows/FileDir.cpp: In function `bool
       NWindows::NFile::NDirectory::CreateTempDirectory(const WCHAR*, UString&)':
    ../../../Windows/FileDir.cpp:899: error: `CTempFileW' undeclared (first use
       this function)
    ../../../Windows/FileDir.cpp:899: error: (Each undeclared identifier is
       reported only once for each function it appears in.)
    ../../../Windows/FileDir.cpp:899: error: parse error before `;' token
    ../../../Windows/FileDir.cpp:900: error: `tempFile' undeclared (first use this
       function)
    ../../../Windows/FileDir.cpp: In member function `bool
       NWindows::NFile::NDirectory::CTempDirectory::Create(const TCHAR*)':
    ../../../Windows/FileDir.cpp:923: error: cannot convert `const TCHAR*' to `
       const WCHAR*' for argument `1' to `bool
       NWindows::NFile::NDirectory::CreateTempDirectory(const WCHAR*, UString&)'
    make[1]: *** [FileDir.o] Error 1
    

    Has anyone built this for an Arm debian kernel recently?  Looks pretty broken with lots of Window'isms :-(

     
  • my p7zip
    my p7zip
    2011-01-10

    I tried to compile p7zip 9.13 with a cross-ARM-compiler, the program was successfully built.

    I tried debian ARM lenny with qemu :
    cp  makefile.linux_x86_ppc_alpha  makefile.machine
    make test

    the program built but the PPMD test failed …

    I don't have your compilation problem …

    Remark : p7zip support gcc/g++ 2.95 or over.
    try "gcc -v" to see the version of your gcc/g++

    Remark 2 : makefile.linux_x86_ppc_alpha should be something like makefile.linux_all_cpu

     
  • Igor Pavlov
    Igor Pavlov
    2011-01-10

    So do you have problem with PPMD only on ARM?
    And it works OK for other platforms?

     
  • my p7zip
    my p7zip
    2011-01-10

    My tests pass on these platforms:
    - linux x86 or amd64
    - OSX x86
    - OSX PPC

    I think that my "PPMD" test failed because with qemu, I can only have 256MB …

    So I made PPMD with a 32MB dictionnary, and now p7zip raises a floating point exception !?
    The debugger does not show me where this exception is raised …

     
  • Igor Pavlov
    Igor Pavlov
    2011-01-11

    You can try to work with very small dictionary (several KBs), and small DATA file for test.

    What about ARM at
    http://gcc.gnu.org/wiki/CompileFarm
    Does it work there?

    PPMD doesn't use floating point.
    The possible bad thing at ARM is unaligned access to memory.
    You can check sizeof of the following structures:
    typedef struct
    {
      UInt16 Summ; /* Freq */
      Byte Shift;  /* Speed of Freq change; low Shift is for fast change */
      Byte Count;  /* Count to next change of Shift */
    } CPpmd_See;

    typedef struct
    {
      Byte Symbol;
      Byte Freq;
      UInt16 SuccessorLow;
      UInt16 SuccessorHigh;
    } CPpmd_State;

    Also you can try to comment the line
      #define PPMD_32BIT

     
  • my p7zip
    my p7zip
    2011-01-11

    typedef struct
    {
    UInt16 Summ; /* Freq */
    Byte Shift;  /* Speed of Freq change; low Shift is for fast change */
    Byte Count;  /* Count to next change of Shift */
    } CPpmd_See;

    typedef struct
    {
    UInt16 Summ; /* Freq */
    UInt16 Summ2;
    } CPpmd_See2;

    typedef struct
    {
    Byte Symbol;
    Byte Freq;
    UInt16 SuccessorLow;
    UInt16 SuccessorHigh;
    } CPpmd_State;

    typedef struct
    {

    UInt16 SuccessorLow;
    UInt16 SuccessorHigh;
      Byte Symbol;
    Byte Freq;

    } CPpmd_State2;

    typedef struct
    {
    UInt16 foobar;
    UInt16 SuccessorLow;
    UInt16 SuccessorHigh;

    } CPpmd_State3;

    sizeof CPpmd_See = 4   OK
    sizeof CPpmd_State = 8 BAD  (should be 6 ?)
    sizeof CPpmd_State2 = 8  BAD

    but

    sizeof CPpmd_See2 = 4   OK
    sizeof CPpmd_State3 = 8  BAD

    really strange …

    I did not see any gcc flag to change this strange behaviour …

    Any idea ?

    to change the PPMD code ?

     
  • Igor Pavlov
    Igor Pavlov
    2011-01-11

    Try to add
    #pragma pack(1)

     
  • mik
    mik
    2011-01-11

    It looks as  if -mstructure-size-boundary=32.

     
  • my p7zip
    my p7zip
    2011-01-13

    I tried #pragma pack(1) and now PPMD in 7za works.

    I did not try -mstructure-size-boundary because I don't want to change globally the alignment of structures.

    All my 7za basic tests pass.

    I can compile 7z and 7z.so but 7z always crashes (SIGSEGV)
    in a CreateArc.
    I tried "7z t sample.7z" and 7z crashes in CreateArc in 7zRegister.cpp
    I tried "7z t sample.tar" and 7z crashes in CreateArc in TarRegister.cpp

    I tried a really simple sample (without  p7zip code) with dlopen and a dynamic library and this test passes.

    Any idea ?

    I plan to make a test with DLL.Cpp and the p7zip/7-zip  OS abstract library …

    Remark : I subscribed to FarmCompil but no answer to my email …

     
  • mik
    mik
    2011-01-13

    JFYI on the cfarm arm machines #pragma pack(1) is not required.

     
  • Igor Pavlov
    Igor Pavlov
    2011-01-14

    Does GCC support
    #pragma pack(push, 1)
    #pragma pack(pop)
    ?

     
  • mik
    mik
    2011-01-14

    This is target- and version-dependent.

    gcc-2.95.3:
    ./i386/djgpp.h:#define HANDLE_PRAGMA_PACK_PUSH_POP 1
    ./i386/cygwin.h:#define HANDLE_PRAGMA_PACK_PUSH_POP 1
    ./i386/win32.h:#define HANDLE_PRAGMA_PACK_PUSH_POP 1
    ./winnt/win-nt.h:#define HANDLE_PRAGMA_PACK_PUSH_POP 1

    gcc-4.3.5:
    ./pa/pa-hpux.h:#undef HANDLE_PRAGMA_PACK_PUSH_POP
    ./pa/pa-hpux.h:#define HANDLE_PRAGMA_PACK_PUSH_POP
    ./spu/spu.h:#define HANDLE_PRAGMA_PACK_PUSH_POP 1
    ./i386/djgpp.h:#define HANDLE_PRAGMA_PACK_PUSH_POP 1
    ./i386/cygming.h:#define HANDLE_PRAGMA_PACK_PUSH_POP 1
    ./i386/netware.h:#define HANDLE_PRAGMA_PACK_PUSH_POP
    ./cris/cris.h:#define HANDLE_PRAGMA_PACK_PUSH_POP 1
    ./ia64/hpux.h:#undef HANDLE_PRAGMA_PACK_PUSH_POP
    ./ia64/hpux.h:#define HANDLE_PRAGMA_PACK_PUSH_POP
    ./mips/elf.h:#define HANDLE_PRAGMA_PACK_PUSH_POP 1
    ./mips/sde.h:#define HANDLE_PRAGMA_PACK_PUSH_POP 1
    ./darwin.h:#define HANDLE_PRAGMA_PACK_PUSH_POP 1
    ./alpha/linux.h:#define HANDLE_PRAGMA_PACK_PUSH_POP
    ./sparc/linux.h:#define HANDLE_PRAGMA_PACK_PUSH_POP
    ./sparc/linux64.h:#define HANDLE_PRAGMA_PACK_PUSH_POP
    ./linux.h:#define HANDLE_PRAGMA_PACK_PUSH_POP
    ./freebsd.h:#define HANDLE_PRAGMA_PACK_PUSH_POP 1
    ./rs6000/sysv4.h:#define HANDLE_PRAGMA_PACK_PUSH_POP 1
    ./netbsd.h:#define HANDLE_PRAGMA_PACK_PUSH_POP 1
    ./xtensa/elf.h:#define HANDLE_PRAGMA_PACK_PUSH_POP 1

    Unsupported pragmas are happily ignored with a warning: malformed `#pragma pack'.

     
  • Igor Pavlov
    Igor Pavlov
    2011-01-15

    michaelkostylev:

    What platforms also have sizeof problems with ppmd.h structures, when we use them without #pragma pack (1)?

     
  • mik
    mik
    2011-01-15

    Speaking of the "old" arm abi, I don't know where exactly it is still used.
    What really puzzles me is why these structures must be packed at all.

     
  • Igor Pavlov
    Igor Pavlov
    2011-01-15

    ppmd code uses special allocation manager that must allocate blocks by 12-byte steps.
    And same memory block can be used for different types of structures in different time.
    Maybe it's possible to use nonpacked structures, but it will use more RAM (something like 700 MB instead of 500 MB).
    And some other changes to code are required. It's not good way.

     
  • mik
    mik
    2011-01-15

    typedef struct __attribute__((packed)) {…} foo_t; // gcc and friends
    typedef  __packed struct {…} foo_t; // rvct and friends

    Then there might be a question how to detect the compiler.