Menu

#1307 When building nsis on linux, can't find default folder

3.0 Series
open
nobody
None
1
2024-05-08
2024-03-04
No

Hello,

I'm building NSIS v.3.09 for linux. Here's the build command I am using:

scons SKIPSTUBS=all \
SKIPPLUGINS=all \
SKIPUTILS=all \
SKIPMISC=all \
NSIS_CONFIG_CONST_DATA_PATH=no \
PREFIX=build/nsis-3.09/ \
install-compiler

The problem is, the resulting executable looks for the Stubs folder one folder up from where the executable is copied by using "install-compiler". I do not know how to change this, except for using the NSISDIR environment variable. This also makes the existing documentation on building on POSIX systems incorrect. This appears to be a general problem based on this years old Stack Overflow question. Am I doing something wrong?

For reference, in build.cpp, the following code sets the search directory based on the makensis path. It appears to do so based on where the makensis executable is located at build time, instead of runtime.

  tstring nsis_dir;
  const TCHAR *dir = _tgetenv(_T("NSISDIR"));
  if (dir) nsis_dir = dir;
  else {
#ifndef NSIS_CONFIG_CONST_DATA_PATH
    nsis_dir = get_dir_name(get_executable_dir(makensis_path));
#else
    nsis_dir = _T(PREFIX_DATA);
#endif
  }
  definedlist.add(_T("NSISDIR"), nsis_dir.c_str());

  tstring includes_dir = nsis_dir;
  includes_dir += PLATFORM_PATH_SEPARATOR_STR _T("Include");
  include_dirs.add(includes_dir.c_str(),0);

  stubs_dir = nsis_dir;
  stubs_dir += PLATFORM_PATH_SEPARATOR_STR _T("Stubs");

Any help is appreciated.

Discussion

  • Rodolfo Gonzalez Delgado

    Writing this bug report helped me understand that the makensis.exe file, located at the root of the zip file, might just be calling the actual makensis.exe located in the Bin folder. That might be the reason why the resulting executable looks for the Stubs folder one folder up.

    If this is the case, can we please rewrite this documentation to reflect that the PREFIX= variable must point to the bin folder of the zip instead of the extracted zip?

    Just to be clear, currently the documentation shows the following information

    scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all
          NSIS_CONFIG_CONST_DATA_PATH=no PREFIX=/path/to/extracted/zip
          install-compiler
    

    I'm proposing to change it to something like:

    scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all
          NSIS_CONFIG_CONST_DATA_PATH=no PREFIX=/path/to/extracted/zip/Bin
          install-compiler
    

    Or make some change in the scons script that adds /Bin to the end of the PREFIX= variable.

    Thanks for the help.

     

    Last edit: Rodolfo Gonzalez Delgado 2024-03-04
  • Nicholas Twerdochlib

    Is it possible that the call at build.cpp:415 which is

        nsis_dir = get_dir_name(get_executable_dir(makensis_path));
    

    should be:

        nsis_dir = get_executable_dir(makensis_path);
    

    Looking util.cpp:935, get_executable_dir() wraps a call to get_executable_path() in get_dir_name(). Perhaps the code a build.cpp:415 didn't take into account what this convenience function provides?

     
  • Jason

    Jason - 2024-05-06

    Maybe a fix like this:

    Index: SConstruct
    ===================================================================
    --- SConstruct  (revision 7428)
    +++ SConstruct  (working copy)
    @@ -694,7 +694,10 @@
     if defenv['PLATFORM'] == 'win32': 
        defenv.DistributeW32Bin(makensis, alias='install-compiler')
     else:
    -   defenv.DistributeBin(makensis, alias='install-compiler')
    +   if 'NSIS_CONFIG_CONST_DATA_PATH' in defenv['NSIS_CPPDEFINES']:
    +       defenv.DistributeBin(makensis, alias='install-compiler')
    +   else:
    +       defenv.DistributeW32Bin(makensis, alias='install-compiler')
    
     ######################################################################
     #######  Plug-ins                                                  ###
    
     
  • Jason

    Jason - 2024-05-08

    Turns out that in '/SCons/config.py', it's already doing a platform check by default. So the fix can be simplified to this:

    Index: SConstruct
    ===================================================================
    --- SConstruct  (revision 7428)
    +++ SConstruct  (working copy)
    @@ -691,10 +691,10 @@
     defenv.MakeReproducible(makensis)
     defenv.Alias('makensis', makensis)
    
    -if defenv['PLATFORM'] == 'win32': 
    +if 'NSIS_CONFIG_CONST_DATA_PATH' in defenv['NSIS_CPPDEFINES']:
    +   defenv.DistributeBin(makensis, alias='install-compiler')
    +else:
        defenv.DistributeW32Bin(makensis, alias='install-compiler')
    -else:
    -   defenv.DistributeBin(makensis, alias='install-compiler')
    
     ######################################################################
     #######  Plug-ins                                                  ###
    
     

Log in to post a comment.