Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ied206 committed Jan 27, 2022
2 parents de68925 + 1e5f13e commit 131fa03
Show file tree
Hide file tree
Showing 19 changed files with 49 additions and 34 deletions.
12 changes: 10 additions & 2 deletions ManagedWimLib.Tests/ManagedWimLib.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net48;net5.0;</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">net5.0;</TargetFrameworks>
<!-- Windowws x86 & x64 -->
<TargetFrameworks>net48;net6.0</TargetFrameworks>
<!-- Windowws ARM64 -->
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT' and '$(PROCESSOR_ARCHITECTURE)' == 'ARM64'">net6.0</TargetFrameworks>
<!-- POSIX -->
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
Expand Down
2 changes: 1 addition & 1 deletion ManagedWimLib.Tests/TestSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public static class TestHelper
#region Temp Path
private static int _tempPathCounter = 0;
private static readonly object TempPathLock = new object();
private static readonly RNGCryptoServiceProvider SecureRandom = new RNGCryptoServiceProvider();
private static readonly RandomNumberGenerator SecureRandom = RandomNumberGenerator.Create();

private static FileStream _lockFileStream = null;
private static string _baseTempDir = null;
Expand Down
7 changes: 3 additions & 4 deletions ManagedWimLib/ManagedWimLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@
<Title>ManagedWimLib</Title>
<LangVersion>latest</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Version>2.2.0</Version>
<Version>2.3.0</Version>
<Authors>Eric Biggers, Hajin Jang</Authors>
<Company>Joveler</Company>
<Description>Native wimlib wrapper library for .NET.
Provides every capabilities of wimlib.
Supports Windows, Linux and macOS.</Description>
<Copyright>Copyright (c) 2018-2021 Hajin Jang</Copyright>
<Copyright>Copyright (c) 2018-2022 Hajin Jang</Copyright>
<PackageLicenseExpression>LGPL-3.0-or-later</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/ied206/ManagedWimLib</PackageProjectUrl>
<PackageIcon>images\Logo.png</PackageIcon>
<RepositoryUrl>https://github.com/ied206/ManagedWimLib</RepositoryUrl>
<PackageReleaseNotes>- Update included wimlib to 1.13.4.
- Fix UpdateProgress and VerifyStreamsProgress marshalling issue.</PackageReleaseNotes>
<PackageReleaseNotes>- Update included wimlib to 1.13.5.</PackageReleaseNotes>
<PackageTags>wim wimlib dism imagex archive native pinvoke interop</PackageTags>
</PropertyGroup>
<!-- PackageReference -->
Expand Down
Binary file modified ManagedWimLib/runtimes/linux-arm/native/libwim.so
Binary file not shown.
Binary file modified ManagedWimLib/runtimes/linux-arm64/native/libwim.so
Binary file not shown.
Binary file removed ManagedWimLib/runtimes/linux-x64/libwim.so
Binary file not shown.
Binary file modified ManagedWimLib/runtimes/linux-x64/native/libwim.so
Binary file not shown.
Binary file removed ManagedWimLib/runtimes/osx-x64/libwim.dylib
Binary file not shown.
Binary file modified ManagedWimLib/runtimes/osx-x64/native/libwim.dylib
100644 → 100755
Binary file not shown.
Binary file modified ManagedWimLib/runtimes/win-arm64/native/libwim-15.dll
Binary file not shown.
Binary file modified ManagedWimLib/runtimes/win-arm64/native/libwinpthread-1.dll
Binary file not shown.
Binary file modified ManagedWimLib/runtimes/win-arm64/native/libxml2-2.dll
Binary file not shown.
Binary file modified ManagedWimLib/runtimes/win-x64/native/libwim-15.dll
Binary file not shown.
Binary file modified ManagedWimLib/runtimes/win-x86/native/libwim-15.dll
Binary file not shown.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ macOS arm64 should be supported on theory, but I do not have access to an Apple

| Architecture | Distribution | Note |
|--------------|--------------|------|
| x64 | Ubuntu 18.04 | Tested on AppVeyor CI |
| arm | Debian 10 | Emulated on QEMU's virt board |
| arm64 | Debian 10 | Emulated on QEMU's virt board |
| x64 | Ubuntu 20.04 | Tested on AppVeyor CI |
| arm | Debian 11 | Emulated on QEMU's virt board |
| arm64 | Debian 11 | Emulated on QEMU's virt board |

