Menu

CMake Error: Xcode generator: duplicate object ids not allowed

Help
2022-03-24
2022-09-07
  • Jonathon Irons

    Jonathon Irons - 2022-03-24

    Hi everyone, I am attempting to compile AAF v1.2.0 on my M1 iMac (macOS 12.3 Monterey), using the MacOS ARM64 build instructions. I currently have Xcode 13.3 installed, as well as cmake 3.22.2 through homebrew.

    When I get to this cmake command:
    % cmake -G "Xcode" -DPLATFORM=clang12 -DARCH=arm64 ../..

    I get the following output ending with an error:

    -- The CXX compiler identification is AppleClang 13.1.6.13160021
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- The C compiler identification is AppleClang 13.1.6.13160021
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Configuring done
    -- Generating done
    CMake Error: Xcode generator: duplicate object ids not allowed
    CMake Generate step failed.  Build files cannot be regenerated correctly.
    

    I do also have a homebrew version of clang through llvm, version 13.0.1, although the above output seems to show that cmake is using the built-in AppleClang 13.1.6. I attempted changing -DPLATFORM to clang13, and I also attempted running the x86-64 command instead, but both ended in the same error.

    Any ideas? Thank you very much in advance.

     
  • Yoon Ho Lim

    Yoon Ho Lim - 2022-08-26

    Hi,
    I have the same error.
    I tried:

    cmake -G "Xcode" -DPLATFORM=clang13 -DARCH=Universal ../..
    

    Any help would be much appreciated.

     
  • Martin Preston

    Martin Preston - 2022-08-31

    I have the same problem, and sadly don't have an answer.
    However even though I get that error I do seem to be able to compile the library (so doing "cmake --build ." does seem to work.

    So from the command line thats fine, most IDEs won't let me plough on and compile if the cmake generator failed sadly.

     
  • Martin Preston

    Martin Preston - 2022-09-01

    After a bit of trial and error I found that if, in the tests/CMakeLists.txt file, you comment out the use of the axPlugin subdirectory:

    #add_subdirectory(axPlugin)
    

    the Xcode generator seems happy. No idea why it disliked that directory, maybe some bug later versions of Xcode have fixed but the file was exploiting.

     
  • Alexey Kharkevich

    Hi Martin,

    most IDEs won't let me plough on and compile if the cmake generator failed sadly

    Do I understand this correctly that Xcode and other IDEs cannot load the generated project? I could not quickly figure out the cause of the CMake error and since command line build and tests worked decided to move on. If the error breaks IDE it's more severe than I thought.

    comment out the use of the axPlugin subdirectory

    This is helpful, thanks.

     
  • Martin Preston

    Martin Preston - 2022-09-07

    Ah maybe the xcode UI is a bit more lenient. I'm just using the xcode generator to build the equivalent of the makefiles, rather than using the xcode ui, and am using vscode to front-end it all.

    So its perfectly possible that the gui version of xcode itself can ignore the error messages. FWIW I'm using vscode as we also do a lot of remote development, with the remote machines predominantly being Linux.

    Sadly vscode concludes that the project can't be compiled if the 'generation' phase fails in any way. Which is probably a reasonable guess most of the time!

     

Log in to post a comment.