Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mac build failure - Unable to determine alignment of C++ type long long - no error text #138

Closed
ramcharan-palnati opened this issue Sep 8, 2022 · 3 comments

Comments

@ramcharan-palnati
Copy link

Hi,

While building foonathan memory on mac64 with clang++ compiler , I get fatal error from cmake :
Could you help me on this. Thanks in advance.

CMake Error at cmake/get_container_node_sizes.cmake:37 (message):
  Unable to determine alignment of C++ type long long - no error text
  matching align_of<..., ##> in compiler output |Change Dir:
  /FastDDS/build/foonathan_memory_vendor/foo_mem-ext-prefix/src/foo_mem-ext-build/src/CMakeFiles/CMakeTmp

  Run Build
  Command(s)://hub/3rdparty/internal/7931347/maci64/gmake/bin/gmake
  cmTC_840cb/fast && gmake[6]: Entering directory
  '/FastDDS/build/foonathan_memory_vendor/foo_mem-ext-prefix/src/foo_mem-ext-build/src/CMakeFiles/CMakeTmp'


   c++
  -DTEST_TYPE="long long" -arch x86_64 -isysroot
  /Applications/Xcode13.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk
  -mmacosx-version-min=10.15 -fPIE -std=gnu++11 -o
  CMakeFiles/cmTC_840cb.dir/get_align_of.cpp.o -c
  FastDDS/build/foonathan_memory_vendor/foo_mem-ext-prefix/src/foo_mem-ext/cmake/get_align_of.cpp


  clang: error: no such file or directory: 'long'


Call Stack (most recent call first):
  cmake/get_container_node_sizes.cmake:55 (get_alignof_type)
  cmake/get_container_node_sizes.cmake:135 (unique_aligned_types)
  src/CMakeLists.txt:80 (get_container_node_sizes)
@MiguelCompany
Copy link
Contributor

@matt-cross You are the one who added the CMake magical generation of node sizes in get_container_node_sizes.cmake. Would you mind taking a look at this?

matt-cross pushed a commit to matt-cross/memory that referenced this issue Sep 8, 2022
…or types with spaces, and also address std lib implementations that wrap value types in some containers in a conatiner type of the same size.
@matt-cross
Copy link
Contributor

I tried to reproduce this on my Mac and I cannot reproduce the issue. I am using:

  • MacOS Monterey 12.5.1
  • Xcode 13.4.1 (Build version 13F100)
  • cmake version 3.22.2

From the error it looks like a shell quoting issue. According to CMake docs for add_compile_definition() it should escape the value automatically for the build system; it's not clear to me what could be causing it to fail to escape this in your environment.

I am proposing a workaround that passes in type names without spaces on the compiler command line and then has corresponding using declarations in the source files to convert them back to C++ types.

In testing this, I also found that the std library implementation on MacOS (perhaps just in clang) wraps some container value types in a structure that is not the node type yet has the same size - see https://github.com/llvm/llvm-project/blob/main/libcxx/include/map#L810-L831 . This was causing this code to detect a node type of 0, I added something to handle this issue as well.

foonathan pushed a commit that referenced this issue Sep 8, 2022
…with spaces, and also address std lib implementations that wrap value types in some containers in a conatiner type of the same size. (#139)

Co-authored-by: Matt Cross <mcross@irobot.com>
@foonathan
Copy link
Owner

Merged, let me know if that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants