I get compiler errors when following the instructions from the pybind11 docs for the example build housed at https://github.com/pybind/python_example
The instructions are (1) clone the repo, and (2) pip3 install ./python_example.
I'm on OS X (Mojave) with python 3.7.3 and
c++ --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
I'm very new to python packages and to pybind11, so I'm more than a little lost and would appreciate newbie guidance. It looks like the errors have to do with implementations for C++ operator new and delete.
If so, I'm confident that I'm not the first person to have this issue and would appreciate a pointer to a solution.
I followed the steps given on the github repo:
Cloning into 'python_example'...
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 132 (delta 4), reused 11 (delta 4), pack-reused 119
Receiving objects: 100% (132/132), 31.03 KiB | 373.00 KiB/s, done.
Resolving deltas: 100% (62/62), done.
$ pip3 install ./python_example/
Here is the full output. Is something in the repo misconfigured (I did no configuration)? Is this a python version thing? A missing compiler flag? If I distribute code using this setup as a template, is there anything I need to do to increase portability? I'm a little worried that the "hello world" example has me on stack overflow! Thanks in advance for any help.
Processing ./python_example
Requirement already satisfied: pybind11>=2.3 in /usr/local/lib/python3.7/site-packages (from python-example==0.0.1) (2.3.0)
Building wheels for collected packages: python-example
Building wheel for python-example (setup.py) ... error
Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/pip-req-build-9f8udd0w/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/pip-wheel-fk0w8_oq --python-tag cp37:
running bdist_wheel
running build
running build_ext
creating var
creating var/folders
creating var/folders/7l
creating var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn
creating var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c /var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpag19sot6.cpp -o var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpag19sot6.o -std=c++17
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c /var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpf327436e.cpp -o var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpf327436e.o -fvisibility=hidden
building 'python_example' extension
creating build
creating build/temp.macosx-10.14-x86_64-3.7
creating build/temp.macosx-10.14-x86_64-3.7/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include/python3.7m -I/Users/stevescott/Library/Python/3.7/include/python3.7m -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/main.cpp -o build/temp.macosx-10.14-x86_64-3.7/src/main.o -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO="0.0.1" -std=c++17 -fvisibility=hidden
In file included from src/main.cpp:1:
In file included from /usr/local/include/python3.7m/pybind11/pybind11.h:49:
In file included from /usr/local/include/python3.7m/pybind11/attr.h:13:
/usr/local/include/python3.7m/pybind11/cast.h:579:34: error: aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on macOS 10.14 or newer
vptr = ::operator new(type->type_size,
^
/usr/local/include/python3.7m/pybind11/cast.h:579:34: note: if you supply your own aligned allocation functions, use -faligned-allocation to silence this diagnostic
In file included from src/main.cpp:1:
/usr/local/include/python3.7m/pybind11/pybind11.h:1009:9: error: no matching function for call to 'operator delete'
::operator delete(p, s, std::align_val_t(a));
^~~~~~~~~~~~~~~~~
note: candidate function not viable: requires 2 arguments, but 3 were provided
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:188:36: note: candidate function not viable: requires 2 arguments, but 3 were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:190:74: note: candidate function not viable: requires 2 arguments, but 3 were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:221:40: note: candidate function not viable: requires 2 arguments, but 3 were provided
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:187:36: note: candidate function not viable: requires single argument '__p', but 3 arguments were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
^
In file included from src/main.cpp:1:
/usr/local/include/python3.7m/pybind11/pybind11.h:1011:9: error: call to unavailable function 'operator delete': introduced in macOS 10.12
::operator delete(p, s);
^~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:190:74: note: candidate function has been explicitly made unavailable
_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:221:40: note: candidate function not viable: no known conversion from 'pybind11::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:188:36: note: candidate function not viable: no known conversion from 'pybind11::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
^
note: candidate function not viable: no known conversion from 'pybind11::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:187:36: note: candidate function not viable: requires single argument '__p', but 2 arguments were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
^
3 errors generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Failed building wheel for python-example
Running setup.py clean for python-example
Failed to build python-example
Installing collected packages: python-example
Running setup.py install for python-example ... error
Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/pip-req-build-9f8udd0w/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/pip-record-yvb3nloo/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c /var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpkd6a1ugc.cpp -o var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpkd6a1ugc.o -std=c++17
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c /var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpywf858_h.cpp -o var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpywf858_h.o -fvisibility=hidden
building 'python_example' extension
creating build
creating build/temp.macosx-10.14-x86_64-3.7
creating build/temp.macosx-10.14-x86_64-3.7/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include/python3.7m -I/Users/stevescott/Library/Python/3.7/include/python3.7m -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/main.cpp -o build/temp.macosx-10.14-x86_64-3.7/src/main.o -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO="0.0.1" -std=c++17 -fvisibility=hidden
In file included from src/main.cpp:1:
In file included from /usr/local/include/python3.7m/pybind11/pybind11.h:49:
In file included from /usr/local/include/python3.7m/pybind11/attr.h:13:
/usr/local/include/python3.7m/pybind11/cast.h:579:34: error: aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on macOS 10.14 or newer
vptr = ::operator new(type->type_size,
^
/usr/local/include/python3.7m/pybind11/cast.h:579:34: note: if you supply your own aligned allocation functions, use -faligned-allocation to silence this diagnostic
In file included from src/main.cpp:1:
/usr/local/include/python3.7m/pybind11/pybind11.h:1009:9: error: no matching function for call to 'operator delete'
::operator delete(p, s, std::align_val_t(a));
^~~~~~~~~~~~~~~~~
note: candidate function not viable: requires 2 arguments, but 3 were provided
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:188:36: note: candidate function not viable: requires 2 arguments, but 3 were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:190:74: note: candidate function not viable: requires 2 arguments, but 3 were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:221:40: note: candidate function not viable: requires 2 arguments, but 3 were provided
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:187:36: note: candidate function not viable: requires single argument '__p', but 3 arguments were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
^
In file included from src/main.cpp:1:
/usr/local/include/python3.7m/pybind11/pybind11.h:1011:9: error: call to unavailable function 'operator delete': introduced in macOS 10.12
::operator delete(p, s);
^~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:190:74: note: candidate function has been explicitly made unavailable
_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:221:40: note: candidate function not viable: no known conversion from 'pybind11::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:188:36: note: candidate function not viable: no known conversion from 'pybind11::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
^
note: candidate function not viable: no known conversion from 'pybind11::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:187:36: note: candidate function not viable: requires single argument '__p', but 2 arguments were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
^
3 errors generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/pip-req-build-9f8udd0w/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/pip-record-yvb3nloo/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/pip-req-build-9f8udd0w/
I ran into the same issue with my pybind11 project on Mac OS.
I haven't been able to figure it out the root cause, but found a workaround: I disabled the C++17 cpp flag by removing the -std=c++17 from the list here.
Therefore instead of receiving the same errors that you mentioned, I got them as warnings. It's not a proper solution, and I really like to see a real explanation for this, but at least I have my source code compiled.
Update:
As eudoxos pointed out in his comment they opened an issue on pybind11's github page related to this and the fix should be in the next release.
Related
I'm trying to install ruby 2.7.0 using RVM on MacOS(12.4: apple M2), but i'm getting below error and not able to install required ruby version. I have tried all the solutions available on internet related to openssl but nothing works for me and tried with rbenv also but no luck. Please help me, thank you in advance.
Current version: OpenSSL 1.1.1s 1 Nov 2022
+__rvm_make:0> make -j8
BASERUBY = /usr/bin/ruby --disable=gems
CC = gcc
LD = ld
LDSHARED = gcc -dynamiclib
CFLAGS = -O3 -ggdb3 -Wno-error=implicit-function-declaration -std=gnu99 -fno-common -pipe
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -DCANONICALIZATION_FOR_MATHN -I. -I.ext/include/-darwin21 -I./include -I. -I./enc/unicode/12.1.0
CPPFLAGS = -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl#1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT
DLDFLAGS = -Wl,-multiply_defined,suppress -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl#1.1/lib -install_name /Users/rashmib/.rvm/rubies/ruby-2.7.0/lib/libruby.2.7.dylib -compatibility_version 2.7 -current_version 2.7.0 -fstack-protector-strong -framework Security -framework Foundation -fstack-protector-strong -framework Security -framework Foundation
SOLIBS = -lpthread -ldl -lobjc
LANG =
LC_ALL =
LC_CTYPE = UTF-8
MFLAGS = - --jobserver-fds=4,5 -j
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin21.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
compiling ./main.c
compiling dmydln.c
compiling miniinit.c
compiling dmyext.c
translating probes probes.d
compiling bignum.c
compiling class.c
compiling ast.c
. ./vm_opts.h
compiling compar.c
compiling compile.c
compiling complex.c
compiling cont.c
bignum.c:6127:33: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
return rb_num_coerce_bin(x, y, rb_intern("remainder"));
^~~~~~~~~~~~~~~~~~~~~~
./include/ruby/ruby.h:1847:23: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^
bignum.c:6127:33: note: '{' token is here
return rb_num_coerce_bin(x, y, rb_intern("remainder"));
^~~~~~~~~~~~~~~~~~~~~~
./include/ruby/ruby.h:1847:24: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/ruby/ruby.h:1832:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
{ \
^
bignum.c:6127:33: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
return rb_num_coerce_bin(x, y, rb_intern("remainder"));
^~~~~~~~~~~~~~~~~~~~~~
./include/ruby/ruby.h:1847:24: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/ruby/ruby.h:1837:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
}
^
bignum.c:6127:33: note: ')' token is here
return rb_num_coerce_bin(x, y, rb_intern("remainder"));
^~~~~~~~~~~~~~~~~~~~~~
./include/ruby/ruby.h:1847:56: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^
class.c:541:13: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
After trying lot of suggestions, following these steps worked for me
MAC ports installation
https://trac.macports.org/wiki/Migration
Run
rvm install 2.7.0 --with-out-ext=fiddle
When I am bitbaking my custom image recipe for STM32MP1 based Avenger96 board I am facing some errors related to analyze.l:466:19: error: format not a string literal and no format arguments [-Werror=format-security]. I don't understand why I am getting this error as this is the first I am facing it. Please find the below complete log:
DEBUG: Executing python function autotools_aclocals
DEBUG: SITE files ['endian-little', 'bit-32', 'arm-common', 'arm-32', 'common-linux', 'common-glibc', 'arm-linux', 'arm-linux-gnueabi', 'common']
DEBUG: Python function autotools_aclocals finished
DEBUG: Executing shell function do_compile
NOTE: make -j 8
make all-recursive
make[1]: Entering directory '/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/build'
Making all in src
make[2]: Entering directory '/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/build/src'
Making all in libcommon
make[3]: Entering directory '/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/build/src/libcommon'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/build/src/libcommon'
Making all in libkbdfile
make[3]: Entering directory '/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/build/src/libkbdfile'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/build/src/libkbdfile'
Making all in libkeymap
make[3]: Entering directory '/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/build/src/libkeymap'
make all-am
make[4]: Entering directory '/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/build/src/libkeymap'
../../arm-poky-linux-gnueabi-libtool --tag=CC --mode=compile arm-poky-linux-gnueabi-gcc -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../../kbd-2.2.0/src/libkeymap -I../.. -I../../../kbd-2.2.0/src/libkeymap -I. -I../../../kbd-2.2.0/src/libkeymap/.. -I./.. -I../../../kbd-2.2.0/src/libkeymap/../libcommon -I./../libcommon -I../../../kbd-2.2.0/src/libkeymap/../libkbdfile -I./../libkbdfile -DDATADIR=\"/usr/share\" -DLOCALEDIR=\"/usr/share/locale\" -U_GNU_SOURCE -funit-at-a-time -g -O2 -D_FORTIFY_SOURCE=2 -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0=/usr/src/debug/kbd/2.2.0-r0 -fdebug-prefix-map=/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0=/usr/src/debug/kbd/2.2.0-r0 -fdebug-prefix-map=/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/recipe-sysroot= -fdebug-prefix-map=/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/recipe-sysroot-native= -Waggregate-return -Wall -Wcast-align -Wconversion -Wdisabled-optimization -Wextra -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -c -o analyze.lo ../../../kbd-2.2.0/src/libkeymap/analyze.c
arm-poky-linux-gnueabi-libtool: compile: arm-poky-linux-gnueabi-gcc -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../../kbd-2.2.0/src/libkeymap -I../.. -I../../../kbd-2.2.0/src/libkeymap -I. -I../../../kbd-2.2.0/src/libkeymap/.. -I./.. -I../../../kbd-2.2.0/src/libkeymap/../libcommon -I./../libcommon -I../../../kbd-2.2.0/src/libkeymap/../libkbdfile -I./../libkbdfile -DDATADIR=\"/usr/share\" -DLOCALEDIR=\"/usr/share/locale\" -U_GNU_SOURCE -funit-at-a-time -g -O2 -D_FORTIFY_SOURCE=2 -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0=/usr/src/debug/kbd/2.2.0-r0 -fdebug-prefix-map=/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0=/usr/src/debug/kbd/2.2.0-r0 -fdebug-prefix-map=/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/recipe-sysroot= -fdebug-prefix-map=/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/recipe-sysroot-native= -Waggregate-return -Wall -Wcast-align -Wconversion -Wdisabled-optimization -Wextra -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -c ../../../kbd-2.2.0/src/libkeymap/analyze.c -fPIC -DPIC -o .libs/analyze.o
analyze.l: In function 'find_incl_file_near_fn':
analyze.l:141:24: warning: passing argument 2 of 'kbdfile_find' from incompatible pointer type [-Wincompatible-pointer-types]
In file included from ../../../kbd-2.2.0/src/libkeymap/keymap/kmap.h:36,
from ../../../kbd-2.2.0/src/libkeymap/keymap.h:8,
from ../../../kbd-2.2.0/src/libkeymap/analyze.c:1:
../../../kbd-2.2.0/src/libkeymap/../libkbdfile/kbdfile.h:40:37: note: expected 'char **' but argument is of type 'const char **'
40 | int kbdfile_find(char *fnam, char **dirpath, char **suffixes, struct kbdfile *fp);
| ~~~~~~~^~~~~~~
analyze.l:141:42: warning: passing argument 3 of 'kbdfile_find' from incompatible pointer type [-Wincompatible-pointer-types]
In file included from ../../../kbd-2.2.0/src/libkeymap/keymap/kmap.h:36,
from ../../../kbd-2.2.0/src/libkeymap/keymap.h:8,
from ../../../kbd-2.2.0/src/libkeymap/analyze.c:1:
../../../kbd-2.2.0/src/libkeymap/../libkbdfile/kbdfile.h:40:53: note: expected 'char **' but argument is of type 'const char * const*'
40 | int kbdfile_find(char *fnam, char **dirpath, char **suffixes, struct kbdfile *fp);
| ~~~~~~~^~~~~~~~
analyze.l: In function 'find_standard_incl_file':
analyze.l:168:22: warning: passing argument 2 of 'kbdfile_find' from incompatible pointer type [-Wincompatible-pointer-types]
In file included from ../../../kbd-2.2.0/src/libkeymap/keymap/kmap.h:36,
from ../../../kbd-2.2.0/src/libkeymap/keymap.h:8,
from ../../../kbd-2.2.0/src/libkeymap/analyze.c:1:
../../../kbd-2.2.0/src/libkeymap/../libkbdfile/kbdfile.h:40:37: note: expected 'char **' but argument is of type 'const char * const*'
40 | int kbdfile_find(char *fnam, char **dirpath, char **suffixes, struct kbdfile *fp);
| ~~~~~~~^~~~~~~
analyze.l:168:40: warning: passing argument 3 of 'kbdfile_find' from incompatible pointer type [-Wincompatible-pointer-types]
In file included from ../../../kbd-2.2.0/src/libkeymap/keymap/kmap.h:36,
from ../../../kbd-2.2.0/src/libkeymap/keymap.h:8,
from ../../../kbd-2.2.0/src/libkeymap/analyze.c:1:
../../../kbd-2.2.0/src/libkeymap/../libkbdfile/kbdfile.h:40:53: note: expected 'char **' but argument is of type 'const char * const*'
40 | int kbdfile_find(char *fnam, char **dirpath, char **suffixes, struct kbdfile *fp);
| ~~~~~~~^~~~~~~~
analyze.l:197:24: warning: passing argument 2 of 'kbdfile_find' from incompatible pointer type [-Wincompatible-pointer-types]
In file included from ../../../kbd-2.2.0/src/libkeymap/keymap/kmap.h:36,
from ../../../kbd-2.2.0/src/libkeymap/keymap.h:8,
from ../../../kbd-2.2.0/src/libkeymap/analyze.c:1:
../../../kbd-2.2.0/src/libkeymap/../libkbdfile/kbdfile.h:40:37: note: expected 'char **' but argument is of type 'const char * const*'
40 | int kbdfile_find(char *fnam, char **dirpath, char **suffixes, struct kbdfile *fp);
| ~~~~~~~^~~~~~~
analyze.l:197:42: warning: passing argument 3 of 'kbdfile_find' from incompatible pointer type [-Wincompatible-pointer-types]
In file included from ../../../kbd-2.2.0/src/libkeymap/keymap/kmap.h:36,
from ../../../kbd-2.2.0/src/libkeymap/keymap.h:8,
from ../../../kbd-2.2.0/src/libkeymap/analyze.c:1:
../../../kbd-2.2.0/src/libkeymap/../libkbdfile/kbdfile.h:40:53: note: expected 'char **' but argument is of type 'const char * const*'
40 | int kbdfile_find(char *fnam, char **dirpath, char **suffixes, struct kbdfile *fp);
| ~~~~~~~^~~~~~~~
analyze.l: In function 'find_incl_file':
analyze.l:210:27: warning: passing argument 2 of 'kbdfile_find' from incompatible pointer type [-Wincompatible-pointer-types]
In file included from ../../../kbd-2.2.0/src/libkeymap/keymap/kmap.h:36,
from ../../../kbd-2.2.0/src/libkeymap/keymap.h:8,
from ../../../kbd-2.2.0/src/libkeymap/analyze.c:1:
../../../kbd-2.2.0/src/libkeymap/../libkbdfile/kbdfile.h:40:37: note: expected 'char **' but argument is of type 'const char * const*'
40 | int kbdfile_find(char *fnam, char **dirpath, char **suffixes, struct kbdfile *fp);
| ~~~~~~~^~~~~~~
analyze.l:210:45: warning: passing argument 3 of 'kbdfile_find' from incompatible pointer type [-Wincompatible-pointer-types]
In file included from ../../../kbd-2.2.0/src/libkeymap/keymap/kmap.h:36,
from ../../../kbd-2.2.0/src/libkeymap/keymap.h:8,
from ../../../kbd-2.2.0/src/libkeymap/analyze.c:1:
../../../kbd-2.2.0/src/libkeymap/../libkbdfile/kbdfile.h:40:53: note: expected 'char **' but argument is of type 'const char * const*'
40 | int kbdfile_find(char *fnam, char **dirpath, char **suffixes, struct kbdfile *fp);
| ~~~~~~~^~~~~~~~
analyze.l:225:26: warning: passing argument 2 of 'kbdfile_find' from incompatible pointer type [-Wincompatible-pointer-types]
In file included from ../../../kbd-2.2.0/src/libkeymap/keymap/kmap.h:36,
from ../../../kbd-2.2.0/src/libkeymap/keymap.h:8,
from ../../../kbd-2.2.0/src/libkeymap/analyze.c:1:
../../../kbd-2.2.0/src/libkeymap/../libkbdfile/kbdfile.h:40:37: note: expected 'char **' but argument is of type 'const char **'
40 | int kbdfile_find(char *fnam, char **dirpath, char **suffixes, struct kbdfile *fp);
| ~~~~~~~^~~~~~~
analyze.l:225:36: warning: passing argument 3 of 'kbdfile_find' from incompatible pointer type [-Wincompatible-pointer-types]
In file included from ../../../kbd-2.2.0/src/libkeymap/keymap/kmap.h:36,
from ../../../kbd-2.2.0/src/libkeymap/keymap.h:8,
from ../../../kbd-2.2.0/src/libkeymap/analyze.c:1:
../../../kbd-2.2.0/src/libkeymap/../libkbdfile/kbdfile.h:40:53: note: expected 'char **' but argument is of type 'const char * const*'
40 | int kbdfile_find(char *fnam, char **dirpath, char **suffixes, struct kbdfile *fp);
| ~~~~~~~^~~~~~~~
In file included from analyze.l:10:
analyze.l: In function 'yylex':
analyze.l:466:19: error: format not a string literal and no format arguments [-Werror=format-security]
../../../kbd-2.2.0/src/libkeymap/contextP.h:79:55: note: in definition of macro 'lk_log_cond'
79 | lk_log(ctx, level, __FILE__, __LINE__, __func__, ##arg); \
| ^~~
analyze.l:466:6: note: in expansion of macro 'ERR'
cc1: some warnings being treated as errors
make[4]: *** [Makefile:604: analyze.lo] Error 1
make[4]: Leaving directory '/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/build/src/libkeymap'
make[3]: *** [Makefile:476: all] Error 2
make[3]: Leaving directory '/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/build/src/libkeymap'
make[2]: *** [Makefile:1083: all-recursive] Error 1
make[2]: Leaving directory '/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/build/src'
make[1]: *** [Makefile:471: all-recursive] Error 1
make[1]: Leaving directory '/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/build'
ERROR: oe_runmake failed
make: *** [Makefile:402: all] Error 2
WARNING: exit code 1 from a shell command.
ERROR: Execution of '/root/build-swu-v2/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0/temp/run.do_compile.380' failed with exit code 1
When I checked the sources/poky/meta/recipes-core/kbd, add missing string format patch patch is already available and included in kbd_2.2.0.bb recipe. And same patch is also present in build/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/kbd/2.2.0-r0. But still I am getting above error.
I have no idea what this error means and why am I getting this all of a sudden.
Can anyone please let me know how to fix this issue?
Your help will be much appreciated.
Thanks in advance.
You should NOT do the following, its likely your code compiles just fine on an older version of GCC, but GCC adds new warnings and errors for security purposes, you should really look at the code and fix it properly, it is also very likely you just need to use a newer version of kbd that builds contains these fixes (kbd is at 2.4.0 in the latest branch: https://git.yoctoproject.org/poky/tree/meta/recipes-core/kbd/kbd_2.4.0.bb).
But if you want to temporarily disable the GCC error to check if your build works while you either fix the kbd code or upgrade to a new version of kbd, you could set:
CFLAGS += "-Wno-error=format-security"
Which will suppress the compilation error, I cannot stress this enough, the fix is to actually fix the kbd code.
quick fix, thanks to aehs29:
copy file
https://git.yoctoproject.org/poky/tree/meta/recipes-core/kbd/kbd_2.4.0.bb
to the folder .../poky/meta/recipes-core/kbd/
remove file .../poky/meta/recipes-core/kbd/kbd_2.2.0.bb
and rebuild
bitbake -k radxa-minimal-image
I am working on Ubuntu 16.04 and am trying to install fasttext through terminal using the following commands (from their website):
$ wget https://github.com/facebookresearch/fastText/archive/v0.2.0.zip
$ unzip v0.2.0.zip
$ cd fastText-0.2.0
$ make
But I am getting the following error when I try to make it:
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/args.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/dictionary.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/productquantizer.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/matrix.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/qmatrix.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/vector.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/model.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/utils.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/meter.cc
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops -c src/fasttext.cc
src/fasttext.cc: In member function ‘void fasttext::FastText::quantize(const fasttext::Args&)’:
src/fasttext.cc:302:16: warning: ‘std::vector<int> fasttext::FastText::selectEmbeddings(int32_t) const’ is deprecated: selectEmbeddings is being deprecated. [-Wdeprecated-declarations]
auto idx = selectEmbeddings(qargs.cutoff);
^
src/fasttext.cc:279:22: note: declared here
std::vector<int32_t> FastText::selectEmbeddings(int32_t cutoff) const {
^
src/fasttext.cc:302:45: warning: ‘std::vector<int> fasttext::FastText::selectEmbeddings(int32_t) const’ is deprecated: selectEmbeddings is being deprecated. [-Wdeprecated-declarations]
auto idx = selectEmbeddings(qargs.cutoff);
^
src/fasttext.cc:279:22: note: declared here
std::vector<int32_t> FastText::selectEmbeddings(int32_t cutoff) const {
^
src/fasttext.cc: In member function ‘void fasttext::FastText::lazyComputeWordVectors()’:
src/fasttext.cc:531:5: warning: ‘void fasttext::FastText::precomputeWordVectors(fasttext::Matrix&)’ is deprecated: precomputeWordVectors is being deprecated. [-Wdeprecated-declarations]
precomputeWordVectors(*wordVectors_);
^
src/fasttext.cc:514:6: note: declared here
void FastText::precomputeWordVectors(Matrix& wordVectors) {
^
src/fasttext.cc:531:40: warning: ‘void fasttext::FastText::precomputeWordVectors(fasttext::Matrix&)’ is deprecated: precomputeWordVectors is being deprecated. [-Wdeprecated-declarations]
precomputeWordVectors(*wordVectors_);
^
src/fasttext.cc:514:6: note: declared here
void FastText::precomputeWordVectors(Matrix& wordVectors) {
^
src/fasttext.cc: In member function ‘void fasttext::FastText::trainThread(int32_t)’:
src/fasttext.cc:650:7: warning: ‘void fasttext::FastText::supervised(fasttext::Model&, fasttext::real, const std::vector<int>&, const std::vector<int>&)’ is deprecated: supervised is being deprecated. [-Wdeprecated-declarations]
supervised(model, lr, line, labels);
^
src/fasttext.cc:338:6: note: declared here
void FastText::supervised(
^
src/fasttext.cc:650:41: warning: ‘void fasttext::FastText::supervised(fasttext::Model&, fasttext::real, const std::vector<int>&, const std::vector<int>&)’ is deprecated: supervised is being deprecated. [-Wdeprecated-declarations]
supervised(model, lr, line, labels);
^
src/fasttext.cc:338:6: note: declared here
void FastText::supervised(
^
src/fasttext.cc:653:7: warning: ‘void fasttext::FastText::cbow(fasttext::Model&, fasttext::real, const std::vector<int>&)’ is deprecated: cbow is being deprecated. [-Wdeprecated-declarations]
cbow(model, lr, line);
^
src/fasttext.cc:355:6: note: declared here
void FastText::cbow(Model& model, real lr, const std::vector<int32_t>& line) {
^
src/fasttext.cc:653:27: warning: ‘void fasttext::FastText::cbow(fasttext::Model&, fasttext::real, const std::vector<int>&)’ is deprecated: cbow is being deprecated. [-Wdeprecated-declarations]
cbow(model, lr, line);
^
src/fasttext.cc:355:6: note: declared here
void FastText::cbow(Model& model, real lr, const std::vector<int32_t>& line) {
^
src/fasttext.cc:656:7: warning: ‘void fasttext::FastText::skipgram(fasttext::Model&, fasttext::real, const std::vector<int>&)’ is deprecated: skipgram is being deprecated. [-Wdeprecated-declarations]
skipgram(model, lr, line);
^
src/fasttext.cc:371:6: note: declared here
void FastText::skipgram(
^
src/fasttext.cc:656:31: warning: ‘void fasttext::FastText::skipgram(fasttext::Model&, fasttext::real, const std::vector<int>&)’ is deprecated: skipgram is being deprecated. [-Wdeprecated-declarations]
skipgram(model, lr, line);
^
src/fasttext.cc:371:6: note: declared here
void FastText::skipgram(
^
c++ -pthread -std=c++0x -march=native -O3 -funroll-loops args.o dictionary.o productquantizer.o matrix.o qmatrix.o vector.o model.o utils.o meter.o fasttext.o src/main.cc -o fasttext
I don't know what is causing the error. As far as I have figure, these are depreciation warnings and make is treating them errors. Is there anyway to suppress this behaviour of make?
Or is there any other way to install fasttext?
I read from somewhere and tried make -i but it is also giving the same error.
Thanks in advance!
I had the same issue in version v0.9.1. They are just warnings. My binary still compiled with just the warnings.
./fasttext
The environments are Cent OS 6.7, boost-1.6.2, gcc-6.2.0
I have tried to install a software, but I got some errors.
Are theses errors come from g++ ? or boost?
I can't understand these messages.. because I have never been use g++..
Here is starting line.
[root#cms CASMcode-0.2.0]# scons install
scons: Reading SConscript files ...
rm /usr/local/include/casm
scons: done reading SConscript files.
scons: Building targets ...
Install directory: "include/casm" as "/usr/local/include/casm"
/usr/local/gcc-6.2/bin/g++-6.2 -o src/casm/version/version.os -c -DNDEBUG -O3 --std=c++11 -Wno-deprecated-register -Wno-deprecated-declarations -DEIGEN_DEFAULT_DENSE_INDEX_TYPE=long -Wno-unused-parameter -DNDEBUG -O3 -DGZSTREAM_NAMESPACE=gz -fPIC -Iinclude src/casm/version/version.cc
/usr/local/gcc-6.2/bin/g++-6.2 -o src/casm/clex/ConfigIOStrucScore.os -c -DNDEBUG -O3 --std=c++11 -Wno-deprecated-register -Wno-deprecated-declarations -DEIGEN_DEFAULT_DENSE_INDEX_TYPE=long -Wno-unused-parameter -DNDEBUG -O3 -DGZSTREAM_NAMESPACE=gz -fPIC -Iinclude -I/usr/local/boost_1_62_0/include src/casm/clex/ConfigIOStrucScore.cc
In file included from include/casm/external/Eigen/Core:263:0,
from include/casm/external/Eigen/Dense:1,
from include/casm/CASM_global_definitions.hh:13,
from include/casm/casm_io/EigenDataStream.hh:3,
from src/casm/clex/ConfigIOStrucScore.cc:3:
Error message appear here.
In file included from include/casm/casm_io/DataFormatterTools.hh:1291:0,
from include/casm/casm_io/DataFormatter_impl.hh:3,
from include/casm/casm_io/DataFormatter.hh:757,
from include/casm/clex/ConfigIO.hh:4,
from src/casm/clex/ConfigIOStrucScore.cc:6:
include/casm/casm_io/DataFormatterTools_impl.hh: In member function 'bool CASM::DataFormatterOperator<ValueType, ArgType, DataObject>::parse_args(const string&)':
include/casm/casm_io/DataFormatterTools_impl.hh:33:33: error: invalid initialization of reference of type 'const wstring& {aka const std::__cxx11::basic_string<wchar_t>&}' from expression of type 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}'
val = std::stod(ttag);
^
And here
In file included from include/casm/clex/PrimClex.hh:14:0,
from include/casm/clex/ConfigIOStrucScore.hh:6,
from src/casm/clex/ConfigIOStrucScore.cc:7:
include/casm/clex/ChemicalReference.hh: In member function 'void CASM::ChemicalReferencePrinter::print(const std::vector<CASM::ChemicalReferenceState>&)':
include/casm/clex/ChemicalReference.hh:366:27: error: 'round' is not a member of 'std'
if(almost_equal(std::round(num), num, 1e-14)) {
^~~
I'm using Mac OS X 10.9. I have already installed graphviz 2.36.0.
After downloading pygraphviz 1.2, I modified in setup.py the variables "library_path" and "include_path":
library_path='/usr/local/lib/graphviz'
include_path='/usr/local/include/graphviz'
When I try to install graphviz with python setup.py install, I get the following message:
library_path=/usr/local/lib/graphviz
include_path=/usr/local/include/graphviz
running install
running build
running build_py
running build_ext
building 'pygraphviz._graphviz' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/usr/local/include/graphviz -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.9-intel-2.7/pygraphviz/graphviz_wrap.o
pygraphviz/graphviz_wrap.c:2040:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
pygraphviz/graphviz_wrap.c:2043:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
pygraphviz/graphviz_wrap.c:2829:15: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = strlen(val);
~ ^~~~~~~~~~~
pygraphviz/graphviz_wrap.c:2855:12: warning: incompatible pointer to integer conversion returning 'Agsym_t *' (aka 'struct Agsym_s *') from a function with result type 'int' [-Wint-conversion]
return agattr(g, kind, name, val);
^~~~~~~~~~~~~~~~~~~~~~~~~~
pygraphviz/graphviz_wrap.c:2847:15: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = strlen(val);
~ ^~~~~~~~~~~
pygraphviz/graphviz_wrap.c:4806:14: warning: explicitly assigning a variable of type 'void *' to itself [-Wself-assign]
clientdata = clientdata;
~~~~~~~~~~ ^ ~~~~~~~~~~
6 warnings generated.
pygraphviz/graphviz_wrap.c:2040:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
pygraphviz/graphviz_wrap.c:2043:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
pygraphviz/graphviz_wrap.c:2855:12: warning: incompatible pointer to integer conversion returning 'Agsym_t *' (aka 'struct Agsym_s *') from a function with result type 'int' [-Wint-conversion]
return agattr(g, kind, name, val);
^~~~~~~~~~~~~~~~~~~~~~~~~~
pygraphviz/graphviz_wrap.c:4806:14: warning: explicitly assigning a variable of type 'void *' to itself [-Wself-assign]
clientdata = clientdata;
~~~~~~~~~~ ^ ~~~~~~~~~~
4 warnings generated.
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.9-intel-2.7/pygraphviz/graphviz_wrap.o -L/usr/local/lib/graphviz -L/usr/local/lib/graphviz -lcgraph -lcdt -o build/lib.macosx-10.9-intel-2.7/pygraphviz/_graphviz.so
ld: library not found for -lcgraph
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
Does anybody know how I can fix this?
Make sure your XCode is updated to the latest version and then try this:
xcode-select --install
When prompted install the command line tools. Then try rebuilding.