DarkMatterCore / libusbhsfs

USB Mass Storage Class Host + Filesystem Mounter static library for Nintendo Switch homebrew applications.
GNU General Public License v2.0
94 stars 19 forks source link

Unable to build with latest git files #23

Closed mrdude2478 closed 2 years ago

mrdude2478 commented 2 years ago

As per title, a clean install of devkit pro on both PC and Ubuntu, I get the following error trying to build the GPL version

ntfs.c
ntfs_dev.c
/home/mrdude/Desktop/libusbhsfs/source/ntfs-3g/ntfs_dev.c: In function 'ntfsdev_statvfs':
/home/mrdude/Desktop/libusbhsfs/source/ntfs-3g/ntfs_dev.c:825:10: error: implicit declaration of function 'NVolFreeSpaceKnown' [-Werror=implicit-function-declaration]
  825 |     if (!NVolFreeSpaceKnown(vd->vol) && ntfs_volume_get_free_space(vd->vol) < 0) ntfs_set_error_and_exit(ENOSPC);
      |          ^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [/opt/devkitpro/devkitA64/base_rules:19: ntfs_dev.o] Error 1
make: *** [Makefile:154: lib/libusbhsfs.a] Error 2

Building ISC type builds fine with no errors.

DarkMatterCore commented 2 years ago

Run make fs-libs before attempting to build the library. You're most likely missing the switch-ntfs-3g and switch-lwext4 packages, or maybe you already have installed them in the past but they need to be updated.

DarkMatterCore commented 2 years ago

As a side note: yes, I know this is troublesome, but these packages won't ever be merged by DKP folks into their pacman packages repository, which is why they need to be managed manually.

Whovian9369 commented 2 years ago

Run make fs-libs before attempting to build the library.

May I ask why that must be done manually, instead of make automatically doing that itself as part of the process?

mrdude2478 commented 2 years ago

Thanks, I get this error trying that make fs-libs

mrdude@ubuntu:~/Desktop/libusbhsfs$ make fs-libs
Installing ntfs-3g
make[1]: Entering directory '/home/mrdude/Desktop/libusbhsfs/libntfs-3g'
[sudo] password for mrdude: 
error: unresolvable package conflicts detected
error: failed to prepare transaction (conflicting dependencies)
==> ERROR: 'pacman' failed to install missing dependencies.
==> ERROR: Could not resolve all dependencies.
make[1]: *** [Makefile:13: all] Error 8
make[1]: Leaving directory '/home/mrdude/Desktop/libusbhsfs/libntfs-3g'
make: *** [Makefile:147: fs-libs] Error 2
mrdude@ubuntu:~/Desktop/libusbhsfs$ 
mrdude2478 commented 2 years ago

In windows:

MrDude@MrDude MSYS ~/switch/libusbhsfs
# make fs-libs
Installing ntfs-3g
make[1]: Entering directory '/home/MrDude/switch/libusbhsfs/libntfs-3g'
warning: patch-2.7.6-1 is up to date -- skipping
warning: autotools-2022.01.16-2 is up to date -- skipping
warning: tar-1.34-3 is up to date -- skipping
warning: bzip2-1.0.8-4 is up to date -- skipping
warning: diffutils-3.8-3 is up to date -- skipping
warning: pkgconf-1.8.0-1 is up to date -- skipping
error: failed to commit transaction (conflicting files)
==> ERROR: 'pacman' failed to install missing dependencies.
==> ERROR: Could not resolve all dependencies.
make[1]: *** [Makefile:13: all] Error 8
make[1]: Leaving directory '/home/MrDude/switch/libusbhsfs/libntfs-3g'
make: *** [Makefile:147: fs-libs] Error 2

MrDude@MrDude MSYS ~/switch/libusbhsfs
# pacman -Syu switch-ntfs-3g
:: Synchronizing package databases...
 mingw32 is up to date
 mingw64 is up to date
 ucrt64 is up to date
 clang64 is up to date
 msys is up to date
 dkp-libs is up to date
 dkp-windows is up to date
error: target not found: switch-ntfs-3g

MrDude@MrDude MSYS ~/switch/libusbhsfs
# pacman -Syu switch-lwext4
:: Synchronizing package databases...
 mingw32 is up to date
 mingw64 is up to date
 ucrt64 is up to date
 clang64 is up to date
 msys is up to date
 dkp-libs is up to date
 dkp-windows is up to date
error: target not found: switch-lwext4
DarkMatterCore commented 2 years ago

Run make fs-libs before attempting to build the library.

May I ask why that must be done manually, instead of make automatically doing that itself as part of the process?

To potentially avoid wasting time on building both packages if they aren't needed -- libusbhsfs codebase may be updated more frequently than the FS libraries it relies on.

A package version check using pacman or makepkg (or a combination of both?) could probably be added into dev, but I haven't looked into it.

Thanks, I get this error trying that make fs-libs

Ah, seems like I forgot to use dkp-pacman instead of pacman on distros without pacman. I'll take care of that.

DarkMatterCore commented 2 years ago

In windows:

Look into disabling automatic LF -> CRLF conversion in git under Windows. It can mess up the patch files.

mrdude2478 commented 2 years ago

I can build older versions of this lib in windows, just not this new updated version - so I doubt that's the issue. Also how do I do that?

DarkMatterCore commented 2 years ago

I can build older versions of this lib in windows, just not this new updated version - so I doubt that's the issue. Also how do I do that?

It can be an issue -- changing line endings completely changes the checksums of patch files applied to both NTFS-3G and lwext4 tarballs before building.

mrdude2478 commented 2 years ago

I'm not disputing that, but all other stuff builds fine without any issues. Anyway how do you change that in windows"mysys2" shell?

mrdude2478 commented 2 years ago

I just did this:

git config --global core.autocrlf true git config --global core.eol crlf

Then: make fs-libs

But I'm still getting the same errors as above.

DarkMatterCore commented 2 years ago

Just switched to the PC, following threads on my phone can be a bit cumbersome.

MrDude@MrDude MSYS ~/switch/libusbhsfs
# pacman -Syu switch-ntfs-3g
error: target not found: switch-ntfs-3g

MrDude@MrDude MSYS ~/switch/libusbhsfs
# pacman -Syu switch-lwext4
error: target not found: switch-lwext4

You can't install these packages through DKP's pacman repository -- as I said earlier, they won't ever be part of it because of DKP's policies. Which is why they must be manually built and installed via make fs-libs. As explained in the readme, this will always be a required step.

MrDude@MrDude MSYS ~/switch/libusbhsfs
# make fs-libs
Installing ntfs-3g
error: failed to commit transaction (conflicting files)
==> ERROR: 'pacman' failed to install missing dependencies.
==> ERROR: Could not resolve all dependencies.

Okay, so I just took a better look at the error messages.

pacman output is being intentionally silenced in the Makefile script from the libntfs-3g directory, but I suspect a conflict between pkg-config and pkgconf is causing the issue. pkgconf is supposed to be a better replacement for pkg-config, but they use the same filepaths. Read more about this kind of conflict here.

You can just modify that Makefile script to disable output silencing and check if pkg-config is the source of the problem.

Alternatively, you can just check if pkg-config is installed. If so, uninstall it, then re-run make fs-libs.

mrdude2478 commented 2 years ago

OK checked that, now I am getting this error:

==> Missing dependencies:
  -> dkp-toolchain-vars

So pacman -Syu dkp-toolchain-vars

Says it's already have - dkp-toolchain-vars-1.0.2-1 installed, I've manually removed and reinstalled and now make fs-libs is working. Thanks.

EDIT:

Seems I also need to manually remove these:
(1/1) checking for file conflicts                                              [###########################################] 100%
error: failed to commit transaction (conflicting files)
switch-libntfs-3g: /opt/devkitpro/portlibs/switch/licenses/switch-libntfs-3g/LICENSE exists in filesystem
switch-libntfs-3g: /opt/devkitpro/portlibs/switch/share/doc/ntfs-3g/README exists in filesystem
Errors occurred, no packages were upgraded.
==> WARNING: Failed to install built package(s).
mrdude2478 commented 2 years ago

Eventually make fs-libs worked, but I still get the same errors while building:

C:/msys64/home/MrDude/switch/libusbhsfs/source/ntfs-3g/ntfs_dev.c: In function 'ntfsdev_statvfs':
C:/msys64/home/MrDude/switch/libusbhsfs/source/ntfs-3g/ntfs_dev.c:825:10: error: implicit declaration of function 'NVolFreeSpaceKn
own' [-Werror=implicit-function-declaration]
  825 |     if (!NVolFreeSpaceKnown(vd->vol) && ntfs_volume_get_free_space(vd->vol) < 0) ntfs_set_error_and_exit(ENOSPC);
      |          ^~~~~~~~~~~~~~~~~~
cc1.exe: all warnings being treated as errors
make[1]: *** [/opt/olddevkitpro/devkitA64/base_rules:19: ntfs_dev.o] Error 1
make: *** [Makefile:154: lib/libusbhsfs.a] Error 2
DarkMatterCore commented 2 years ago
make[1]: *** [/opt/olddevkitpro/devkitA64/base_rules:19: ntfs_dev.o] Error 1

Your 'old' DKP installation may very well be conflicting with your current one... Make sure your environment variables point to the right paths.

mrdude2478 commented 2 years ago

Yep, it could be that. I switched the bash.rc file I was using, but also manually removed libusbhsfs.a from the lib folder and this time it installed properly.

Thanks for your help.

DarkMatterCore commented 2 years ago

No problem, glad to help.