为什么可能生成与手动复制粘贴和输入的相同命令不同的目标文件?

时间:2015-09-17 16:16:21

标签: build cmake makefile llvm

与我的其他问题here相关的排序,因为这也是关于构建llvm。

当试图解决llvm中的构建失败时,我注意到以下内容:

通过namespace Site.ViewModels.EasyEnrol.AbstractClasses { public abstract class HomeViewModel<T> where T: HomeAddressViewModel { public abstract T AddressViewModel { get; set; } } } namespace Site.ViewModels.EasyEnrol.Addresses { public class HomeAddressViewModel { } } namespace Site.ViewModels.EasyEnrol.Addresses { public class SingleFamilyAddressViewModel : HomeAddressViewModel { } } namespace Site.ViewModels.EasyEnrol.Enrolments { public class SingleFamilyEnrollmentViewModel : HomeViewModel<SingleFamilyAddressViewModel> { public override SingleFamilyAddressViewModel AddressViewModel { get; set; } } } 构建单个目标文件时在终端输出:

make

手动输入相同命令时的输出:

rp% make asan_posix.o
cd /tmp/llvm20150917-93899-y384cu && /Applications/Xcode-beta.app/Contents/Developer/usr/bin/make -f projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.iossim.dir/build.make projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o
Building CXX object projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o
cd /tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan && /usr/local/Library/ENV/4.3/clang++   -DASAN_DYNAMIC=1 -DASAN_HAS_EXCEPTIONS=1 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-y384cu/include -I/tmp/llvm20150917-93899-1jg6jdx/include -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/..  -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -arch i386 -arch x86_64   -UNDEBUG   -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -stdlib=libc++ -mios-simulator-version-min=7.0 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.1.sdk -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-function-sections -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -ftls-model=initial-exec -o CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o -c /tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/asan_posix.cc
cd /tmp/llvm20150917-93899-y384cu && /Applications/Xcode-beta.app/Contents/Developer/usr/bin/make -f projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/build.make projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o
Building CXX object projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o
cd /tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan && /usr/local/Library/ENV/4.3/clang++   -DASAN_DYNAMIC=1 -DASAN_HAS_EXCEPTIONS=1 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-y384cu/include -I/tmp/llvm20150917-93899-1jg6jdx/include -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/..  -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -arch i386 -arch x86_64   -UNDEBUG   -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.9 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-function-sections -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -ftls-model=initial-exec -o CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o -c /tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/asan_posix.cc


rp% file CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o
CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o: Mach-O 64-bit object x86_64
rp% file CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o
CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o: Mach-O 64-bit object x86_64

我所做的搜索并没有真正帮助;我自己没有编写makefile(生成cmake),至少在我看来,rp% cd /tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan && /usr/local/Library/ENV/4.3/clang++ -DASAN_DYNAMIC=1 -DASAN_HAS_EXCEPTIONS=1 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-y384cu/include -I/tmp/llvm20150917-93899-1jg6jdx/include -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/.. -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -arch i386 -arch x86_64 -UNDEBUG -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -stdlib=libc++ -mios-simulator-version-min=7.0 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.1.sdk -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-function-sections -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -ftls-model=initial-exec -o CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o -c /tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/asan_posix.cc rp% cd /tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan && /usr/local/Library/ENV/4.3/clang++ -DASAN_DYNAMIC=1 -DASAN_HAS_EXCEPTIONS=1 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-y384cu/include -I/tmp/llvm20150917-93899-1jg6jdx/include -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/.. -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -arch i386 -arch x86_64 -UNDEBUG -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.9 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-function-sections -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -ftls-model=initial-exec -o CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o -c /tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/asan_posix.cc rp% file CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o: Mach-O universal binary with 2 architectures CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o (for architecture i386): Mach-O object i386 CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o (for architecture x86_64): Mach-O 64-bit object x86_64 rp% file CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o: Mach-O universal binary with 2 architectures CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o (for architecture i386): Mach-O object i386 CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o (for architecture x86_64): Mach-O 64-bit object x86_64 没有理由打印出它没有执行的东西。

任何人都知道发生了什么事?

复制步骤:

  • 安装自制软件(如果尚未安装)
  • 用WIP here
  • 替换自制软件的llvm公式
  • 运行make
  • 等待构建失败并询问您要做什么
  • 放入调试shell
  • cd to brew install llvm --with-clang --with-lldb --verbose --debug
  • 运行projects/compiler-rt/lib/asan
  • 运行make clean(或make asan_posix.o
  • 中列出的任何其他*.o个文件
  • 在输出文件上运行make help(在我file中)
  • 重复上述3个步骤,但复制粘贴命令而不是运行CMakeFiles/RTAsan_dynamic.(osx|iossim).dir/asan_posix.cc.o

编辑:在shell中和制作过程中链接到我的environment

1 个答案:

答案 0 :(得分:0)

此问题的解决方案最终与链接问题相同。 homebrew正在改变编译器标志,因此打印的命令不是正在执行的命令。另一个问题的修复也恰好解决了这个问题。