Skip to content
This repository has been archived by the owner on Nov 9, 2024. It is now read-only.

trying to build ufs filesystem on macOS - failing #46

Closed
luckman212 opened this issue Jan 19, 2022 · 10 comments
Closed

trying to build ufs filesystem on macOS - failing #46

luckman212 opened this issue Jan 19, 2022 · 10 comments
Assignees

Comments

@luckman212
Copy link

I'm trying to build the ufs filesystem for use on macOS. My Mac is running 12.1 Monterey (ARM) and has Xcode 13.2.1

This is what I get, anyone got any idea how to fix this or if it's even fixable?

~/.../filesystems-c/unixfs/ufs $ make
cc -I/usr/local/include/fuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  unixfs_ufs.c -c -o unixfs_ufs.o
In file included from unixfs_ufs.c:7:
In file included from ./ufs.h:11:
../common/linux/linux.h:377:37: error: use of undeclared identifier 'BITS_PER_LONG'
    const unsigned long* p = addr + BITOP_WORD(offset);
                                    ^
../common/linux/linux.h:265:34: note: expanded from macro 'BITOP_WORD'
#define BITOP_WORD(nr)   ((nr) / BITS_PER_LONG)
                                 ^
../common/linux/linux.h:378:39: error: use of undeclared identifier 'BITS_PER_LONG'
    unsigned long result = offset & ~(BITS_PER_LONG-1);
                                      ^
../common/linux/linux.h:385:15: error: use of undeclared identifier 'BITS_PER_LONG'
    offset %= BITS_PER_LONG;
              ^
../common/linux/linux.h:389:25: error: use of undeclared identifier 'BITS_PER_LONG'
        tmp |= ~0UL >> (BITS_PER_LONG - offset);
                        ^
../common/linux/linux.h:390:20: error: use of undeclared identifier 'BITS_PER_LONG'
        if (size < BITS_PER_LONG)
                   ^
../common/linux/linux.h:394:17: error: use of undeclared identifier 'BITS_PER_LONG'
        size -= BITS_PER_LONG;
                ^
../common/linux/linux.h:395:19: error: use of undeclared identifier 'BITS_PER_LONG'
        result += BITS_PER_LONG;
                  ^
