Old 21st September 2018, 10:27   #1
TrifonovS
Senior Member
 
Join Date: Apr 2009
Location: Bulgaria
Posts: 190
LibraryLocal deprecated

Hi!
Since I use the latest version of NSIS I get a lot of warnings that LibraryLocal is deprecated and !getdllversion should be used instead. All works as before, but these warnings are annoying and I want to fix them. I tried to find some information how LibraryLocal should be replaced by !getdllversions, but there is no enough information. !getdllversion is good described in the documentation of NSIS, but I can't find enough information for LibraryLocal. So my question is, can I get a short example how to replace one with the other?
TrifonovS is offline   Reply With Quote
Old 21st September 2018, 11:23   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,891
LibraryLocal is a helper application that extracts version information from PE files. It is/was used by Library.nsh when you install/register certain COM, TLB or OCX files (Appendix B in the documentation).

Are you using Library.nsh? Do you have LIBRARY_USELIBRARYLOCALHELPER defined anywhere? Without it I don't think the latest NSIS 3 version will use LibraryLocal anywhere by default but you could be using a 3rd-party header that uses it perhaps?

An outdated Library.nsh file could also cause this.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 21st September 2018, 11:53   #3
TrifonovS
Senior Member
 
Join Date: Apr 2009
Location: Bulgaria
Posts: 190
I'm using a macro InstallLib that uses internally another macro __InstallLib_Helper_GetVersion that calls LibraryLocal.exe. I use this macro to install DLLs. I found it long time ago and it always worked. To be honest, I even don't understand it. It looks quite complicated. Probably now this can be programmed much simpler, but I'm afraid to change my script that was good tested and with proven quality during the years. So is there an easy solution to replace only this call of LibraryLocal.exe inside of the macro __InstallLib_Helper_GetVersion?
TrifonovS is offline   Reply With Quote
Old 21st September 2018, 12:31   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,891
Does your __InstallLib_Helper_GetVersion macro start with "!ifdef LIBRARY_USELIBRARYLOCALHELPER" ?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 21st September 2018, 13:25   #5
TrifonovS
Senior Member
 
Join Date: Apr 2009
Location: Bulgaria
Posts: 190
No. Here is the macro:
PHP Code:
### Get library version
!macro __InstallLib_Helper_GetVersion TYPE FILE
  
!tempfile LIBRARY_TEMP_NSH
  
!ifdef NSIS_WIN32_MAKENSIS
    
!execute '"${NSISDIR}\Bin\LibraryLocal.exe" "${TYPE}" "${FILE}" "${LIBRARY_TEMP_NSH}"'
  
!else
    !
execute 'LibraryLocal "${TYPE}" "${FILE}" "${LIBRARY_TEMP_NSH}"'
    
!if ${TYPE} == 'T'
      
!warning "LibraryLocal currently supports TypeLibs version detection on Windows only"
    
!endif
  !endif
  !include 
"${LIBRARY_TEMP_NSH}"
  
!delfile "${LIBRARY_TEMP_NSH}"
  
!undef LIBRARY_TEMP_NSH
!macroend 
TrifonovS is offline   Reply With Quote
Old 21st September 2018, 13:41   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,891
Then there is something wrong with your installation! Try re-installing v3. You have a new LibraryLocal.exe but a old Library.nsh somehow.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 25th September 2018, 05:35   #7
TrifonovS
Senior Member
 
Join Date: Apr 2009
Location: Bulgaria
Posts: 190
I reinstalled NSIS V3 (first uninstalled the existing version and checked that there is nothing left). But the result is the same. I also searched my HDD for Library.nsh, but the only file that was found is in Program Files/NSIS/Includes.
TrifonovS is offline   Reply With Quote
Old 25th September 2018, 23:25   #8
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,891
I don't know what to tell you, both LibraryLocal.exe and Library.nsh changed in SVN r6913 and NSIS v3.03 was released some time after that change.

Just looking at nsis-3.03-setup.exe that I just downloaded in 7-zip I can confirm that it contains the correct Library.nsh.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 26th September 2018, 06:15   #9
TrifonovS
Senior Member
 
Join Date: Apr 2009
Location: Bulgaria
Posts: 190
Hi Anders!
Actually you said enough according to the information that I provided to you. I found the problem. The answer is somewhere in this discussion, but unfortunately I couldn't figure it out immediately. Many years ago (>10 years) I made a small extension in the InstallLib macro. It was required to update DLLs with the same version that are already installed. Therefore I modified the script and added a define LIBRARY_VERSION_UPDATEWHENEQUAL that enables this behavior. I copied all the code of the InstallLib macro in my own file and I stopped using Library.nsh to avoid problems with the new versions. Then I completely forgot for this... until now... So it is exactly as you said - I'm using an old version of Library.nsh (not directly, but a code from it). I tried to use again the original Library.nsh and there are no more warnings. But the question now is - can I install DLLs with the same version without my modifications? If I can do this, I will remove my own code and I will not have such problems in the future.
TrifonovS is offline   Reply With Quote
Old 26th September 2018, 15:03   #10
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,891
Why would it ever make sense to update when the version has not changed? Do you not trust the version number? Or is it because you want to force re-registration?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 27th September 2018, 05:49   #11
TrifonovS
Senior Member
 
Join Date: Apr 2009
Location: Bulgaria
Posts: 190
During the development, my colleagues don't change the version of the dlls on every commit, but just when they decide that there is something new in principle. Meantime, when we build the installation (automatically via build server) some newer dlls are not installed, because the version is not changed (but they are actually newer). Of course, this leads to problems with the software after the installation, therefore I got a requirement to reinstall also the dlls with the same versions. It was not my decision.
TrifonovS is offline   Reply With Quote
Old 2nd October 2018, 16:04   #12
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,891
I don't have time to deal with this right now but I would probably accept a simple patch, here or on the SF tracker.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 3rd October 2018, 05:53   #13
TrifonovS
Senior Member
 
Join Date: Apr 2009
Location: Bulgaria
Posts: 190
I don't know if my patch is completely correct, but it worked so many years (probably not tested in any conditions). I made it in macro InstallLib. The original code is:

PHP Code:
      GetDLLVersion $R4 $R2 $R3

      
!undef LIBRARY_VERSION_HIGH
      
!undef LIBRARY_VERSION_LOW

      
!ifndef INSTALLLIB_LIBTYPE_TLB INSTALLLIB_LIBTYPE_REGDLLTLB

        IntCmpU $R0 $R2 0 
"installlib.register_${INSTALLLIB_UNIQUE}" "installlib.upgrade_${INSTALLLIB_UNIQUE}"
        
IntCmpU $R1 $R3 "installlib.register_${INSTALLLIB_UNIQUE}" "installlib.register_${INSTALLLIB_UNIQUE}\
          
"installlib.upgrade_${INSTALLLIB_UNIQUE}"

      
!else
... 
and I made the following modification:

PHP Code:
      GetDLLVersion $R4 $R2 $R3

      
!undef LIBRARY_VERSION_HIGH
      
!undef LIBRARY_VERSION_LOW

      
!ifndef INSTALLLIB_LIBTYPE_TLB INSTALLLIB_LIBTYPE_REGDLLTLB

        IntCmpU $R0 $R2 0 
"installlib.register_${INSTALLLIB_UNIQUE}" "installlib.upgrade_${INSTALLLIB_UNIQUE}"
        
!ifdef LIBRARY_VERSION_UPDATEWHENEQUAL
          IntCmpU $R1 $R3 
"installlib.upgrade_${INSTALLLIB_UNIQUE}" "installlib.register_${INSTALLLIB_UNIQUE}\
            
"installlib.upgrade_${INSTALLLIB_UNIQUE}"
        
!else
          
IntCmpU $R1 $R3 "installlib.register_${INSTALLLIB_UNIQUE}" "installlib.register_${INSTALLLIB_UNIQUE}\
            
"installlib.upgrade_${INSTALLLIB_UNIQUE}"
        
!endif
  
      !else
... 
The define LIBRARY_VERSION_UPDATEWHENEQUAL enables the modification.
TrifonovS is offline   Reply With Quote
Old 3rd October 2018, 17:47   #14
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,891
That does not seem correct to me, the version is a 64-bit number and you are only checking 32 of them in a different way.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 3rd October 2018, 19:38   #15
TrifonovS
Senior Member
 
Join Date: Apr 2009
Location: Bulgaria
Posts: 190
Yes, you are right. As I said, I solved my problem many years ago. Still works for my needs. But I prefer an universal solution and I want to discard my special fix.
TrifonovS is offline   Reply With Quote
Old 4th October 2018, 18:52   #16
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,891
Try this.

I named the option define LIBRARY_INSTALL_EQUAL_VERSION
Attached Files
File Type: nsh Library.nsh (21.7 KB, 19 views)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 5th October 2018, 07:18   #17
TrifonovS
Senior Member
 
Join Date: Apr 2009
Location: Bulgaria
Posts: 190
It looks that it works as it is expected, but I made some very fast tests. I completely removed my specific version of InstallLib and not I use the new Library.nsh file in all my installers. Soon or later the installers will be tested and I will report if I see problems.
TrifonovS is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump