sdk
sdk copied to clipboard
Issues building on OpenBSD
I am trying to build the SDK on OpenBSD but have run into a few issues building.
include/mega/posix/megafs.h requires adding OpenBSD to where FreeBSD is.
src/http.cpp OpenBSD does not have AI_V4MAPPED. I had a patch of..
+#ifdef __OpenBSD__
+ hints.ai_flags = AI_ADDRCONFIG;
+#else
hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG;
+#endif
But you might want to handle it in a different manner.
src/posix/fs.cpp:1813:50: error: no member named 'f_type' in 'statfs'
LOG_info << "Filesystem type: " << statfsbuf.f_type;
~~~~~~~~~ ^
src/posix/fs.cpp:1819:22: error: no member named 'f_type' in 'statfs'
return statfsbuf.f_type != 0x4d44 // FAT
~~~~~~~~~ ^
src/posix/fs.cpp:1820:22: error: no member named 'f_type' in 'statfs'
&& statfsbuf.f_type != 0x65735546; // FUSE
~~~~~~~~~ ^
3 errors generated.
OpenBSD does not have a f_type field. FreeBSD and macOS do.
OpenBSD does have f_fstypename like macOS.
From sys/mount.h...
/* new statfs structure with mount options and statvfs fields */
struct statfs {
u_int32_t f_flags; /* copy of mount flags */
u_int32_t f_bsize; /* file system block size */
u_int32_t f_iosize; /* optimal transfer block size */
/* unit is f_bsize */
u_int64_t f_blocks; /* total data blocks in file system */
u_int64_t f_bfree; /* free blocks in fs */
int64_t f_bavail; /* free blocks avail to non-superuser */
u_int64_t f_files; /* total file nodes in file system */
u_int64_t f_ffree; /* free file nodes in fs */
int64_t f_favail; /* free file nodes avail to non-root */
u_int64_t f_syncwrites; /* count of sync writes since mount */
u_int64_t f_syncreads; /* count of sync reads since mount */
u_int64_t f_asyncwrites; /* count of async writes since mount */
u_int64_t f_asyncreads; /* count of async reads since mount */
fsid_t f_fsid; /* file system id */
u_int32_t f_namemax; /* maximum filename length */
uid_t f_owner; /* user that mounted the file system */
u_int64_t f_ctime; /* last mount [-u] time */
char f_fstypename[MFSNAMELEN]; /* fs type name */
char f_mntonname[MNAMELEN]; /* directory on which mounted */
char f_mntfromname[MNAMELEN]; /* mounted file system */
char f_mntfromspec[MNAMELEN]; /* special for mount request */
union mount_info mount_info; /* per-filesystem mount options */
};
/*
* File system types.
*/
#define MOUNT_FFS "ffs" /* UNIX "Fast" Filesystem */
#define MOUNT_UFS MOUNT_FFS /* for compatibility */
#define MOUNT_NFS "nfs" /* Network Filesystem */
#define MOUNT_MFS "mfs" /* Memory Filesystem */
#define MOUNT_MSDOS "msdos" /* MSDOS Filesystem */
#define MOUNT_AFS "afs" /* Andrew Filesystem */
#define MOUNT_CD9660 "cd9660" /* ISO9660 (aka CDROM) Filesystem */
#define MOUNT_EXT2FS "ext2fs" /* Second Extended Filesystem */
#define MOUNT_NCPFS "ncpfs" /* NetWare Network File System */
#define MOUNT_NTFS "ntfs" /* NTFS */
#define MOUNT_UDF "udf" /* UDF */
#define MOUNT_TMPFS "tmpfs" /* tmpfs */
#define MOUNT_FUSEFS "fuse" /* FUSE */
ping.
I noticed the src/posix/fs.cpp issue has been resolved with the relevant code being ifdef __liniux__'d
.
I created a PR https://github.com/meganz/sdk/pull/2650 to take care of the rest.