PeterHuewe / tpm-emulator

The famous tpm-emulator by Mario Strasser, previously hosted on BerliOs. It supports TPM1.2 only!
GNU General Public License v2.0
175 stars 75 forks source link

Make fails on MacOS #16

Open Artosach opened 8 years ago

Artosach commented 8 years ago

Hi,

I try to install the tpm-emulator (v 0.7.4) on MacOS Sierra

After installing the dependencies the make process fails at 75% ... as shown bellow:

[ 75%] Building C object crypto/CMakeFiles/tpm_crypto.dir/rsa.o /tpm_emulator-0.7.4/crypto/rsa.c:56:13: error: address of array 'key->p' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] if (!key->p || !key->q || !key->u) {


/tpm_emulator-0.7.4/crypto/rsa.c:56:24: error: address of
      array 'key->q' will always evaluate to 'true'
      [-Werror,-Wpointer-bool-conversion]
  if (!key->p || !key->q || !key->u) {
                      ~~~~~~^
/tpm_emulator-0.7.4/crypto/rsa.c:56:35: error: address of
      array 'key->u' will always evaluate to 'true'
      [-Werror,-Wpointer-bool-conversion]
  if (!key->p || !key->q || !key->u) {
                                        ~~~~~~^
3 errors generated.
make[2]: *** [crypto/CMakeFiles/tpm_crypto.dir/rsa.o] Error 1
make[1]: *** [crypto/CMakeFiles/tpm_crypto.dir/all] Error 2
make: *** [all] Error 2

Any idea ?

Thx for your help
PeterHuewe commented 8 years ago

Hi, probably you have -Werror in your CFLAGS, so you can unset them by export CFLAGS="-Wnoerror" Peter

Am 6. November 2016 11:30:36 MEZ, schrieb Artosach notifications@github.com:

Hi,

I try to install the tpm-emulator (v 0.7.4) on MacOS Sierra

After installing the dependencies the make process fails at 75% ... as shown bellow:

[ 75%] Building C object crypto/CMakeFiles/tpm_crypto.dir/rsa.o /tpm_emulator-0.7.4/crypto/rsa.c:56:13: error: address of array 'key->p' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] if (!key->p || !key->q || !key->u) {


/tpm_emulator-0.7.4/crypto/rsa.c:56:24: error: address of
     array 'key->q' will always evaluate to 'true'
     [-Werror,-Wpointer-bool-conversion]
 if (!key->p || !key->q || !key->u) {
                     ~~~~~~^
/tpm_emulator-0.7.4/crypto/rsa.c:56:35: error: address of
     array 'key->u' will always evaluate to 'true'
     [-Werror,-Wpointer-bool-conversion]
 if (!key->p || !key->q || !key->u) {
                                       ~~~~~~^
3 errors generated.
make[2]: **\* [crypto/CMakeFiles/tpm_crypto.dir/rsa.o] Error 1
make[1]: **\* [crypto/CMakeFiles/tpm_crypto.dir/all] Error 2
make: **\* [all] Error 2

Any idea ?

Thx for your help

Sent from my mobile

Artosach commented 7 years ago

Hi Peter, I sat the CFLAGS as recommended. Unfortunately with no success, I still have exactly the same error. Any other advice ?

PeterHuewe commented 7 years ago

Ah sorry -Wno-error should do it. Peter

PeterHuewe commented 7 years ago

Sorry, I didn't read correctly. You are trying to compile with clang... that's an important information. I will have to fix a few things for this to work.

deitch commented 7 years ago

Hi @PeterHuewe, is there a workaround for this?

deitch commented 7 years ago

FYI, I did get it to build by running cmake manually in build/ with:

cmake -Wno-error=pointer-bool-conversion ../
deitch commented 7 years ago

Hmm, cannot install the kext on Mac:

$ sudo kextutil -verbose -t /System/Library/Extensions/tpm_bridge.kext
Defaulting to kernel file '/System/Library/Kernels/kernel'
/System/Library/Extensions/tpm_bridge.kext is invalid; can't resolve dependencies.
/System/Library/Extensions/tpm_bridge.kext is invalid; can't resolve dependencies.
/System/Library/Extensions/tpm_bridge.kext is invalid; can't resolve dependencies.
Diagnostics for /System/Library/Extensions/tpm_bridge.kext:
Validation Failures:
    Kext has a CFBundleExecutable property but the executable can't be found:
        tpm_bridge

Some special flag to build on Darwin?

deitch commented 7 years ago

Hmm, no the problem is earlier:

Scanning dependencies of target tpmd_dev
[ 96%] Generating darwin/build/Release/tpm_bridge.kext
** BUILD FAILED **

The following build commands failed:
    CompileC build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/i386/tpm_bridge_info.o build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources/tpm_bridge_info.c normal i386 c com.apple.compilers.llvm.clang.1_0.compiler
    CompileC build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/x86_64/tpm_bridge_info.o build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources/tpm_bridge_info.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
(2 failures)
make[3]: *** [all] Error 65
make[2]: *** [tpmd_dev/darwin/build/Release/tpm_bridge.kext] Error 2
make[1]: *** [tpmd_dev/CMakeFiles/tpmd_dev.dir/all] Error 2
make: *** [all] Error 2
deitch commented 7 years ago

Of course, we might not be able to load a kext anyways because of kext-signing in latest version of macOS.

deitch commented 7 years ago

Fun:

$ xcodebuild
=== BUILD TARGET tpm_bridge OF PROJECT tpm_bridge WITH THE DEFAULT CONFIGURATION (Release) ===

Check dependencies
warning: can't find base SDK 'macosx10.6'

CompileC build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/x86_64/tpm_bridge_info.o build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources/tpm_bridge_info.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin
    export LANG=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch x86_64 -fmessage-length=170 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -nostdinc -std=c99 -fno-builtin -Wno-trigraphs -msoft-float -Os -fno-common -mkernel -Werror -Werror-implicit-function-declaration -Wno-missing-field-initializers -Wmissing-prototypes -Wmissing-braces -Wparentheses -Wswitch -Wunused-function -Wunused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-empty-body -Wuninitialized -Wunknown-pragmas -Wshadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wsign-compare -Wshorten-64-to-32 -Wpointer-sign -Wnewline-eof -DKERNEL -DKERNEL_PRIVATE -DDRIVER_PRIVATE -DAPPLE -DNeXT -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -mmacosx-version-min=10.12 -g -Wno-sign-conversion -Wno-infinite-recursion -iquote /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-generated-files.hmap -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-own-target-headers.hmap -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-all-target-headers.hmap -iquote /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-project-headers.hmap -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/Release/include -I/opt/local/include -I/usr/local/include -I/usr/local/include/dbus-1.0 -I/usr/local/include/fontconfig -I/usr/local/include/freetype2 -I/usr/local/include/gio-unix-2.0 -I/usr/local/include/git2 -I/usr/local/include/glib-2.0 -I/usr/local/include/gnutls -I/usr/local/include/json -I/usr/local/include/libltdl -I/usr/local/include/libpng16 -I/usr/local/include/lua5.2 -I/usr/local/include/luajit-2.0 -I/usr/local/include/mysql -I/usr/local/include/nettle -I/usr/local/include/node -I/usr/local/include/p11-kit-1 -I/usr/local/include/pixman-1 -I/usr/local/include/unistring -I/usr/local/include/dbus-1.0/dbus -I/usr/local/include/freetype2/freetype -I/usr/local/include/gio-unix-2.0/gio -I/usr/local/include/git2/sys -I/usr/local/include/glib-2.0/gio -I/usr/local/include/glib-2.0/glib -I/usr/local/include/glib-2.0/gobject -I/usr/local/include/mysql/mysql -I/usr/local/include/node/libplatform -I/usr/local/include/node/openssl -I/usr/local/include/p11-kit-1/p11-kit -I/usr/local/include/freetype2/freetype/config -I/usr/local/include/glib-2.0/glib/deprecated -I/usr/local/include/mysql/mysql/psi -I/usr/local/include/node/openssl/archs -I/usr/local/include/node/openssl/archs/aix-gcc -I/usr/local/include/node/openssl/archs/aix64-gcc -I/usr/local/include/node/openssl/archs/BSD-x86 -I/usr/local/include/node/openssl/archs/BSD-x86_64 -I/usr/local/include/node/openssl/archs/darwin-i386-cc -I/usr/local/include/node/openssl/archs/darwin64-x86_64-cc -I/usr/local/include/node/openssl/archs/linux-aarch64 -I/usr/local/include/node/openssl/archs/linux-armv4 -I/usr/local/include/node/openssl/archs/linux-elf -I/usr/local/include/node/openssl/archs/linux-ppc -I/usr/local/include/node/openssl/archs/linux-ppc64 -I/usr/local/include/node/openssl/archs/linux-x32 -I/usr/local/include/node/openssl/archs/linux-x86_64 -I/usr/local/include/node/openssl/archs/linux32-s390x -I/usr/local/include/node/openssl/archs/linux64-s390x -I/usr/local/include/node/openssl/archs/solaris-x86-gcc -I/usr/local/include/node/openssl/archs/solaris64-x86_64-gcc -I/usr/local/include/node/openssl/archs/VC-WIN32 -I/usr/local/include/node/openssl/archs/VC-WIN64A -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Kernel.framework/PrivateHeaders -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Kernel.framework/Headers -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources/x86_64 -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources -F/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/Release -MMD -MT dependencies -MF /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/x86_64/tpm_bridge_info.d --serialize-diagnostics /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/x86_64/tpm_bridge_info.dia -c /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources/tpm_bridge_info.c -o /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/x86_64/tpm_bridge_info.o
In file included from /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources/tpm_bridge_info.c:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Kernel.framework/Headers/mach/mach_types.h:76:
/usr/local/include/git2/stdint.h:33:2: error: "Use this header only with Microsoft Visual C++ compilers!"
#error "Use this header only with Microsoft Visual C++ compilers!"
 ^
/usr/local/include/git2/stdint.h:43:10: fatal error: 'limits.h' file not found
#include <limits.h>
         ^

CompileC build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/i386/tpm_bridge.o tpm_bridge.c normal i386 c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin
    export LANG=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch i386 -fmessage-length=170 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -nostdinc -std=c99 -fno-builtin -Wno-trigraphs -msoft-float -Os -fno-common -mkernel -Werror -Werror-implicit-function-declaration -Wno-missing-field-initializers -Wmissing-prototypes -Wmissing-braces -Wparentheses -Wswitch -Wunused-function -Wunused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-empty-body -Wuninitialized -Wunknown-pragmas -Wshadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wsign-compare -Wshorten-64-to-32 -Wpointer-sign -Wnewline-eof -DKERNEL -DKERNEL_PRIVATE -DDRIVER_PRIVATE -DAPPLE -DNeXT -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -mmacosx-version-min=10.12 -g -Wno-sign-conversion -Wno-infinite-recursion -iquote /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-generated-files.hmap -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-own-target-headers.hmap -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-all-target-headers.hmap -iquote /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-project-headers.hmap -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/Release/include -I/opt/local/include -I/usr/local/include -I/usr/local/include/dbus-1.0 -I/usr/local/include/fontconfig -I/usr/local/include/freetype2 -I/usr/local/include/gio-unix-2.0 -I/usr/local/include/git2 -I/usr/local/include/glib-2.0 -I/usr/local/include/gnutls -I/usr/local/include/json -I/usr/local/include/libltdl -I/usr/local/include/libpng16 -I/usr/local/include/lua5.2 -I/usr/local/include/luajit-2.0 -I/usr/local/include/mysql -I/usr/local/include/nettle -I/usr/local/include/node -I/usr/local/include/p11-kit-1 -I/usr/local/include/pixman-1 -I/usr/local/include/unistring -I/usr/local/include/dbus-1.0/dbus -I/usr/local/include/freetype2/freetype -I/usr/local/include/gio-unix-2.0/gio -I/usr/local/include/git2/sys -I/usr/local/include/glib-2.0/gio -I/usr/local/include/glib-2.0/glib -I/usr/local/include/glib-2.0/gobject -I/usr/local/include/mysql/mysql -I/usr/local/include/node/libplatform -I/usr/local/include/node/openssl -I/usr/local/include/p11-kit-1/p11-kit -I/usr/local/include/freetype2/freetype/config -I/usr/local/include/glib-2.0/glib/deprecated -I/usr/local/include/mysql/mysql/psi -I/usr/local/include/node/openssl/archs -I/usr/local/include/node/openssl/archs/aix-gcc -I/usr/local/include/node/openssl/archs/aix64-gcc -I/usr/local/include/node/openssl/archs/BSD-x86 -I/usr/local/include/node/openssl/archs/BSD-x86_64 -I/usr/local/include/node/openssl/archs/darwin-i386-cc -I/usr/local/include/node/openssl/archs/darwin64-x86_64-cc -I/usr/local/include/node/openssl/archs/linux-aarch64 -I/usr/local/include/node/openssl/archs/linux-armv4 -I/usr/local/include/node/openssl/archs/linux-elf -I/usr/local/include/node/openssl/archs/linux-ppc -I/usr/local/include/node/openssl/archs/linux-ppc64 -I/usr/local/include/node/openssl/archs/linux-x32 -I/usr/local/include/node/openssl/archs/linux-x86_64 -I/usr/local/include/node/openssl/archs/linux32-s390x -I/usr/local/include/node/openssl/archs/linux64-s390x -I/usr/local/include/node/openssl/archs/solaris-x86-gcc -I/usr/local/include/node/openssl/archs/solaris64-x86_64-gcc -I/usr/local/include/node/openssl/archs/VC-WIN32 -I/usr/local/include/node/openssl/archs/VC-WIN64A -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Kernel.framework/PrivateHeaders -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Kernel.framework/Headers -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources/i386 -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources -F/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/Release -MMD -MT dependencies -MF /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/i386/tpm_bridge.d --serialize-diagnostics /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/i386/tpm_bridge.dia -c /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/tpm_bridge.c -o /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/i386/tpm_bridge.o
In file included from /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/tpm_bridge.c:30:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Kernel.framework/Headers/sys/systm.h:103:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Kernel.framework/Headers/sys/time.h:70:
/usr/local/include/git2/stdint.h:33:2: error: "Use this header only with Microsoft Visual C++ compilers!"
#error "Use this header only with Microsoft Visual C++ compilers!"
 ^
/usr/local/include/git2/stdint.h:43:10: fatal error: 'limits.h' file not found
#include <limits.h>
         ^

CompileC build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/i386/tpm_bridge_info.o build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources/tpm_bridge_info.c normal i386 c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin
    export LANG=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch i386 -fmessage-length=170 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -nostdinc -std=c99 -fno-builtin -Wno-trigraphs -msoft-float -Os -fno-common -mkernel -Werror -Werror-implicit-function-declaration -Wno-missing-field-initializers -Wmissing-prototypes -Wmissing-braces -Wparentheses -Wswitch -Wunused-function -Wunused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-empty-body -Wuninitialized -Wunknown-pragmas -Wshadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wsign-compare -Wshorten-64-to-32 -Wpointer-sign -Wnewline-eof -DKERNEL -DKERNEL_PRIVATE -DDRIVER_PRIVATE -DAPPLE -DNeXT -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -mmacosx-version-min=10.12 -g -Wno-sign-conversion -Wno-infinite-recursion -iquote /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-generated-files.hmap -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-own-target-headers.hmap -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-all-target-headers.hmap -iquote /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-project-headers.hmap -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/Release/include -I/opt/local/include -I/usr/local/include -I/usr/local/include/dbus-1.0 -I/usr/local/include/fontconfig -I/usr/local/include/freetype2 -I/usr/local/include/gio-unix-2.0 -I/usr/local/include/git2 -I/usr/local/include/glib-2.0 -I/usr/local/include/gnutls -I/usr/local/include/json -I/usr/local/include/libltdl -I/usr/local/include/libpng16 -I/usr/local/include/lua5.2 -I/usr/local/include/luajit-2.0 -I/usr/local/include/mysql -I/usr/local/include/nettle -I/usr/local/include/node -I/usr/local/include/p11-kit-1 -I/usr/local/include/pixman-1 -I/usr/local/include/unistring -I/usr/local/include/dbus-1.0/dbus -I/usr/local/include/freetype2/freetype -I/usr/local/include/gio-unix-2.0/gio -I/usr/local/include/git2/sys -I/usr/local/include/glib-2.0/gio -I/usr/local/include/glib-2.0/glib -I/usr/local/include/glib-2.0/gobject -I/usr/local/include/mysql/mysql -I/usr/local/include/node/libplatform -I/usr/local/include/node/openssl -I/usr/local/include/p11-kit-1/p11-kit -I/usr/local/include/freetype2/freetype/config -I/usr/local/include/glib-2.0/glib/deprecated -I/usr/local/include/mysql/mysql/psi -I/usr/local/include/node/openssl/archs -I/usr/local/include/node/openssl/archs/aix-gcc -I/usr/local/include/node/openssl/archs/aix64-gcc -I/usr/local/include/node/openssl/archs/BSD-x86 -I/usr/local/include/node/openssl/archs/BSD-x86_64 -I/usr/local/include/node/openssl/archs/darwin-i386-cc -I/usr/local/include/node/openssl/archs/darwin64-x86_64-cc -I/usr/local/include/node/openssl/archs/linux-aarch64 -I/usr/local/include/node/openssl/archs/linux-armv4 -I/usr/local/include/node/openssl/archs/linux-elf -I/usr/local/include/node/openssl/archs/linux-ppc -I/usr/local/include/node/openssl/archs/linux-ppc64 -I/usr/local/include/node/openssl/archs/linux-x32 -I/usr/local/include/node/openssl/archs/linux-x86_64 -I/usr/local/include/node/openssl/archs/linux32-s390x -I/usr/local/include/node/openssl/archs/linux64-s390x -I/usr/local/include/node/openssl/archs/solaris-x86-gcc -I/usr/local/include/node/openssl/archs/solaris64-x86_64-gcc -I/usr/local/include/node/openssl/archs/VC-WIN32 -I/usr/local/include/node/openssl/archs/VC-WIN64A -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Kernel.framework/PrivateHeaders -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Kernel.framework/Headers -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources/i386 -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources -F/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/Release -MMD -MT dependencies -MF /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/i386/tpm_bridge_info.d --serialize-diagnostics /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/i386/tpm_bridge_info.dia -c /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources/tpm_bridge_info.c -o /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/i386/tpm_bridge_info.o
In file included from /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources/tpm_bridge_info.c:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Kernel.framework/Headers/mach/mach_types.h:76:
/usr/local/include/git2/stdint.h:33:2: error: "Use this header only with Microsoft Visual C++ compilers!"
#error "Use this header only with Microsoft Visual C++ compilers!"
 ^
/usr/local/include/git2/stdint.h:43:10: fatal error: 'limits.h' file not found
#include <limits.h>
         ^
2 errors generated.

CompileC build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/x86_64/tpm_bridge.o tpm_bridge.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin
    export LANG=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch x86_64 -fmessage-length=170 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -nostdinc -std=c99 -fno-builtin -Wno-trigraphs -msoft-float -Os -fno-common -mkernel -Werror -Werror-implicit-function-declaration -Wno-missing-field-initializers -Wmissing-prototypes -Wmissing-braces -Wparentheses -Wswitch -Wunused-function -Wunused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-empty-body -Wuninitialized -Wunknown-pragmas -Wshadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wsign-compare -Wshorten-64-to-32 -Wpointer-sign -Wnewline-eof -DKERNEL -DKERNEL_PRIVATE -DDRIVER_PRIVATE -DAPPLE -DNeXT -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -mmacosx-version-min=10.12 -g -Wno-sign-conversion -Wno-infinite-recursion -iquote /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-generated-files.hmap -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-own-target-headers.hmap -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-all-target-headers.hmap -iquote /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/tpm_bridge-project-headers.hmap -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/Release/include -I/opt/local/include -I/usr/local/include -I/usr/local/include/dbus-1.0 -I/usr/local/include/fontconfig -I/usr/local/include/freetype2 -I/usr/local/include/gio-unix-2.0 -I/usr/local/include/git2 -I/usr/local/include/glib-2.0 -I/usr/local/include/gnutls -I/usr/local/include/json -I/usr/local/include/libltdl -I/usr/local/include/libpng16 -I/usr/local/include/lua5.2 -I/usr/local/include/luajit-2.0 -I/usr/local/include/mysql -I/usr/local/include/nettle -I/usr/local/include/node -I/usr/local/include/p11-kit-1 -I/usr/local/include/pixman-1 -I/usr/local/include/unistring -I/usr/local/include/dbus-1.0/dbus -I/usr/local/include/freetype2/freetype -I/usr/local/include/gio-unix-2.0/gio -I/usr/local/include/git2/sys -I/usr/local/include/glib-2.0/gio -I/usr/local/include/glib-2.0/glib -I/usr/local/include/glib-2.0/gobject -I/usr/local/include/mysql/mysql -I/usr/local/include/node/libplatform -I/usr/local/include/node/openssl -I/usr/local/include/p11-kit-1/p11-kit -I/usr/local/include/freetype2/freetype/config -I/usr/local/include/glib-2.0/glib/deprecated -I/usr/local/include/mysql/mysql/psi -I/usr/local/include/node/openssl/archs -I/usr/local/include/node/openssl/archs/aix-gcc -I/usr/local/include/node/openssl/archs/aix64-gcc -I/usr/local/include/node/openssl/archs/BSD-x86 -I/usr/local/include/node/openssl/archs/BSD-x86_64 -I/usr/local/include/node/openssl/archs/darwin-i386-cc -I/usr/local/include/node/openssl/archs/darwin64-x86_64-cc -I/usr/local/include/node/openssl/archs/linux-aarch64 -I/usr/local/include/node/openssl/archs/linux-armv4 -I/usr/local/include/node/openssl/archs/linux-elf -I/usr/local/include/node/openssl/archs/linux-ppc -I/usr/local/include/node/openssl/archs/linux-ppc64 -I/usr/local/include/node/openssl/archs/linux-x32 -I/usr/local/include/node/openssl/archs/linux-x86_64 -I/usr/local/include/node/openssl/archs/linux32-s390x -I/usr/local/include/node/openssl/archs/linux64-s390x -I/usr/local/include/node/openssl/archs/solaris-x86-gcc -I/usr/local/include/node/openssl/archs/solaris64-x86_64-gcc -I/usr/local/include/node/openssl/archs/VC-WIN32 -I/usr/local/include/node/openssl/archs/VC-WIN64A -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Kernel.framework/PrivateHeaders -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Kernel.framework/Headers -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources/x86_64 -I/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources -F/Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/Release -MMD -MT dependencies -MF /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/x86_64/tpm_bridge.d --serialize-diagnostics /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/x86_64/tpm_bridge.dia -c /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/tpm_bridge.c -o /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/x86_64/tpm_bridge.o
In file included from /Users/adeitcher/Documents/other/business/secureappliance/tpm-emulator/build/tpmd_dev/darwin/tpm_bridge.c:30:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Kernel.framework/Headers/sys/systm.h:103:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Kernel.framework/Headers/sys/time.h:70:
/usr/local/include/git2/stdint.h:33:2: error: "Use this header only with Microsoft Visual C++ compilers!"
#error "Use this header only with Microsoft Visual C++ compilers!"
 ^
/usr/local/include/git2/stdint.h:43:10: fatal error: 'limits.h' file not found
#include <limits.h>
         ^

** BUILD FAILED **

The following build commands failed:
    CompileC build/tpm_bridge.build/Release/tpm_bridge.build/Objects-normal/i386/tpm_bridge_info.o build/tpm_bridge.build/Release/tpm_bridge.build/DerivedSources/tpm_bridge_info.c normal i386 c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
PeterHuewe commented 7 years ago

@deitch Hmm, any updates or ideas? Unfortunately I don't have a mac machine to test.

deitch commented 7 years ago

I am afraid not. I got it to compile (now not succeeding), but there is a lot here on the kernel extension that I don't get. I get wary about loading kexts anyways, but I did try. Would be great to have it outside of the kernel.

deitch commented 7 years ago

Hmm, you know... I could just run the tpmd software-only emulator in a Linux VM (e.g. docker for Mac) and then use either the go-tpm bindings or tcsd to talk directly to it, could I not? That probably would work.

PeterHuewe commented 5 years ago

@shearl Do you have ideas? I have no mac to test.

shearl commented 5 years ago

@PeterHuewe I just tried re-building with clang and was able to build successfully (in spite of a few warnings). I am using a MacBook Pro (13-inch, 2018, Four Thunderbolt 3 Ports) running macOS High Sierra Version 10.13.6 (17G2307).

BTW, Installing the kext is a major hassle. I was only able to do it by booting into recovery mode and ignoring warnings about grave consequences.

$ export CC=/usr/bin/clang
$ export CXX=/usr/bin/clang++
$ mkdir build
$ cd build
$ cmake ../ #-DMTM_EMULATOR=ON
-- The C compiler identification is AppleClang 10.0.0.10001145
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   tddl-tpm-emulator

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /path/to/build
$ make
Scanning dependencies of target tpm
[  2%] Building C object tpm/CMakeFiles/tpm.dir/tpm_audit.o
[  4%] Building C object tpm/CMakeFiles/tpm.dir/tpm_authorization.o
[  6%] Building C object tpm/CMakeFiles/tpm.dir/tpm_capability.o
[  8%] Building C object tpm/CMakeFiles/tpm.dir/tpm_cmd_handler.o
[ 11%] Building C object tpm/CMakeFiles/tpm.dir/tpm_context.o
[ 13%] Building C object tpm/CMakeFiles/tpm.dir/tpm_counter.o
[ 15%] Building C object tpm/CMakeFiles/tpm.dir/tpm_credentials.o
[ 17%] Building C object tpm/CMakeFiles/tpm.dir/tpm_crypto.o
[ 20%] Building C object tpm/CMakeFiles/tpm.dir/tpm_daa.o
[ 22%] Building C object tpm/CMakeFiles/tpm.dir/tpm_data.o
[ 24%] Building C object tpm/CMakeFiles/tpm.dir/tpm_delegation.o
[ 26%] Building C object tpm/CMakeFiles/tpm.dir/tpm_deprecated.o
[ 28%] Building C object tpm/CMakeFiles/tpm.dir/tpm_emulator_extern.o
[ 31%] Building C object tpm/CMakeFiles/tpm.dir/tpm_error.o
[ 33%] Building C object tpm/CMakeFiles/tpm.dir/tpm_eviction.o
[ 35%] Building C object tpm/CMakeFiles/tpm.dir/tpm_handles.o
[ 37%] Building C object tpm/CMakeFiles/tpm.dir/tpm_identity.o
[ 40%] Building C object tpm/CMakeFiles/tpm.dir/tpm_integrity.o
[ 42%] Building C object tpm/CMakeFiles/tpm.dir/tpm_maintenance.o
[ 44%] Building C object tpm/CMakeFiles/tpm.dir/tpm_management.o
[ 46%] Building C object tpm/CMakeFiles/tpm.dir/tpm_marshalling.o
[ 48%] Building C object tpm/CMakeFiles/tpm.dir/tpm_migration.o
[ 51%] Building C object tpm/CMakeFiles/tpm.dir/tpm_nv_storage.o
[ 53%] Building C object tpm/CMakeFiles/tpm.dir/tpm_owner.o
[ 55%] Building C object tpm/CMakeFiles/tpm.dir/tpm_startup.o
[ 57%] Building C object tpm/CMakeFiles/tpm.dir/tpm_storage.o
[ 60%] Building C object tpm/CMakeFiles/tpm.dir/tpm_testing.o
[ 62%] Building C object tpm/CMakeFiles/tpm.dir/tpm_ticks.o
[ 64%] Building C object tpm/CMakeFiles/tpm.dir/tpm_transport.o
[ 66%] Linking C static library libtpm.a
[ 66%] Built target tpm
Scanning dependencies of target tpm_crypto
[ 68%] Building C object crypto/CMakeFiles/tpm_crypto.dir/hmac.o
[ 71%] Building C object crypto/CMakeFiles/tpm_crypto.dir/rc4.o
[ 73%] Building C object crypto/CMakeFiles/tpm_crypto.dir/rsa.o
crypto/rsa.c:56:13: warning: address
      of array 'key->p' will always evaluate to 'true'
      [-Wpointer-bool-conversion]
  if (!key->p || !key->q || !key->u) {
      ~~~~~~^
crypto/rsa.c:56:24: warning: address
      of array 'key->q' will always evaluate to 'true'
      [-Wpointer-bool-conversion]
  if (!key->p || !key->q || !key->u) {
                 ~~~~~~^
crypto/rsa.c:56:35: warning: address
      of array 'key->u' will always evaluate to 'true'
      [-Wpointer-bool-conversion]
  if (!key->p || !key->q || !key->u) {
                            ~~~~~~^
3 warnings generated.
[ 75%] Building C object crypto/CMakeFiles/tpm_crypto.dir/sha1.o
[ 77%] Building C object crypto/CMakeFiles/tpm_crypto.dir/bn_gmp.o
[ 80%] Linking C static library libtpm_crypto.a
[ 80%] Built target tpm_crypto
Scanning dependencies of target tddl-tpm-emulator_static
[ 82%] Building C object tddl/CMakeFiles/tddl-tpm-emulator_static.dir/tddl.o
[ 84%] Linking C static library libtddl-tpm-emulator.a
[ 84%] Built target tddl-tpm-emulator_static
Scanning dependencies of target test_tddl
[ 86%] Building C object tddl/CMakeFiles/test_tddl.dir/test_tddl.o
[ 88%] Linking C executable test_tddl
ld: warning: directory not found for option '-L/opt/local/lib'
[ 88%] Built target test_tddl
Scanning dependencies of target tddl-tpm-emulator
[ 91%] Building C object tddl/CMakeFiles/tddl-tpm-emulator.dir/tddl.o
[ 93%] Linking C shared library libtddl-tpm-emulator.dylib
ld: warning: directory not found for option '-L/opt/local/lib'
[ 93%] Built target tddl-tpm-emulator
Scanning dependencies of target tpmd_dev
[ 95%] Generating darwin/build/Release/tpm_bridge.kext
[ 95%] Built target tpmd_dev
Scanning dependencies of target tpmd
[ 97%] Building C object tpmd/unix/CMakeFiles/tpmd.dir/tpmd.o
[100%] Linking C executable tpmd
ld: warning: directory not found for option '-L/opt/local/lib'
[100%] Built target tpmd