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

error: invalid argument '-std=c++11' not allowed with 'C/ObjC' #26

Open
neutronest opened this issue Mar 7, 2018 · 1 comment
Open

Comments

@neutronest
Copy link

the "invalid argument '-std=c++11' not allowed with 'C/ObjC'" occured when try to use python setup.py install in pytorch_binding.

Full Operation History:

cmake ../ -DWITH_OMP=OFF

the cmake info:

-- The C compiler identification is AppleClang 9.0.0.9000039
-- The CXX compiler identification is AppleClang 9.0.0.9000039
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (Required is at least version "6.5")
-- cuda found FALSE
CMake Warning at CMakeLists.txt:59 (FIND_PACKAGE):
  By not providing "FindTorch.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Torch", but
  CMake did not find one.

  Could not find a package configuration file provided by "Torch" with any of
  the following names:

    TorchConfig.cmake
    torch-config.cmake

  Add the installation prefix of "Torch" to CMAKE_PREFIX_PATH or set
  "Torch_DIR" to a directory containing one of the above files.  If "Torch"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Torch found Torch_DIR-NOTFOUND
-- DARWIN_VERSION=17
-- Building shared library with no GPU support
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/cdong/projects/python/warp-ctc/build
make
Scanning dependencies of target warpctc
[ 25%] Building CXX object CMakeFiles/warpctc.dir/src/ctc_entrypoint.cpp.o
[ 50%] Linking CXX shared library libwarpctc.dylib
[ 50%] Built target warpctc
Scanning dependencies of target test_cpu
[ 75%] Building CXX object CMakeFiles/test_cpu.dir/tests/test_cpu.cpp.o
[100%] Linking CXX executable test_cpu
[100%] Built target test_cpu
cd ../pytorch_binding/
python setup.py install

the error occured.

CUDA_HOME not found in the environment so building without GPU support. To build with GPU support please define the CUDA_HOME environment variable. This should be a path which contains include/cuda.h
generating build/_warp_ctc.c
regenerated: 'build/_warp_ctc.c'
running install
running build
running build_py
creating build/lib.macosx-10.6-x86_64-3.5
creating build/lib.macosx-10.6-x86_64-3.5/warpctc_pytorch
copying warpctc_pytorch/__init__.py -> build/lib.macosx-10.6-x86_64-3.5/warpctc_pytorch
running build_ext
building 'warpctc_pytorch._warp_ctc' extension
creating build/temp.macosx-10.6-x86_64-3.5
creating build/temp.macosx-10.6-x86_64-3.5/build
creating build/temp.macosx-10.6-x86_64-3.5/Users
creating build/temp.macosx-10.6-x86_64-3.5/Users/cdong
creating build/temp.macosx-10.6-x86_64-3.5/Users/cdong/projects
creating build/temp.macosx-10.6-x86_64-3.5/Users/cdong/projects/python
creating build/temp.macosx-10.6-x86_64-3.5/Users/cdong/projects/python/warp-ctc
creating build/temp.macosx-10.6-x86_64-3.5/Users/cdong/projects/python/warp-ctc/pytorch_binding
creating build/temp.macosx-10.6-x86_64-3.5/Users/cdong/projects/python/warp-ctc/pytorch_binding/src
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/cdong/projects/python/dnn-model-ocr/envs/default/include -arch x86_64 -I/Users/cdong/projects/python/dnn-model-ocr/envs/default/include -arch x86_64 -I/Users/cdong/projects/python/dnn-model-ocr/envs/default/lib/python3.5/site-packages/torch/utils/ffi/../../lib/include -I/Users/cdong/projects/python/dnn-model-ocr/envs/default/lib/python3.5/site-packages/torch/utils/ffi/../../lib/include/TH -I/Users/cdong/projects/python/warp-ctc/include -I/Users/cdong/projects/python/dnn-model-ocr/envs/default/include/python3.5m -c build/_warp_ctc.c -o build/temp.macosx-10.6-x86_64-3.5/build/_warp_ctc.o -std=c++11 -fPIC
error: invalid argument '-std=c++11' not allowed with 'C/ObjC'
error: command '/usr/bin/clang' failed with exit status 1
@neutronest
Copy link
Author

if use a workaround in pytorch_binding/setup.py

if platform.system() == 'Darwin':
    extra_compile_args = ['-fPIC']
else:
    extra_compile_args = ['-std=c++11', '-fPIC']

can solve this problem. However I don't think this is a good practice.

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

1 participant