### Supported wimlib version

- 1.13.4 (Included)
- 1.13.5 (Included)

## Usage

Expand Down
26 changes: 13 additions & 13 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ ManagedWimLib comes with sets of binaries of `wimlib 1.13.4`. They will be copie
| Windows x86 | `$(OutDir)\runtimes\win-x86\native\libwim-15.dll` | LGPLv3 |
| Windows x64 | `$(OutDir)\runtimes\win-x64\native\libwim-15.dll` | LGPLv3 |
| Windows arm64 | `$(OutDir)\runtimes\win-arm64\native\libwim-15.dll` | LGPLv3 |
| Ubuntu 18.04 x64 | `$(OutDir)\runtimes\linux-x64\native\libwim.so` | LGPLv3 (w/o NTFS-3G) |
| Debian 10 armhf | `$(OutDir)\runtimes\linux-arm\native\libwim.so` | LGPLv3 (w/o NTFS-3G) |
| Debian 10 arm64 | `$(OutDir)\runtimes\linux-arm64\native\libwim.so` | LGPLv3 (w/o NTFS-3G) |
| macOS 10.15 x64 | `$(OutDir)\runtimes\osx-x64\native\libwim.dylib` | LGPLv3 (w/o NTFS-3G) |
| Ubuntu 20.04 x64 | `$(OutDir)\runtimes\linux-x64\native\libwim.so` | LGPLv3 (w/o NTFS-3G) |
| Debian 11 armhf | `$(OutDir)\runtimes\linux-arm\native\libwim.so` | LGPLv3 (w/o NTFS-3G) |
| Debian 11 arm64 | `$(OutDir)\runtimes\linux-arm64\native\libwim.so` | LGPLv3 (w/o NTFS-3G) |
| macOS Big Sur x64 | `$(OutDir)\runtimes\osx-x64\native\libwim.dylib` | LGPLv3 (w/o NTFS-3G) |

- Linux binaries are not portable. Included binaires may not work on your distribution.
- On Linux, wimlib depends on system-installed `libfuse`.
Expand All @@ -120,15 +120,15 @@ ManagedWimLib comes with sets of binaries of `wimlib 1.13.4`. They will be copie

#### Build Command

