Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error after upgrading to 1.0.131 #22

Closed
stuart-beattie opened this issue Jul 24, 2017 · 7 comments
Closed

Compile error after upgrading to 1.0.131 #22

stuart-beattie opened this issue Jul 24, 2017 · 7 comments
Assignees

Comments

@stuart-beattie
Copy link

My solution is failing to compile with the following error after the upgrade.

Payload contains two or more files with the same destination path 'Sodium.winmd'. Source files:
....nuget\packages\libsodium-uwp\1.0.131\runtimes\win10-x64\native\Sodium.winmd
....nuget\packages\libsodium-uwp\1.0.131\lib\uap10.0\Sodium.winmd

@charlesportwoodii
Copy link
Owner

charlesportwoodii commented Jul 24, 2017

@stuart-beattie,

Thanks for the heads up. The scripting packages are in ./.nuget, so something must have gone wrong during the build phase that the tests didn't catch.

I'll take a look at what part of the packaging failed as quick as I can and try to get a build out to replace it.

In the meantime I'd recommend downgrading to 1.0.12.3.

@charlesportwoodii
Copy link
Owner

Also, what version of Microsoft.NETCore.UniversalWindowsPlatform are you on? Can you try upgrading to 5.3.3?

Install-Package Microsoft.NETCore.UniversalWindowsPlatform -Version 5.3.3

@charlesportwoodii
Copy link
Owner

charlesportwoodii commented Jul 25, 2017

I played around with this last night some trying to figure out what changed in the nuget packaging between 1.0.12.3 and 1.0.13.1. The packaging scripts are the same for both, and I wasn't able to immediately discover why this error started occurring.

While I do know a way to "fix" the issue that you're seeing, (moving lib\uap10.0\Sodium.winmd to ref\uap10.0\Sodium.winmd, it has the unfortunate side effect of breaking ARM compilation on devices since it picks up the wrong metadata file.

Ultimately the problem has to do with the compiler toolchain not picking up the right winmd implementation, but I'm going to need to build the project commit by commit since 1.0.12.3 to see what introduced the breakage.

After working with this last night, I'm confident that this is just a packaging issue with Nuget. If downgrading to 1.0.12.3 isn't your thing, you can always compile the project from source and include it as a reference to your project. Just make sure you clone the project with --recursive to pick up libsodium actual.

I won't have access to a compiler for some time today to start debugging this, in the meantime please use the suggestion above as an alternative until I can identify and resolve this packaging issue.

Sorry for the inconvenience.

@charlesportwoodii
Copy link
Owner

charlesportwoodii commented Jul 26, 2017

I'm going to move forward with moving lib\uap10.0\Sodium.winmd to ref\uap10.0\Sodium.winmd. In Nuget 4 that seems to be the best way to do platform dependent implementations.


Regarding the ARM issue. After much digging it looks like ADVAPI32.dll/ucrtbased.dll is being re-included in the ARM DLL that gets generated. Neither of those DLLs should be compiled against for the ARM package. I'm not sure if this is due to a change in libsodium itself, or something that changed in Visual Studio.

I'm suspecting it's something in Visual Studio that changed, but after trying to rebuild 1.0.12.3 on 2 separate machines I'm no longer getting a correctly build ARM DLL. At this point I just need to figure out what SysCall is being made or what is causing ADVAPI32.dll/ucrtbased.dll to be included, remove it, and package.

I'll provide another update once I'm a bit closer.


In 1.0.12.3, the generated ARM DLL looks like this:

File Type: DLL
$ dumpbin /dependents  1.0.12.3\runtimes\win10-arm\native\libsodium-uwp.dll                                                                                 
Dump of file 1.0.12.3\test\runtimes\win10-arm\native\libsodium-uwp.dll                                                                     
                                                                                                                             
File Type: DLL    

  Image has the following dependencies:

    api-ms-win-core-synch-l1-2-0.dll
    vccorlib140_app.DLL
    MSVCP140_APP.dll
    VCRUNTIME140_APP.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    api-ms-win-crt-heap-l1-1-0.dll
    api-ms-win-crt-string-l1-1-0.dll
    api-ms-win-core-util-l1-1-0.dll
    api-ms-win-core-winrt-string-l1-1-0.dll
    api-ms-win-core-com-l1-1-1.dll
    api-ms-win-core-handle-l1-1-0.dll
    api-ms-win-core-profile-l1-1-0.dll
    api-ms-win-core-processthreads-l1-1-2.dll
    api-ms-win-core-sysinfo-l1-2-1.dll
    api-ms-win-core-libraryloader-l1-2-0.dll
    api-ms-win-core-interlocked-l1-2-0.dll

  Summary

        4000 .data
        1000 .gfids
        1000 .giats
        3000 .pdata
       28000 .rdata
        3000 .reloc
        1000 .rsrc
       37000 .text
        1000 .tls
        1000 minATL

In 1.0.13.1, (and anytime I try to rebuild 1.0.12.3, ADVAPI32.dll keeps being re-included.

$ dumpbin /dependents ARM/Debug/libsodium-uwp/libsodium-uwp.dll                                                                                 
Dump of file ARM/Debug/libsodium-uwp/libsodium-uwp.dll                                                                       
                                                                                                                             
File Type: DLL                                                                                                               
                                                                                                                             
  Image has the following dependencies:                                                                                      
                                                                                                                             
    api-ms-win-core-synch-l1-2-0.dll                                                                                         
    vccorlib140d_app.DLL                                                                                                     
    MSVCP140D_APP.dll                                                                                                        
    ADVAPI32.dll                                                                                                             
    VCRUNTIME140D_APP.dll                                                                                                    
    ucrtbased.dll                                                                                                            
    api-ms-win-core-winrt-string-l1-1-0.dll                                                                                  
    api-ms-win-core-com-l1-1-1.dll                                                                                           
    api-ms-win-core-util-l1-1-0.dll                                                                                          
    api-ms-win-core-winrt-error-l1-1-1.dll                                                                                   
    api-ms-win-core-handle-l1-1-0.dll                                                                                        
    api-ms-win-core-debug-l1-1-1.dll                                                                                         
    api-ms-win-core-errorhandling-l1-1-1.dll                                                                                 
    api-ms-win-core-string-l1-1-0.dll                                                                                        
    api-ms-win-core-winrt-l1-1-0.dll                                                                                         
    api-ms-win-core-profile-l1-1-0.dll                                                                                       
    api-ms-win-core-processthreads-l1-1-2.dll                                                                                
    api-ms-win-core-sysinfo-l1-2-1.dll                                                                                       
    api-ms-win-core-libraryloader-l1-2-0.dll                                                                                 
    api-ms-win-core-interlocked-l1-2-0.dll                                                                                   
    api-ms-win-core-heap-l1-2-0.dll                                                                                          
    api-ms-win-core-memory-l1-1-2.dll                                                                                        
                                                                                                                             
  Summary                                                                                                                    
                                                                                                                             
        1000 .00cfg                                                                                                          
        4000 .data                                                                                                           
        3000 .idata                                                                                                          
        9000 .pdata                                                                                                          
       49000 .rdata                                                                                                          
       14000 .reloc                                                                                                          
        1000 .rsrc                                                                                                           
      100000 .text                                                                                                           
        1000 .tls                                                                                                            

@charlesportwoodii
Copy link
Owner

dumpbin /imports seems to indicateRtlGenRandom is being called against instead of the custom GetRandomBytes C export I added. This is probably a bad include from a reference file.

$ dumpbin /imports ARM/Debug/libsodium-uwp/libsodium-uwp.dll    
   ADVAPI32.dll                                                                                                             
              10157000 Import Address Table                                                                                  
              10157820 Import Name Table                                                                                     
                     0 time date stamp                                                                                       
                     0 Index of first forwarder reference                                                                    
                                                                                                                             
                  31F SystemFunction036  

@charlesportwoodii
Copy link
Owner

54b9786 fixes this. As soon as the tests pass I'll create and test a new package to deploy to nuget.

@charlesportwoodii
Copy link
Owner

charlesportwoodii commented Jul 27, 2017

1.0.13.2 has been released and push to nuget.

https://github.com/charlesportwoodii/libsodium-uwp/releases/tag/1.0.13.2


Thanks for your patience. Let me know if you have any additional questions, concerns, or if you find any other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants