0

I'm working on a trouble ticket where a user reports the Xcode project files produced by Cmake does not produce expected libraries as output artifacts.

The library's Makefile, which works as expected, produces three artifacts: libcryptopp.a, libcryptopp.so and cryptest.exe. Cmake works as expected on other platforms, and it produces the three artifacts. This issue appears to be Cmake/Xcode specific.

I think I have it tracked down to: (1) Xcode produces a library with an unusual name (libcryptopp-object.a) in an intermediate directory, and (2) Xcode does not copy the archive to the expected library (libcryptopp.a) at the expected location. Later, when cryptest.exe is linked (3) Xcode generates an error because the expected library is not present.

This may be related, but its hard to tell because no analysis was performed: CMake generated Xcode project won't compile. Its not clear if the OP's libraries were in the wrong location, or if they were not being built.

Does anyone know why the library is not being copied and renamed? Is this a missing Build Phase step? (I think that's what Xcode calls it).

How does one tell Cmake or Xcode to copy the intermediate library to the output library?


Here's the relative path to the oddly named archive:

cryptopp.build/Release/cryptopp-object.build/Objects-normal/libcryptopp-object.a

Here's the relative path to what the program expects to link against:

build/Release/libcryptopp.a

I'm not a Cmake or Xcode user, so I'm not really sure what is needed for a minimal working example. Here's how to duplicate it on OS X:

git clone git://github.com/weidai11/cryptopp
mkdir cryptopp-build
cd cryptopp-build

cmake -G "Xcode" ../cryptopp
xcodebuild -project cryptopp.xcodeproj/ -target cryptest -config Release

It will result in:

Ld /Users/jwalton/build/Release/cryptest.exe normal x86_64
    cd /Users/jwalton/cryptopp
    export MACOSX_DEPLOYMENT_TARGET=10.9
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOS
X.platform/Developer/SDKs/MacOSX10.9.sdk -L/Users/jwalton/build/Release -F/Users/jwalton/b
uild/Release -filelist /Users/jwalton/build/cryptopp.build/Release/cryptest.build/Objects-
normal/x86_64/cryptest.exe.LinkFileList -mmacosx-version-min=10.9 -march=native /Users/jwa
lton/build/Release/libcryptopp.a -Xlinker -dependency_info -Xlinker /Users/jwalton/build/c
ryptopp.build/Release/cryptest.build/Objects-normal/x86_64/cryptest.exe_dependency_info.da
t -o /Users/jwalton/build/Release/cryptest.exe
clang: error: no such file or directory: '/Users/jwalton/build/Release/libcryptopp.a'

** BUILD FAILED **
4
  • 1
    Odd because it seems that they set the name for the libraries in github.com/weidai11/cryptopp/blob/master/CMakeLists.txt...
    – fedepad
    Jan 11, 2017 at 21:04
  • I get your same error when I build using the Xcode generator and xcodebuild ... but I don't get that error if I don't use the Xcode generator, i.e. from the build directory: cmake .. and make, i.e. it doesn't happen when CMake is using Makefiles instead. I am on OSX 10.11.4
    – fedepad
    Jan 11, 2017 at 22:01
  • it's too bad that the link to the CMakeLists.txt no longer works. I am experiencing something very similar, and was wondering if you were using OBJECT libraries.
    – mchiasson
    Mar 11, 2018 at 17:42
  • @mchiasson - We removed Cmake from the project files. The files are now available at Noloader | Cmake. I'm not sure if they still suffer the problem. I think someone fixed it.
    – jww
    Mar 11, 2018 at 18:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.