Macでソフトウェア開発を始めようと思い、試しに適当なプログラムをビルドしようとしていますが、
unknown type name 'uint64_t'
みたいなエラーが大量に出て困っています。
Googleで調べてみると、includeパスのディレクトリを変えればいいとか書いてありますが、該当の場所にディレクトリが存在しませんでした。
とりあえずMinGWやUbuntuではビルドできていたプログラムなので、MacOSのSDKそのものに定義がないような気がしますが、どのように対処していますか?あまり、Cに詳しい方でもない上に、MacOSを触るのはG3マシン以来なので、原因がよくわかりません。
使用しているgccは以下のように出力しています:
$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
ビルドログは以下のとおりです:
logue@Logue-Mac vorbis % ./build.sh
checking build system type... x86_64-apple-darwin19.0.0
checking host system type... x86_64-apple-darwin19.0.0
checking target system type... x86_64-apple-darwin19.0.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /Users/logue/Documents/mac-frameworks/vorbis/src/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make supports nested variables... (cached) yes
checking for gcc... /Applications/Xcode.app/Contents/Developer/usr/bin/gcc
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 /Applications/Xcode.app/Contents/Developer/usr/bin/gcc accepts -g... yes
checking for /Applications/Xcode.app/Contents/Developer/usr/bin/gcc option to accept ISO C89... none needed
checking whether /Applications/Xcode.app/Contents/Developer/usr/bin/gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of /Applications/Xcode.app/Contents/Developer/usr/bin/gcc... gcc3
checking how to run the C preprocessor... /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -E
checking for inline... inline
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by /Applications/Xcode.app/Contents/Developer/usr/bin/gcc... /Applications/Xcode.app/Contents/Developer/usr/bin/g++
checking if the linker (/Applications/Xcode.app/Contents/Developer/usr/bin/g++) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking how to convert x86_64-apple-darwin19.0.0 file names to x86_64-apple-darwin19.0.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin19.0.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/usr/bin/g++ option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... dlltool
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from /Applications/Xcode.app/Contents/Developer/usr/bin/gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
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 for dlfcn.h... yes
checking for objdir... .libs
checking if /Applications/Xcode.app/Contents/Developer/usr/bin/gcc supports -fno-rtti -fno-exceptions... yes
checking for /Applications/Xcode.app/Contents/Developer/usr/bin/gcc option to produce PIC... -fno-common -DPIC
checking if /Applications/Xcode.app/Contents/Developer/usr/bin/gcc PIC flag -fno-common -DPIC works... yes
checking if /Applications/Xcode.app/Contents/Developer/usr/bin/gcc static flag -static works... no
checking if /Applications/Xcode.app/Contents/Developer/usr/bin/gcc supports -c -o file.o... yes
checking if /Applications/Xcode.app/Contents/Developer/usr/bin/gcc supports -c -o file.o... (cached) yes
checking whether the /Applications/Xcode.app/Contents/Developer/usr/bin/gcc linker (/Applications/Xcode.app/Contents/Developer/usr/bin/g++) supports shared libraries... yes
checking dynamic linker characteristics... darwin19.0.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking GCC version... 4.2.1
checking if /Applications/Xcode.app/Contents/Developer/usr/bin/gcc accepts -Wdeclaration-after-statement... yes
checking for memory.h... (cached) yes
checking for cos in -lm... yes
checking for pthread_create in -lpthread... yes
checking for pkg-config... no
checking for Ogg... yes
checking for oggpack_writealign... yes
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for working memcmp... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating m4/Makefile
config.status: creating lib/Makefile
config.status: creating lib/modes/Makefile
config.status: creating lib/books/Makefile
config.status: creating lib/books/coupled/Makefile
config.status: creating lib/books/uncoupled/Makefile
config.status: creating lib/books/floor/Makefile
config.status: creating doc/Makefile
config.status: creating doc/vorbisfile/Makefile
config.status: creating doc/vorbisenc/Makefile
config.status: creating doc/libvorbis/Makefile
config.status: creating doc/Doxyfile
config.status: creating include/Makefile
config.status: creating include/vorbis/Makefile
config.status: creating examples/Makefile
config.status: creating test/Makefile
config.status: creating vq/Makefile
config.status: creating libvorbis.spec
config.status: creating vorbis.pc
config.status: creating vorbisenc.pc
config.status: creating vorbisfile.pc
config.status: creating vorbis-uninstalled.pc
config.status: creating vorbisenc-uninstalled.pc
config.status: creating vorbisfile-uninstalled.pc
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
make all-recursive
Making all in m4
make[2]: Nothing to be done for `all'.
Making all in include
Making all in vorbis
make[3]: Nothing to be done for `all'.
make[3]: Nothing to be done for `all-am'.
Making all in vq
make[2]: Nothing to be done for `all'.
Making all in lib
Making all in modes
make[3]: Nothing to be done for `all'.
Making all in books
Making all in coupled
make[4]: Nothing to be done for `all'.
Making all in uncoupled
make[4]: Nothing to be done for `all'.
Making all in floor
make[4]: Nothing to be done for `all'.
make[4]: Nothing to be done for `all-am'.
CC mdct.lo
CC smallft.lo
CC block.lo
CC envelope.lo
CC window.lo
CC lsp.lo
CC lpc.lo
CC analysis.lo
In file included from /Users/logue/Documents/mac-frameworks/vorbis/src/lib/analysis.c:20:
In file included from /Users/logue/Documents/mac-frameworks/ogg/installs/x86_64/include/ogg/ogg.h:24:
/Users/logue/Documents/mac-frameworks/ogg/installs/x86_64/include/ogg/os_types.h:75:12: error:
unknown type name 'uint16_t'
typedef uint16_t ogg_uint16_t;
^
/Users/logue/Documents/mac-frameworks/ogg/installs/x86_64/include/ogg/os_types.h:77:12: error:
unknown type name 'uint32_t'
typedef uint32_t ogg_uint32_t;
^
/Users/logue/Documents/mac-frameworks/ogg/installs/x86_64/include/ogg/os_types.h:79:12: error:
unknown type name 'uint64_t'
typedef uint64_t ogg_uint64_t;
^
3 errors generated.
make[3]: *** [analysis.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Making install in m4
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
Making install in include
Making install in vorbis
make[3]: Nothing to be done for `install-exec-am'.
/Users/logue/Documents/mac-frameworks/vorbis/src/install-sh -c -d '/Users/logue/Documents/mac-frameworks/vorbis/installs/x86_64/include/vorbis'
/usr/bin/install -c -m 644 /Users/logue/Documents/mac-frameworks/vorbis/src/include/vorbis/codec.h /Users/logue/Documents/mac-frameworks/vorbis/src/include/vorbis/vorbisfile.h /Users/logue/Documents/mac-frameworks/vorbis/src/include/vorbis/vorbisenc.h '/Users/logue/Documents/mac-frameworks/vorbis/installs/x86_64/include/vorbis'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
Making install in vq
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
Making install in lib
Making install in modes
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
Making install in books
Making install in coupled
make[4]: Nothing to be done for `install-exec-am'.
make[4]: Nothing to be done for `install-data-am'.
Making install in uncoupled
make[4]: Nothing to be done for `install-exec-am'.
make[4]: Nothing to be done for `install-data-am'.
Making install in floor
make[4]: Nothing to be done for `install-exec-am'.
make[4]: Nothing to be done for `install-data-am'.
make[4]: Nothing to be done for `install-exec-am'.
make[4]: Nothing to be done for `install-data-am'.
CC analysis.lo
In file included from /Users/logue/Documents/mac-frameworks/vorbis/src/lib/analysis.c:20:
In file included from /Users/logue/Documents/mac-frameworks/ogg/installs/x86_64/include/ogg/ogg.h:24:
/Users/logue/Documents/mac-frameworks/ogg/installs/x86_64/include/ogg/os_types.h:75:12: error:
unknown type name 'uint16_t'
typedef uint16_t ogg_uint16_t;
^
/Users/logue/Documents/mac-frameworks/ogg/installs/x86_64/include/ogg/os_types.h:77:12: error:
unknown type name 'uint32_t'
typedef uint32_t ogg_uint32_t;
^
/Users/logue/Documents/mac-frameworks/ogg/installs/x86_64/include/ogg/os_types.h:79:12: error:
unknown type name 'uint64_t'
typedef uint64_t ogg_uint64_t;
^
3 errors generated.
make[2]: *** [analysis.lo] Error 1
make[1]: *** [install-recursive] Error 1
make: *** [install-recursive] Error 1
uint64_t
型の定義はcstdint
(あるいはstdint.h
)にありますが、includeしていますか?