| Platform | Binary Source | Dependency |
|------------------|---------------------------------------------------------------------------------------|-----------------|
| Windows x86 | [Official Release](https://wimlib.net/downloads/wimlib-1.13.3-windows-i686-bin.zip) | - |
| Windows x64 | [Official Release](https://wimlib.net/downloads/wimlib-1.13.3-windows-x86_64-bin.zip) | - |
| Windows arm64 | Compile with MSYS2 and llvm-mingw | - |
| Ubuntu 18.04 x64 | Compile with libxml2 dependency | libfuse |
| Debian 10 armhf | Compile with libxml2 dependency | libfuse |
| Debian 10 arm64 | Compile with libxml2 dependency | libfuse |
| macOS 10.15 | Compile with libxml2 dependency | - |
| Platform | Binary Source | Dependency |
|-------------------|---------------------------------------------------------------------------------------|-----------------|
| Windows x86 | [Official Release](https://wimlib.net/downloads/wimlib-1.13.3-windows-i686-bin.zip) | - |
| Windows x64 | [Official Release](https://wimlib.net/downloads/wimlib-1.13.3-windows-x86_64-bin.zip) | - |
| Windows arm64 | Compile with MSYS2 and llvm-mingw | - |
| Ubuntu 20.04 x64 | Compile with libxml2 dependency | libfuse |
| Debian 11 armhf | Compile with libxml2 dependency | libfuse |
| Debian 11 arm64 | Compile with libxml2 dependency | libfuse |
| macOS Big Sur x64 | Compile with libxml2 dependency | - |

### Custom binary

Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ variables:

steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK 5.0'
displayName: 'Install .NET SDK 6.0'
inputs:
packageType: 'sdk'
version: '5.0.x'
version: '6.0.x'
- task: DotNetCoreCLI@2
displayName: 'Restore Nuget Pacakges'
inputs:
Expand Down
22 changes: 15 additions & 7 deletions native/windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Use MSYS2 and llvm-mingw to compile ARM64 wimlib dll.
## Status

- `libwim-15.dll` is compilable with a bit of a patch.
- `ld.lld` fails to link `wimlib-imagex.exe`.

## Required Tools

Expand All @@ -17,19 +16,23 @@ Use MSYS2 and llvm-mingw to compile ARM64 wimlib dll.

## Required Sources

- [libxml2](http://www.xmlsoft.org/downloads.html): Tested with 2.9.10.
- [wimlib](https://wimlib.net/downloads/index.html): Tested with 1.13.3.
- [libxml2](http://www.xmlsoft.org/downloads.html): Tested with 2.9.12.
- [wimlib](https://wimlib.net/downloads/index.html): Tested with 1.13.5.

## Build Manual

1. Extract the `libxml2` and `wimlib` source code.
1. Open MSYS2 MinGW 64bit shell.
1. Apply `patch/libxml2-llvm-linker.patch` to `libxml2` source.
```
cd /d/build/native/libxml2-2.9.12
patch -p1 < /d/build/ManagedWimLib/native/windows/patch/libxml2-llvm-linker.patch
```
1. Build `libxml2` by running `libxml2-msys2.sh`.
- You must pass a path of `llvm-mingw` to compile ARM64 binaries.
```
[Examples]
aarch64: ./libxml2-msys2.sh.sh -a aarch64 -t /c/llvm-mingw /d/build/native/libxml2-
aarch64: ./libxml2-msys2.sh -a aarch64 -t /c/llvm-mingw /d/build/native/libxml2-2.9.12
```
1. Edit `include/wimlib.h` of `wimlib` source.
- Define `WIMLIBAPI` as `__declspec(dllexport)`.
Expand Down Expand Up @@ -72,7 +75,7 @@ Fortunately, @jeremyd2019 found a solution: borrow `libxslt`'s linker detection
### Why clang refuses to build vanilla wimlib?
Clang requires every function symbols have consistency on dllimport/dllexport-ness ([ref1](https://github.com/llvm-mirror/clang/blob/master/test/Sema/dllexport.c), [ref2](http://clang-developers.42468.n3.nabble.com/Latest-clang-shows-failure-in-redeclaration-with-dllimport-td4045316.html), while GCC and MSVC allows this behavior.
Clang requires every function symbols have consistency on dllimport/dllexport-ness ([ref1](https://github.com/llvm-mirror/clang/blob/master/test/Sema/dllexport.c), [ref2](http://clang-developers.42468.n3.nabble.com/Latest-clang-shows-failure-in-redeclaration-with-dllimport-td4045316.html)), while GCC and MSVC allows this behavior.
For example, GCC allows this code, while CLANG throws an error.
Expand All @@ -95,8 +98,10 @@ wimlib_free(WIMStruct *wim);

## Unsolvable issues

#### Unable to build wimlib-imagex.exe
- llvm-mingw fails to link `wimlib-imagex.exe`, but I couldn't know why.
### Unable to build wimlib-imagex.exe

- llvm-mingw (LLVM 11.0.0) fails to link `wimlib-imagex.exe`, but I couldn't know why.
- Latest LLVM 13 succesfully builds `wimlib-imagex.exe`.
```
CCLD libwim.la
CCLD wimlib-imagex.exe
Expand All @@ -105,6 +110,9 @@ wimlib_free(WIMStruct *wim);
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Makefile:1318: wimlib-imagex.exe] Error 1
```
### Unable to link static libxml2
- libtool refuses to link `wimlib` with static `libxml2`.
```
*** Warning: Trying to link with static lib archive <LIBXML2_STATIC_LIB>.
Expand Down
2 changes: 1 addition & 1 deletion native/windows/libxml2-msys2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ CORES=$(grep -c ^processor /proc/cpuinfo)

# Create prefix directory
LIB_PREFIX="${BASE_DIR}/build-prefix-${ARCH}"
mkdir "${LIB_PREFIX}"
mkdir -p "${LIB_PREFIX}"

# Compile libxml2
# Adapted from https://wimlib.net/git/?p=wimlib;a=tree;f=tools/windeps/Makefile;
Expand Down

0 comments on commit 131fa03

Please sign in to comment.