JasonFerrara / jmtpfs

GNU General Public License v3.0
162 stars 19 forks source link

Compile errors on OSX 10.13.6: undeclared identifier 'EROFS' #15

Open weaver299 opened 5 years ago

weaver299 commented 5 years ago

I'm attempting to compile on MacOS 10.13.6 and getting these errors:

In file included from jmtpfs.cpp:23:
./mtpFilesystemErrors.h:94:47: error: use of undeclared identifier 'EROFS'
        ReadOnly() : MtpFilesystemErrorWithErrorCode(EROFS, "read only") {}
                                                     ^
./mtpFilesystemErrors.h:100:59: error: use of undeclared identifier 'ENOTEMPTY'
        MtpDirectoryNotEmpty() : MtpFilesystemErrorWithErrorCode(ENOTEMPTY, "Directoy not empty") {};
                                                                 ^
./mtpFilesystemErrors.h:112:53: error: use of undeclared identifier 'ENAMETOOLONG'
        MtpNameTooLong() : MtpFilesystemErrorWithErrorCode(ENAMETOOLONG, "Filename too long") {};

(more detailed output below)

I'm guessing there's some kind of C library I'm missing. I have libmtp, libmagic, and osxfuse installed via brew, and it seems to be finding those libraries without trouble. I thought it might be my version of gcc, so I installed brew's version and set environment variables to point to those binaries and re-ran configure and make, and it looks like it picked up those differences, but the errors happened again anyway..

Any idea what I'm missing / doing wrong?

I have googled the errors, and the constants themselves, but wasn't able to find anything leading me in the right direction..

TSO-NC200742:jmtpfs weaver.299$ export GXX='/usr/local/Cellar/gcc/9.1.0/bin/g++-9'
TSO-NC200742:jmtpfs weaver.299$ export CC='/usr/local/Cellar/gcc/9.1.0/bin/gcc-9'
TSO-NC200742:jmtpfs weaver.299$ export CPP='/usr/local/Cellar/gcc/9.1.0/bin/cpp-9'
TSO-NC200742:jmtpfs weaver.299$ ./configure
checking build system type... x86_64-apple-darwin17.7.0
checking host system type... x86_64-apple-darwin17.7.0
checking target system type... x86_64-apple-darwin17.7.0
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for MTP... yes
checking for FUSE... yes
checking for gcc... /usr/local/Cellar/gcc/9.1.0/bin/gcc-9
checking whether we are using the GNU C compiler... yes
checking whether /usr/local/Cellar/gcc/9.1.0/bin/gcc-9 accepts -g... yes
checking for /usr/local/Cellar/gcc/9.1.0/bin/gcc-9 option to accept ISO C89... none needed
checking dependency style of /usr/local/Cellar/gcc/9.1.0/bin/gcc-9... gcc3
checking for magic_open in -lmagic... yes
checking how to run the C preprocessor... /usr/local/Cellar/gcc/9.1.0/bin/cpp-9
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking magic.h usability... yes
checking magic.h presence... yes
checking for magic.h... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: executing depfiles commands
TSO-NC200742:jmtpfs weaver.299$ make
Making all in src
g++ -DPACKAGE_NAME=\"jmtpfs\" -DPACKAGE_TARNAME=\"jmtpfs\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"jmtpfs\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"jmtpfs\" -DVERSION=\"1.0\" -DHAVE_LIBMAGIC=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MAGIC_H=1 -I.  -framework IOKit -I/usr/local/Cellar/libmtp/1.1.16/include -I/usr/local/Cellar/libusb/1.0.22/include/libusb-1.0 -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -I/usr/local/include/osxfuse/fuse   -g -O2 -std=c++0x -MT jmtpfs-jmtpfs.o -MD -MP -MF .deps/jmtpfs-jmtpfs.Tpo -c -o jmtpfs-jmtpfs.o `test -f 'jmtpfs.cpp' || echo './'`jmtpfs.cpp
clang: warning: -framework IOKit: 'linker' input unused [-Wunused-command-line-argument]
In file included from jmtpfs.cpp:23:
./mtpFilesystemErrors.h:94:47: error: use of undeclared identifier 'EROFS'
        ReadOnly() : MtpFilesystemErrorWithErrorCode(EROFS, "read only") {}
                                                     ^
./mtpFilesystemErrors.h:100:59: error: use of undeclared identifier 'ENOTEMPTY'
        MtpDirectoryNotEmpty() : MtpFilesystemErrorWithErrorCode(ENOTEMPTY, "Directoy not empty") {};
                                                                 ^
./mtpFilesystemErrors.h:112:53: error: use of undeclared identifier 'ENAMETOOLONG'
        MtpNameTooLong() : MtpFilesystemErrorWithErrorCode(ENAMETOOLONG, "Filename too long") {};
                                                           ^
3 errors generated.
make[1]: *** [jmtpfs-jmtpfs.o] Error 1
make: *** [all-recursive] Error 1
TSO-NC200742:jmtpfs weaver.299$ make check
Making check in src
g++ -DPACKAGE_NAME=\"jmtpfs\" -DPACKAGE_TARNAME=\"jmtpfs\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"jmtpfs\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"jmtpfs\" -DVERSION=\"1.0\" -DHAVE_LIBMAGIC=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MAGIC_H=1 -I.  -framework IOKit -I/usr/local/Cellar/libmtp/1.1.16/include -I/usr/local/Cellar/libusb/1.0.22/include/libusb-1.0 -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -I/usr/local/include/osxfuse/fuse   -g -O2 -std=c++0x -MT jmtpfs-jmtpfs.o -MD -MP -MF .deps/jmtpfs-jmtpfs.Tpo -c -o jmtpfs-jmtpfs.o `test -f 'jmtpfs.cpp' || echo './'`jmtpfs.cpp
clang: warning: -framework IOKit: 'linker' input unused [-Wunused-command-line-argument]
In file included from jmtpfs.cpp:23:
./mtpFilesystemErrors.h:94:47: error: use of undeclared identifier 'EROFS'
        ReadOnly() : MtpFilesystemErrorWithErrorCode(EROFS, "read only") {}
                                                     ^
./mtpFilesystemErrors.h:100:59: error: use of undeclared identifier 'ENOTEMPTY'
        MtpDirectoryNotEmpty() : MtpFilesystemErrorWithErrorCode(ENOTEMPTY, "Directoy not empty") {};
                                                                 ^
./mtpFilesystemErrors.h:112:53: error: use of undeclared identifier 'ENAMETOOLONG'
        MtpNameTooLong() : MtpFilesystemErrorWithErrorCode(ENAMETOOLONG, "Filename too long") {};
                                                           ^
3 errors generated.
make[1]: *** [jmtpfs-jmtpfs.o] Error 1
make: *** [check-recursive] Error 1
itsgucci commented 5 years ago

I am also having this same issue.

I tried including errorno.h and this solved the problem of the constants being undefined, but this only had other issues

sebastianhaberey commented 5 years ago

"The undefined errors are simply part of the <sys/errno> headers and the headers so simply add:

#include <sys/errno.h> 
#include <string>

to src/mtpFilesystemErrors.h."

Credits to Mark Heath (here).