Menu

#717 mac os x leopard build and run fails - endian issues

closed-fixed
None
5
2007-12-16
2007-12-15
No

platform: mac os x 10.5 leopard powerpc

from svn trunk:

$ scons PREFIX=/opt/nsis SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all install

I get the error:

scons: Building targets ...
g++ -o build/release/makensis/DialogTemplate.o -c -O2 -Wall -m32 -Wno-non-virtual-dtor -D_WIN32_IE=0x0500 -Ibuild/release/makensis -ISource Source/DialogTemplate.cpp
Source/DialogTemplate.cpp: In member function 'void CDialogTemplate::ConvertToRTL()':
Source/DialogTemplate.cpp:484: error: 'WS_EX_LAYOUTRTL' was not declared in this scope

hacking the value for WS_EX_LAYOUTRTL into the cpp file, it goes further and dies at:

Source/DialogTemplate.cpp
g++ -o build/release/makensis/util.o -c -O2 -Wall -m32 -Wno-non-virtual-dtor -D_WIN32_IE=0x0500 -Ibuild/release/makensis -ISource Source/util.cpp
Source/util.cpp: In function 'BOOL IsValidCodePage(UINT)':
Source/util.cpp:275: error: 'FALSE' was not declared in this scope
Source/util.cpp:279: error: 'TRUE' was not declared in this scope

After fixing that, makensis builds and installs. I copy the exe's and dll's from the latest zip file into place but makensis doesn't get that far:

Older versions of makensis got much further on this platform: "Unsupported PE format" :

$ makensis /opt/local/share/nsis/Examples/example1.nsi MakeNSIS v14-Dec-2007.cvs - Copyright 1995-2007 Contributors
See the file COPYING for license details.
Credits can be found in the Users Manual.

Processing config:
Processing plugin dlls: "/opt/local/share/nsis/Plugins/*.dll"

!define: "MUI_INSERT_NSISCONF"=""

Changing directory to: "/opt/local/share/nsis/Examples"

Processing script file: "/opt/local/share/nsis/Examples/example1.nsi"
Name: "Example1"
OutFile: "example1.exe"
InstallDir: "$PROGRAMFILES\Example1"
Page: directory
Page: instfiles
Section: ""
SetOutPath: "$INSTDIR"
File: "example1.nsi" [compress] 388/831 bytes
SectionEnd

Processed 1 file, writing output:
Processing pages... Done!
Removing unused resources...
Error: Unsupported PE format
Error - aborting creation process

Discussion

  • Jeff Koftinoff

    Jeff Koftinoff - 2007-12-15

    Logged In: YES
    user_id=1960614
    Originator: YES

    Sorry, I missed an important result. After applying the minor fixes to the svn trunk co, when I run makensis it fails immediately:

    $ /opt/nsis/bin/makensis
    Error initalizing CEXEBuild: unable to read icon from file

     
  • Amir Szekely

    Amir Szekely - 2007-12-15

    Logged In: YES
    user_id=584402
    Originator: NO

    WS_EX_LAYOUTRTL was missing from Platform.h - added.
    TRUE and FALSE are in Platform.h, so I don't know why they'd give you problems.
    As for the icon loading issue, I think I've fixed it. The loaded icon offset from the file wasn't converted from little endian.

    Let me know if the current SVN version now gets further.

     
  • Amir Szekely

    Amir Szekely - 2007-12-15
    • labels: 463801 -->
    • milestone: 105205 -->
     
  • Amir Szekely

    Amir Szekely - 2007-12-15
    • status: open --> pending
     
  • Jeff Koftinoff

    Jeff Koftinoff - 2007-12-15
    • status: pending --> closed
     
  • Jeff Koftinoff

    Jeff Koftinoff - 2007-12-15

    Logged In: YES
    user_id=1960614
    Originator: YES

    Thank you! it compiles and works now perfectly!

    Except for the mysterious TRUE and FALSE problem, though.
    Some H file must be undef'ing it!

    jeffk@jeffklap:~/src/all/3rdparty/nsis-trunk $ svn diff
    Index: Source/util.cpp
    ===================================================================
    --- Source/util.cpp (revision 5398)
    +++ Source/util.cpp (working copy)
    @@ -42,6 +42,10 @@
    #include <algorithm>
    #include <stdexcept>

    +#ifndef TRUE
    +#error TRUE is not defined
    +#endif
    +
    using namespace std;

    int g_dopause=0;

    $ scons PREFIX=/opt/nsis SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all
    scons: Reading SConscript files ...
    ....
    g++ -o build/release/makensis/util.o -c -O2 -Wall -m32 -Wno-non-virtual-dtor -D_WIN32_IE=0x0500 -Ibuild/release/makensis -ISource Source/util.cpp
    Source/util.cpp:46:2: error: #error TRUE is not defined
    Source/util.cpp: In function 'BOOL IsValidCodePage(UINT)':
    Source/util.cpp:279: error: 'FALSE' was not declared in this scope
    Source/util.cpp:283: error: 'TRUE' was not declared in this scope

    So for now I'll do this:

    nsis-trunk $ svn diff
    Index: Source/util.cpp
    ===================================================================
    --- Source/util.cpp (revision 5398)
    +++ Source/util.cpp (working copy)
    @@ -42,6 +42,11 @@
    #include <algorithm>
    #include <stdexcept>

    +#ifndef TRUE
    +#define TRUE 1
    +#define FALSE 0
    +#endif
    +

    Aha, the culprit is the mac os x file: /usr/include/mach-o/dyld.h

    which contains the amazing code snippet:

    #ifndef ENUM_DYLD_BOOL
    #define ENUM_DYLD_BOOL
    #undef FALSE
    #undef TRUE
    enum DYLD_BOOL { FALSE, TRUE };
    #endif /* ENUM_DYLD_BOOL */

     
  • Amir Szekely

    Amir Szekely - 2007-12-16

    Logged In: YES
    user_id=584402
    Originator: NO

    TRUE and FALSE might be used in other files as well. That solution is a bit too tailored for this case. Any better idea how to get this done? Maybe some define for the mach h files?

     
  • Amir Szekely

    Amir Szekely - 2007-12-16
    • status: closed --> closed-fixed
     
  • Jeff Koftinoff

    Jeff Koftinoff - 2007-12-17

    Logged In: YES
    user_id=1960614
    Originator: YES

    Well, the real problem is that perhaps this code should be moved to Platform.h since it is platform specific code:

    #ifdef __APPLE__
    namespace Apple { // defines struct section
    # include <mach-o/dyld.h> // for _NSGetExecutablePath
    };
    # include <sys/param.h> // for MAXPATHLEN
    #endif

    And in addition, change that snipped to do:

    #define ENUM_DYLD_BOOL

    before the #include of mach-o/dyld.h

    The #undef of TRUE/FALSE in dyld.h is really crappy on the part of apple, as this enum is not usable in place of the #defines in c++ - especiialy when you stick it all into namespace Apple - now the only way to get at TRUE is via Apple::TRUE...

    However, why doesn't nsis just use bool, true and false instead of BOOL, TRUE and FALSE?

    --jeffk++

     
  • Amir Szekely

    Amir Szekely - 2007-12-20

    Logged In: YES
    user_id=584402
    Originator: NO

    Added ENUM_DYLD_BOOL. Thanks.

    bool isn't used there because the function is a replica of a Windows API function which returns BOOL.

     

Log in to post a comment.