../common/linux/linux.h:398:21: error: use of undeclared identifier 'BITS_PER_LONG'
    while (size & ~(BITS_PER_LONG-1)) {
                    ^
../common/linux/linux.h:401:19: error: use of undeclared identifier 'BITS_PER_LONG'
        result += BITS_PER_LONG;
                  ^
../common/linux/linux.h:402:17: error: use of undeclared identifier 'BITS_PER_LONG'
        size -= BITS_PER_LONG;
                ^
In file included from unixfs_ufs.c:7:
In file included from ./ufs.h:16:
../common/linux/kernel/fs/ufs/ufs.h:147:2: error: invalid output constraint '=a' in asm
        do_div(b, uspi->s_fpg);
        ^
../common/linux/linux.h:425:12: note: expanded from macro 'do_div'
    asm("":"=a" (__low), "=d" (__high) : "A" (n));      \
           ^
In file included from unixfs_ufs.c:7:
In file included from ./ufs.h:16:
../common/linux/kernel/fs/ufs/ufs.h:147:2: error: invalid output constraint '=a' in asm
../common/linux/linux.h:431:19: note: expanded from macro 'do_div'
    asm("divl %2":"=a" (__low), "=d" (__mod)        \
                  ^
In file included from unixfs_ufs.c:7:
In file included from ./ufs.h:16:
../common/linux/kernel/fs/ufs/ufs.h:147:2: error: invalid output constraint '=A' in asm
../common/linux/linux.h:433:12: note: expanded from macro 'do_div'
    asm("":"=A" (n) : "a" (__low), "d" (__high));       \
           ^
In file included from unixfs_ufs.c:7:
In file included from ./ufs.h:16:
../common/linux/kernel/fs/ufs/ufs.h:153:9: error: invalid output constraint '=a' in asm
        return do_div(b, uspi->s_fpg);
               ^
../common/linux/linux.h:425:12: note: expanded from macro 'do_div'
    asm("":"=a" (__low), "=d" (__high) : "A" (n));      \
           ^
In file included from unixfs_ufs.c:7:
In file included from ./ufs.h:16:
../common/linux/kernel/fs/ufs/ufs.h:153:9: error: invalid output constraint '=a' in asm
../common/linux/linux.h:431:19: note: expanded from macro 'do_div'
    asm("divl %2":"=a" (__low), "=d" (__mod)        \
                  ^
In file included from unixfs_ufs.c:7:
In file included from ./ufs.h:16:
../common/linux/kernel/fs/ufs/ufs.h:153:9: error: invalid output constraint '=A' in asm
../common/linux/linux.h:433:12: note: expanded from macro 'do_div'
    asm("":"=A" (n) : "a" (__low), "d" (__high));       \
           ^
16 errors generated.
make: *** [unixfs_ufs.o] Error 1
@bfleischer
Copy link
Member

The ufs example file system is really old and has not seen an update in 7 years. If you get it to work I'll happily accept a pull request, but I don't have the time or resources to maintain the file system.

@bfleischer bfleischer self-assigned this Jan 19, 2022
@luckman212
Copy link
Author

@bfleischer Ok, thanks for looking. Sadly that's above my pay grade. I'm going to punt and just try to run it in an Ubuntu20 x64 VM. 😞

@bixfrankonis
Copy link

The ufs example file system is really old and has not seen an update in 7 years. If you get it to work I'll happily accept a pull request, but I don't have the time or resources to maintain the file system.

Ah crap. This was my last hope at accessing an old OpenBSD drive with most of my early-2000s blogging on it.

@ctsrc
Copy link

ctsrc commented Jun 4, 2023

@bixfrankonis could it help you if you use dd to make an image of the drive, and then boot OpenBSD in a VM and mount the image of the drive inside the OpenBSD VM?

@bixfrankonis
Copy link

@bixfrankonis could it help you if you use dd to make an image of the drive, and then boot OpenBSD in a VM and mount the image of the drive inside the OpenBSD VM?

Alas, no, because I don't have room to dd a 300GB drive.

@ctsrc
Copy link

ctsrc commented Jun 10, 2023

@bixfrankonis I saw on your website that you have an Amazon wishlist.

If you can find a decent 1 TB SSD or a 4 TB HDD, that fits your computer, on Amazon and which does not cost more than about $75 USD like for example this one https://www.amazon.com/Seagate-IronWolf-Internal-Hard-Drive/dp/B09NHV3CK9/ and you add it to your Amazon wishlist I will order it for you and then you will be able to dd an image of your drive.

@cklein
Copy link

cklein commented Aug 4, 2024

@luckman212 I just created a pull request: #51
I tested my change with a NeXTStep cd image and it works fine. Could you please give it a try?

@luckman212
Copy link
Author

@cklein Thank you. To be honest it's been a long time and I've forgotten how I set up my build environment. When I tried just now cloning the repo and checking out your PR, I failed to compile it, missing some lib: library 'osxfuse.2' not found. And I didn't have the time to figure out what was wrong.

…/osxfuse_pr51/filesystems-c/unixfs/ufs@pr-51 $ make
cc -I/usr/local/include/osxfuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  unixfs_ufs.c -c -o unixfs_ufs.o
cc -I/usr/local/include/osxfuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  -MM unixfs_ufs.c > unixfs_ufs.d
cc -I/usr/local/include/osxfuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  ufs_mainx.c -c -o ufs_mainx.o
cc -I/usr/local/include/osxfuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  -MM ufs_mainx.c > ufs_mainx.d
cc -I/usr/local/include/osxfuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  ufs.c -c -o ufs.o
cc -I/usr/local/include/osxfuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  -MM ufs.c > ufs.d
cc -I/usr/local/include/osxfuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  ../common/unixfs/unixfs.c -c -o ../common/unixfs/unixfs.o
cc -I/usr/local/include/osxfuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  -MM ../common/unixfs/unixfs.c > ../common/unixfs/unixfs.d
cc -I/usr/local/include/osxfuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  ../common/unixfs/unixfs_internal.c -c -o ../common/unixfs/unixfs_internal.o
cc -I/usr/local/include/osxfuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  -MM ../common/unixfs/unixfs_internal.c > ../common/unixfs/unixfs_internal.d
cc -I/usr/local/include/osxfuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  ../common/linux/linux.c -c -o ../common/linux/linux.o
cc -I/usr/local/include/osxfuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  -MM ../common/linux/linux.c > ../common/linux/linux.d
cc -I/usr/local/include/osxfuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  ../common/linux/kernel/lib/parser.c -c -o ../common/linux/kernel/lib/parser.o
cc -I/usr/local/include/osxfuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  -MM ../common/linux/kernel/lib/parser.c > ../common/linux/kernel/lib/parser.d
cc -I/usr/local/include/osxfuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -DFUSE_USE_VERSION=27 -I. -I../common/linux -I../common/linux/kernel/include -I../common/linux/kernel/fs -I../common/unixfs -Wall -Werror -g  -o ufs unixfs_ufs.o ufs_mainx.o ufs.o ../common/unixfs/unixfs.o ../common/unixfs/unixfs_internal.o ../common/linux/linux.o ../common/linux/kernel/lib/parser.o -L/usr/local/lib -losxfuse.2
ld: library 'osxfuse.2' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ufs] Error 1

@cklein
Copy link

cklein commented Aug 4, 2024

I freshly installed macfuse today, ls -l /usr/local/lib/lib*fuse*dylib shows this output:

-rwxr-xr-x  1 root  wheel  531744 11 Jun 01:05 /usr/local/lib/libfuse.2.dylib
lrwxr-xr-x  1 root  wheel      15  4 Aug 10:22 /usr/local/lib/libfuse.dylib -> libfuse.2.dylib
lrwxr-xr-x  1 root  wheel      15  4 Aug 10:22 /usr/local/lib/libosxfuse.2.dylib -> libfuse.2.dylib
lrwxr-xr-x  1 root  wheel      15  4 Aug 10:22 /usr/local/lib/libosxfuse_i64.2.dylib -> libfuse.2.dylib

@bfleischer
Copy link
Member

This repository contains legacy demo file systems that are unmaintained. Therefore I'm closing the issue. Please refer to https://github.com/macfuse/demo for maintained demo file systems.

@bfleischer bfleischer closed this as not planned Won't fix, can't repro, duplicate, stale Nov 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants