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

Compiling on Arch Linux fails: "Allocator.h:639:32: error: no matching member function to 'alloc' #358

Closed
roxlu opened this issue Oct 9, 2018 · 6 comments
Assignees
Labels
linux Issue/feature request for Linux only

Comments

@roxlu
Copy link
Contributor

roxlu commented Oct 9, 2018

Describe the bug
When compiling on Linux arch680 4.18.12-arch1-1-ARCH an error is caused in Allocator.h.
See Additional context below.

To Reproduce

  1. Create test-build.sh with the following contents in the root of the filament repository.
#!/bin/sh
bd=${PWD}
id=${bd}/install
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++

if [ ! -d my-build ] ; then
    mkdir my-build
fi

cd my-build

cmake -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=${id} \
      -G Ninja \
      ..

if [ $? -ne 0 ] ; then
    echo "Failed to configure.";
    exit;
fi

ninja
  1. chmod 777, then run this script.

Expected behavior
Successfull compilation.

Desktop (please complete the following information):

  • OS: Linux arch680 4.18.12-arch1-1-ARCH
  • GPU: not relevant
  • Backend: not relevant

Additional context

Installed this lib-c++ package

Error happens in Allocator:L639

This issue seems to be related. That was "solved" w/o further explanation

Output:

$ ./test-build.sh 
CMake Warning at java/CMakeLists.txt:21 (message):
  The JAVA_HOME environment variable must be set to compile Java projects


CMake Warning at java/CMakeLists.txt:22 (message):
  Skipping Java projects


-- Configuring done
-- Generating done
-- Build files have been written to: /home/roxlu/Downloads/filament/my-build
[19/944] Building CXX object libs/utils/CMakeFiles/test_utils.dir/test/test_Allocators.cpp.o
FAILED: libs/utils/CMakeFiles/test_utils.dir/test/test_Allocators.cpp.o 
/usr/bin/clang++  -DFILAMENT_DRIVER_SUPPORTS_VULKAN -I../libs/utils/include -I../third_party/libgtest/tnt/../include -I../third_party/robin-map/tnt/.. -I../libs/math/include -std=c++14 -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -stdlib=libc++ -fcolor-diagnostics -O3 -DNDEBUG -fomit-frame-pointer -ffunction-sections -fdata-sections   -pthread -MD -MT libs/utils/CMakeFiles/test_utils.dir/test/test_Allocators.cpp.o -MF libs/utils/CMakeFiles/test_utils.dir/test/test_Allocators.cpp.o.d -o libs/utils/CMakeFiles/test_utils.dir/test/test_Allocators.cpp.o -c ../libs/utils/test/test_Allocators.cpp
In file included from ../libs/utils/test/test_Allocators.cpp:24:
../libs/utils/include/utils/Allocator.h:639:32: error: no matching member function for call to 'alloc'
        return mArena.template alloc(size, alignment, 0);
               ~~~~~~~~~~~~~~~~^~~~~
../libs/utils/test/test_Allocators.cpp:258:17: note: in instantiation of member function 'utils::ArenaScope<utils::Arena<utils::LinearAllocator, utils::LockingPolicy::NoLock, utils::TrackingPolicy::Untracked> >::allocate' requested here
        p = ssa.allocate(1024);
                ^
../libs/utils/include/utils/Allocator.h:487:8: note: candidate template ignored: couldn't infer template argument 'T'
    T* alloc(size_t count, size_t alignment = alignof(T), size_t extra = 0) noexcept {
       ^
1 error generated.
[28/944] Building CXX object third_party/libgtest/tnt/CMakeFiles/gtest.dir/__/src/gtest-all.cc.o
ninja: build stopped: subcommand failed.

Clang info:

$ clang -v
clang version 7.0.0 (tags/RELEASE_700/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/6.4.1
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/7.3.1
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.1
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.4.1
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.3.1
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/6.4.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/6.4.1
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/7.3.1
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/8.2.1
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
Found CUDA installation: /opt/cuda, version unknown
@romainguy
Copy link
Collaborator

What is your version of clang?

@romainguy romainguy added the linux Issue/feature request for Linux only label Oct 9, 2018
@roxlu
Copy link
Contributor Author

roxlu commented Oct 9, 2018

What is your version of clang?

I've updated the issue above.

@roxlu
Copy link
Contributor Author

roxlu commented Oct 9, 2018

I was able to compile by making the making the following changes (quickfix):

./CMakeLists.txt

  • Commented set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") at line 108.
  • Commented link_libraries("-static-libgcc -static-libstdc++")at line 115.

./libs/utils/CMakeLists.txt

  • Commented test/test_Allocators.cpp at line 97.
  • Commented test/test_JobSystem.cpp at line 103.

Used this build script:

I'm not entirely sure if the added -DCMAKE_CXX_FLAGS is required; didn't have time to test this yet.

#!/bin/sh
bd=${PWD}
id=${bd}/install
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++

if [ ! -d my-build ] ; then
    mkdir my-build
fi

cd my-build

cmake -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=${id} \
      -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
      -DCMAKE_CXX_FLAGS="-stdlib=libc++" \
      ..

if [ $? -ne 0 ] ; then
    echo "Failed to configure.";
    exit;
fi

cmake --build . 

@romainguy
Copy link
Collaborator

This fix won't work, we want to make sure we always compile with libc++ and not with GCC's STL.

@roxlu
Copy link
Contributor Author

roxlu commented Oct 10, 2018

@romainguy I understand; until then this gives people the ability to compile the library and have a look at the samples. In the end you want this library to compile on any platform that it supports. I'm happy to help / test a bit more.

@rfebbo
Copy link

rfebbo commented Nov 12, 2018

I just pulled and built for debug and release and this issue no longer occurs for me on Arch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linux Issue/feature request for Linux only
Projects
None yet
Development

No branches or pull requests

4 participants