1

Unable to build clang project using Xcode 10.2.1 on MACOS MOJAVE 10.14.4

I want to build and debug clang project on xcode. I could able to build it using command line MakeFile build system but not on Xcode. I am seeing link error on Xcode as below clang: error: no such file or directory: '/Users/srinivas/Work/clang/llvm-project/build/Debug/lib/libclangBasic.a'

I followed below steps:

  1. git clone https://github.com/llvm/llvm-project.git
  2. mkdir build && cd build
  3. cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD="X86" -G "Xcode" ../llvm
  4. open LLVM.xcodeproj
  5. select 'clang' scheme from available schemes.
  6. build

error:

Ld /Users/srinivas/Work/clang/llvm-project/build/Debug/bin/clang-offload-bundler normal x86_64 cd /Users/srinivas/Work/clang/llvm-project/llvm export MACOSX_DEPLOYMENT_TARGET=10.14 clang: error: no such file or directory: '/Users/srinivas/Work/clang/llvm-project/build/Debug/lib/libclangBasic.a'

I don't see any of libclang* libraries getting generated in build/Debug/lib directory while building but I see lot of libLLVM* libraries getting generated.

  1. I tried uninstalling and installing Xcode and LLVM sources multiple times and cleaning cache every time.

  2. I tried setting 'Build Active Architectures Only' to 'No' also in build settings.

  3. I tried from command line also xcodebuild -project LLVM.xcodeproj -scheme clang -arch=X86 -sdk "macOS 10.14"

But I couldn't get rid of these errors.

Please note that I could able to build successfully using Unix Make files build system cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD="X86" -G "Unix Makefiles" ../llvm && make This is successful. I see only issue with building on Xcode

Am I missing some thing (or) could you please point me to right resources for the steps to be followed.

Joakim Danielson
  • 43,251
  • 5
  • 22
  • 52
srinivas
  • 21
  • 1
  • 4
  • I recall having a similar issue with Xcode some time ago, I was able to fix my issue by switching to the old build system. You can try that as well, it's somewhere behind File -> Project/Workspace Settings. – AlexDenisov May 28 '19 at 09:06
  • Thanks Alex. But I tried with old build system also. `File->Project Settings->Shared Project settings->Build system as Legacy build system and per-user project settings also as Legacy build system.` But I still see the issue. – srinivas May 29 '19 at 05:21

0 Answers0