Upgraded to php 5.3.10 and simpleXMLelement is broken - simplexml

This code was working and when we upgraded to php 5.3.10 it stopped working and started throwing some really odd errors.
The original XML validates on w3c.org without errors however I've edited out the site specific for brevity and security.
The XML (edited for brevity but error is produced on line 1):
<AmberAlertDirective
xmlns="http://www.hidden.com/AmberAlert"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hidden.com/en_US/AmberAlert.xsd">
<Directive>New</Directive>
<AmberAlertId>9969</AmberAlertId>
<MessageTimestamp>2012-03-27T00:35:11</MessageTimestamp>
<AmberAlert>
<Target>
<State Code="OH">
</State>
</Target>
</AmberAlert>
</AmberAlertDirective>
The php errors from error_log:
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: Entity: line 2: parser error : AttValue: " or ' expected in /aa.php on line 125
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: xmlns=\"http://www.missingkids.com/amber/NCMECAmberAlert\" in /aa.php on line 125
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: ^ in /aa.php on line 125
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: Entity: line 2: parser error : attributes construct error in /aa.php on line 125
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: xmlns=\"http://www.missingkids.com/amber/NCMECAmberAlert\" in /aa.php on line 125
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: ^ in /aa.php on line 125
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: Entity: line 2: parser error : Couldn't find end of Start Tag AmberAlertDirective line 1 in /aa.php on line 125
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: xmlns=\"http://www.missingkids.com/amber/NCMECAmberAlert\" in /aa.php on line 125
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: ^ in /aa.php on line 125
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: Entity: line 2: parser error : Extra content at the end of the document in /aa.php on line 125
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: xmlns=\"http://www.missingkids.com/amber/NCMECAmberAlert\" in /aa.php on line 125
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: ^ in /aa.php on line 125
PHP Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /aa.php:125
Stack trace:
#0 /aa.php(125): SimpleXMLElement->__construct('<AmberAlertDire...')
#1 /AAServlet.php(64): processAmber('<AmberAlertDire...')
#2 {main}
thrown in /aa.php on line 125

Try turning Off magic_quotes or putting your XML content through stripslashes before passing to SimpleXML.

From your errors I believe your problem is in not registering your namespaces. Namely your default namespace. There are a few ways of going about it, it just depends on how you are processing the data.
XPATH:
$xml->registerXPathNamespace('default', 'http://www.hidden.com/AmberAlert');
children():
$xml->children('http://www.hidden.com/AmberAlert');

Related

How to fix error that occurred while building CXX object CMakeFiles/tvm_objs.dir/src/target/llvm/codegen_llvm.cc.o?

I've built LLVM from source following these instructions and now I am attempting to build TVM from source according to the instructions in this official website
I do the cmake3 -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ .. command
and get the following output
-- Build with RPC support...
-- Build with Graph runtime support...
-- Build with Graph runtime debug support...
-- VTA build with VTA_HW_PATH=/research/d1/lj2001/tvm/3rdparty/vta-hw
-- Build VTA runtime with target: sim
-- Found CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
-- Found CUDA_CUDA_LIBRARY=/usr/local/cuda/targets/x86_64-linux/lib/stubs/libcuda.so
-- Found CUDA_CUDART_LIBRARY=/usr/local/cuda/lib64/libcudart.so
-- Found CUDA_NVRTC_LIBRARY=/usr/local/cuda/lib64/libnvrtc.so
-- Found CUDA_CUDNN_LIBRARY=/usr/local/cuda/lib64/libcudnn.so
-- Found CUDA_CUBLAS_LIBRARY=/usr/local/cuda/lib64/libcublas.so
-- Found CUDA_CUBLASLT_LIBRARY=/usr/local/cuda/lib64/libcublasLt.so
-- Build with CUDA support
-- Use llvm-config=/research/d1/lj2001/llvm/bin/llvm-config
-- Found LLVM_INCLUDE_DIRS=/research/d1/lj2001/llvm/include
-- Found LLVM_DEFINITIONS=-D_GNU_SOURCE;-D_DEBUG;-D__STDC_CONSTANT_MACROS;-D__STDC_FORMAT_MACROS;-D__STDC_LIMIT_MACROS
...
-- Found TVM_LLVM_VERSION=120
-- Build with LLVM
-- Set TVM_LLVM_VERSION=120
-- Build with contrib.random
-- Build with contrib.sort
-- Build with contrib.hybriddump
-- Git found: /bin/git
-- Found TVM_GIT_COMMIT_HASH=27abfadc55e79e3d40b7de7d4b87eb87a19b7b97
-- Performing Test SUPPORT_CXX14
-- Performing Test SUPPORT_CXX14 - Success
-- Building with TVM Map...
-- Build with thread support...
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /research/d1/lj2001/tvm/build
But when I run make -j24 I get the following output:
Scanning dependencies of target tvm_runtime_objs
Scanning dependencies of target tvm_objs
[ 10%] Built target tvm_runtime_objs
Scanning dependencies of target tvm_runtime
[ 10%] Linking CXX shared library libtvm_runtime.so
[ 10%] Built target tvm_runtime
[ 10%] Building CXX object CMakeFiles/tvm_objs.dir/src/target/llvm/codegen_llvm.cc.o
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc: In member function ‘llvm::Value* tvm::codegen::CodeGenLLVM::CreateBroadcast(llvm::Value*, int)’:
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:480:82: error: ‘llvm::ElementCount::ElementCount(unsigned int, bool)’ is private within this context
480 | llvm::ConstantVector::getSplat(llvm::ElementCount(lanes, /*Scalable=*/false), zero);
| ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Type.h:24,
from /research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:23,
from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/Support/TypeSize.h:39:3: note: declared private here
39 | ElementCount(unsigned Min, bool Scalable) : Min(Min), Scalable(Scalable) {}
| ^~~~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc: In member function ‘llvm::Value* tvm::codegen::CodeGenLLVM::CreateVecSlice(llvm::Value*, int, int)’:
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:488:80: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
488 | int num_elems = llvm::cast<llvm::VectorType>(vec->getType())->getNumElements();
| ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
534 | unsigned VectorType::getNumElements() const {
| ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc: In member function ‘llvm::Value* tvm::codegen::CodeGenLLVM::CreateVecFlip(llvm::Value*)’:
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:504:80: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
504 | int num_elems = llvm::cast<llvm::VectorType>(vec->getType())->getNumElements();
| ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
534 | unsigned VectorType::getNumElements() const {
| ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc: In member function ‘llvm::Value* tvm::codegen::CodeGenLLVM::CreateVecPad(llvm::Value*, int)’:
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:518:80: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
518 | int num_elems = llvm::cast<llvm::VectorType>(vec->getType())->getNumElements();
| ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
534 | unsigned VectorType::getNumElements() const {
| ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc: In member function ‘llvm::Value* tvm::codegen::CodeGenLLVM::CreateVecConcat(std::vector<llvm::Value*, std::allocator<llvm::Value*> >)’:
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:532:79: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
532 | total_lanes += llvm::cast<llvm::VectorType>(v->getType())->getNumElements();
| ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
534 | unsigned VectorType::getNumElements() const {
| ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:539:93: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
539 | const size_t lhs_lanes = llvm::cast<llvm::VectorType>(lhs->getType())->getNumElements();
| ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
534 | unsigned VectorType::getNumElements() const {
| ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:540:93: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
540 | const size_t rhs_lanes = llvm::cast<llvm::VectorType>(rhs->getType())->getNumElements();
| ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
534 | unsigned VectorType::getNumElements() const {
| ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc: In member function ‘virtual llvm::Value* tvm::codegen::CodeGenLLVM::CreateIntrinsic(const tvm::tir::CallNode*)’:
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:844:72: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
844 | int l = llvm::cast<llvm::VectorType>(v->getType())->getNumElements();
| ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
534 | unsigned VectorType::getNumElements() const {
| ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:848:72: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
848 | int l = llvm::cast<llvm::VectorType>(v->getType())->getNumElements();
| ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
534 | unsigned VectorType::getNumElements() const {
| ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:853:81: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
853 | int num_elems = llvm::cast<llvm::VectorType>(v0->getType())->getNumElements() * 2;
| ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
534 | unsigned VectorType::getNumElements() const {
| ^~~~~~~~~~
make[2]: *** [CMakeFiles/tvm_objs.dir/src/target/llvm/codegen_llvm.cc.o] Error 1
make[1]: *** [CMakeFiles/tvm_objs.dir/all] Error 2
make: *** [all] Error 2
How do I fix this?

Understanding the gibberish error when compiling LLVM from source

Here are the things I did,
Compiled and installed gcc-9.2.
Compiled and installed GNU binutils-2.32
Compiled and installed GNU Make-4.2
I downloaded the source codes for LLVM, Clang, LLD, libcxx, libcxxabi, lldb, polly, openmp and compiler-rt from the LLVM site (for version 8.0.1).
I proceeded to compile LLVM alongwith the above projects.
During compilation I get some gibberish errors. I reproduce a part of the output below :
In file included from /data/stars/user/uujjwal/collection-stars/gcc-9.2/include/c++/9.2.0/iomanip:43,
from /tmp/llvm/llvm/utils/PerfectShuffle/PerfectShuffle.cpp:19:
/usr/bin/locale:112:4: error: stray ‘\10’ in program
/usr/bin/locale:112:12: error: stray ‘\30’ in program
/usr/bin/locale:112:20: error: stray ‘\302’ in program
/usr/bin/locale:112:24: error: stray ‘\1’ in program
/usr/bin/locale:112:28: error: stray ‘\6’ in program
/usr/bin/locale:112:37: error: stray ‘\27’ in program
/usr/bin/locale:112:38: error: stray ‘#’ in program
/usr/bin/locale:112:45: error: stray ‘\27’ in program
/usr/bin/locale:112:52: error: stray ‘\32’ in program
/usr/bin/locale:112:68: error: stray ‘\4’ in program
/usr/bin/locale:112:84: error: stray ‘\315’ in program
/usr/bin/locale:112:88: error: stray ‘\1’ in program
/usr/bin/locale:112:92: error: stray ‘\6’ in program
/usr/bin/locale:112:100: error: stray ‘\220’ in program
/usr/bin/locale:112:101: error: stray ‘\27’ in program
/usr/bin/locale:112:102: error: stray ‘#’ in program
/usr/bin/locale:112:108: error: stray ‘\220’ in program
/usr/bin/locale:112:109: error: stray ‘\27’ in program
/usr/bin/locale:112:117: error: stray ‘\4’ in program
/usr/bin/locale:112:132: error: stray ‘\20’ in program
/usr/bin/locale:112:140: error: stray ‘\20’ in program
/usr/bin/locale:112:148: error: stray ‘\340’ in program
/usr/bin/locale:112:152: error: stray ‘\1’ in program
/usr/bin/locale:112:156: error: stray ‘\6’ in program
/usr/bin/locale:112:165: error: stray ‘\34’ in program
/usr/bin/locale:112:166: error: stray ‘#’ in program
/usr/bin/locale:112:173: error: stray ‘\34’ in program
/usr/bin/locale:112:180: error: stray ‘\362’ in program
/usr/bin/locale:112:196: error: stray ‘\20’ in program
/usr/bin/locale:112:216: error: stray ‘\1’ in program
/usr/bin/locale:112:220: error: stray ‘\6’ in program
/usr/bin/locale:112:228: error: stray ‘\364’ in program
/usr/bin/locale:112:230: error: stray ‘#’ in program
/usr/bin/locale:112:236: error: stray ‘\364’ in program
/usr/bin/locale:112:260: error: stray ‘\4’ in program
/usr/bin/locale:112:276: error: stray ‘\7’ in program
/usr/bin/locale:112:280: error: stray ‘\1’ in program
/usr/bin/locale:112:284: error: stray ‘\2’ in program
/usr/bin/locale:112:294: error: stray ‘#’ in program
/usr/bin/locale:112:308: error: stray ‘\331’ in program
/usr/bin/locale:112:309: error: stray ‘\25’ in program
/usr/bin/locale:112:340: error: stray ‘\247’ in program
/usr/bin/locale:112:344: error: stray ‘\1’ in program
/usr/bin/locale:112:348: error: stray ‘\2’ in program
/usr/bin/locale:112:356: error: stray ‘\334’ in program
/usr/bin/locale:112:358: error: stray ‘#’ in program
/usr/bin/locale:112:364: error: stray ‘\334’ in program
/usr/bin/locale:112:373: error: stray ‘\1’ in program
/usr/bin/locale:112:388: error: stray ‘\4’ in program
/usr/bin/locale:112:408: error: stray ‘\1’ in program
/usr/bin/locale:112:412: error: stray ‘\2’ in program
/usr/bin/locale:112:420: error: stray ‘\20’ in program
/usr/bin/locale:112:422: error: stray ‘#’ in program
/usr/bin/locale:112:428: error: stray ‘\20’ in program
/usr/bin/locale:112:436: error: stray ‘\354’ in program
/usr/bin/locale:112:437: error: stray ‘\6’ in program
/usr/bin/locale:112:452: error: stray ‘\10’ in program
/usr/bin/locale:112:468: error: stray ‘\362’ in program
/usr/bin/locale:112:472: error: stray ‘\16’ in program
/usr/bin/locale:112:476: error: stray ‘\3’ in program
/usr/bin/locale:112:486: error: stray ‘`’ in program
/usr/bin/locale:112:500: error: stray ‘\10’ in program
/usr/bin/locale:112:516: error: stray ‘\10’ in program
/usr/bin/locale:112:532: error: stray ‘\346’ in program
/usr/bin/locale:112:536: error: stray ‘\17’ in program
/usr/bin/locale:112:540: error: stray ‘\3’ in program
/usr/bin/locale:112:548: error: stray ‘\10’ in program
/usr/bin/locale:112:550: error: stray ‘`’ in program
/usr/bin/locale:112:556: error: stray ‘\10’ in program
/usr/bin/locale:112:564: error: stray ‘\10’ in program
/usr/bin/locale:112:580: error: stray ‘\10’ in program
/usr/bin/locale:112:596: error: stray ‘\242’ in program
/usr/bin/locale:112:600: error: stray ‘\1’ in program
/usr/bin/locale:112:604: error: stray ‘\3’ in program
/usr/bin/locale:112:612: error: stray ‘\20’ in program
/usr/bin/locale:112:614: error: stray ‘`’ in program
/usr/bin/locale:112:620: error: stray ‘\20’ in program
/usr/bin/locale:112:628: error: stray ‘\10’ in program
/usr/bin/locale:112:644: error: stray ‘\10’ in program
/usr/bin/locale:112:660: error: stray ‘\31’ in program
/usr/bin/locale:112:664: error: stray ‘\6’ in program
/usr/bin/locale:112:668: error: stray ‘\3’ in program
/usr/bin/locale:112:676: error: stray ‘\30’ in program
/usr/bin/locale:112:678: error: stray ‘`’ in program
/usr/bin/locale:112:684: error: stray ‘\30’ in program
/usr/bin/locale:112:692: error: stray ‘\340’ in program
/usr/bin/locale:112:693: error: stray ‘\1’ in program
/usr/bin/locale:112:700: error: stray ‘\7’ in program
/usr/bin/locale:112:708: error: stray ‘\10’ in program
/usr/bin/locale:112:716: error: stray ‘\20’ in program
/usr/bin/locale:112:724: error: stray ‘\333’ in program
/usr/bin/locale:112:728: error: stray ‘\1’ in program
/usr/bin/locale:112:732: error: stray ‘\3’ in program
/usr/bin/locale:112:740: error: stray ‘\370’ in program
/usr/bin/locale:112:742: error: stray ‘`’ in program
/usr/bin/locale:112:748: error: stray ‘\370’ in program
/usr/bin/locale:112:756: error: stray ‘\10’ in program
/usr/bin/locale:112:772: error: stray ‘\10’ in program
/usr/bin/locale:112:780: error: stray ‘\10’ in program
/usr/bin/locale:112:788: error: stray ‘\322’ in program
/usr/bin/locale:112:792: error: stray ‘\1’ in program
/usr/bin/locale:112:796: error: stray ‘\3’ in program
/usr/bin/locale:112:806: error: stray ‘`’ in program
/usr/bin/locale:112:821: error: stray ‘\2’ in program
/usr/bin/locale:112:836: error: stray ‘\10’ in program
/usr/bin/locale:112:844: error: stray ‘\10’ in program
/usr/bin/locale:112:852: error: stray ‘\1’ in program
/usr/bin/locale:112:856: error: stray ‘\1’ in program
/usr/bin/locale:112:860: error: stray ‘\3’ in program
/usr/bin/locale:112:868: error: stray ‘`’ in program
/usr/bin/locale:112:870: error: stray ‘`’ in program
/usr/bin/locale:112:876: error: stray ‘`’ in program
/usr/bin/locale:112:885: error: stray ‘\34’ in program
/usr/bin/locale:112:916: error: stray ‘\275’ in program
/usr/bin/locale:112:920: error: stray ‘\10’ in program
/usr/bin/locale:112:924: error: stray ‘\3’ in program
/usr/bin/locale:112:932: error: stray ‘\320’ in program
/usr/bin/locale:112:933: error: stray ‘\216’ in program
/usr/bin/locale:112:934: error: stray ‘`’ in program
/usr/bin/locale:112:940: error: stray ‘\304’ in program
/usr/bin/locale:112:941: error: stray ‘\216’ in program
/usr/bin/locale:112:964: error: stray ‘\20’ in program
/usr/bin/locale:112:984: error: stray ‘\1’ in program
/usr/bin/locale:112:1004: error: stray ‘\304’ in program
/usr/bin/locale:112:1005: error: stray ‘\216’ in program
/usr/bin/locale:112:1012: error: stray ‘\24’ in program
/usr/bin/locale:112:1028: error: stray ‘\4’ in program
/usr/bin/locale:112:1044: error: stray ‘\17’ in program
/usr/bin/locale:112:1048: error: stray ‘\3’ in program
/usr/bin/locale:112:1068: error: stray ‘\330’ in program
/usr/bin/locale:112:1069: error: stray ‘\216’ in program
/usr/bin/locale:112:1076: error: stray ‘\376’ in program
/usr/bin/locale:112:1092: error: stray ‘\1’ in program
In file included from /data/stars/user/uujjwal/collection-stars/gcc-9.2/include/c++/9.2.0/iomanip:43,
from /tmp/llvm/llvm/utils/PerfectShuffle/PerfectShuffle.cpp:19:
/usr/bin/locale:4:109: error: ‘t’ does not name a type; did you mean ‘tm’?
4 | pp`
xp`
�p` �p` �p` �p` �p` �p` �p` �p` �p` �p` �p` �p` �p` �p` �p` �p` D q` q` q` q` q` (q` ! 0q` " 8q` # #q` $ Hq` % Pq` & Xq` ' `q` ( hq` ) pq` * xq` + �q` , �q` - �q` J �q` . �q` / �q` G �q` 0 �q` 1 �q` 2 �q` 3 �q` 4 �q` 5 �q` 6 �q` 7 �q` 8 �q` 9 r` : r` ; r` < r` = r` > (r` ? 0r` # 8r` A #r` B H�H��X H��t�� H�� �5rX �%tX # �%rX h ������%jX h ������%bX h ������%ZX h ������%RX h ������%JX h ������%BX h ������%:X h �p����%2X �`����%*X h �P����%"X h
| ^
| tm
In file included from /data/stars/user/uujjwal/collection-stars/gcc-9.2/include/c++/9.2.0/iomanip:43,
from /tmp/llvm/llvm/utils/PerfectShuffle/PerfectShuffle.cpp:19:
/usr/bin/locale:5:721: error: ‘libc’ does not name a type
5 | �#����%X h
�0����%X h
� ����%
| ^
In file included from /data/stars/user/uujjwal/collection-stars/gcc-9.2/include/c++/9.2.0/iomanip:43,
from /tmp/llvm/llvm/utils/PerfectShuffle/PerfectShuffle.cpp:19:
/usr/bin/locale:12:234: error: expected unqualified-id before numeric constant
12 | []A\A]�����D D�j E���� 1��{~C� �;��w���H��tH�5�i H�������H�5�i �; �������C��9�ŋ;��<���H��tH�5`i H�������D� �i E���X���H�5Ai �" �7����B���f��?������ si H�Ņ��( H�������E �������L# ��<E�1�����������D �?�����H��H���E H�������A�ċi ���� A���* A�D$�A�����H�\f��E ��L# <��AD�1�H���s���H9�u���������<E�H���L# 1�[]A\A]�H���� �?����H�ŋ�h ��u����� H�[]A\A]�D H���L# 1�� �������# H���L# 1�������7��� H���L# 1����������� H�1���L# ��������� H�1���L# ���������� H���L# 1����������� E1������E��D u
| ^
In file included from /data/stars/user/uujjwal/collection-stars/gcc-9.2/include/c++/9.2.0/iomanip:43,
from /tmp/llvm/llvm/utils/PerfectShuffle/PerfectShuffle.cpp:19:
/usr/bin/locale:16:279: error: expected declaration before ‘}’ token
16 | �� I�WH����u fD H��H����� �DV t�� �SH��H�0�f� H���H���DF u���tr�CH�K��u�-# H�����tH���DV t�<
| ^
/usr/bin/locale:16:282: error: ‘H’ does not name a type
16 | �� I�WH����u fD H��H����� �DV t�� �SH��H�0�f� H���H���DF u���tr�CH�K��u�-# H�����tH���DV t�<
| ^
/usr/bin/locale:16:316: error: expected declaration before ‘}’ token
16 | �� I�WH����u fD H��H����� �DV t�� �SH��H�0�f� H���H���DF u���tr�CH�K��u�-# H�����tH���DV t�<
| ^
/usr/bin/locale:16:319: error: ‘u4’ does not name a type
16 | �� I�WH����u fD H��H����� �DV t�� �SH��H�0�f� H���H���DF u���tr�CH�K��u�-# H�����tH���DV t�<
| ^
/usr/bin/locale:16:355: error: ‘H’ does not name a type
16 | �� I�WH����u fD H��H����� �DV t�� �SH��H�0�f� H���H���DF u���tr�CH�K��u�-# H�����tH���DV t�<
| ^
/usr/bin/locale:16:398: error: ‘M’ does not name a type
16 | �� I�WH����u fD H��H����� �DV t�� �SH��H�0�f� H���H���DF u���tr�CH�K��u�-# H�����tH���DV t�<
| ^
/usr/bin/locale:16:412: error: ‘u’ does not name a type
16 | �� I�WH����u fD H��H����� �DV t�� �SH��H�0�f� H���H���DF u���tr�CH�K��u�-# H�����tH���DV t�<
| ^
/usr/bin/locale:19:70: error: expected declaration before ‘}’ token
19 | H�������H��t�A�$�����L������L������� ƅ����
| ^
/usr/bin/locale:19:74: error: expected unqualified-id before numeric constant
19 | H�������H��t�A�$�����L������L������� ƅ����
| ^
make[2]: *** [utils/PerfectShuffle/CMakeFiles/llvm-PerfectShuffle.dir/build.make:63: utils/PerfectShuffle/CMakeFiles/llvm-PerfectShuffle.dir/PerfectShuffle.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:20749: utils/PerfectShuffle/CMakeFiles/llvm-PerfectShuffle.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
The output of locale is as below :
(base) -bash-4.2$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
I am unable to understand exactly, why I am getting this sort of error. I have searched hard but cannot find absolutely anything on it. To the best of my knowledge, this kind of problem comes owing to gibberish symbols in a code. Considering that it is a stable release of LLVM, I hope that is not the case. Could someone help ?
I had the exact same error.
Turns out an export typo in my ~/.zshrc was the cause
export CPATH=<some_stuff>:$PATH // <---- TYPO
Make sure you include the right locale file which is a C source located in /usr/inlcude/c++/7, in your case, you may wrongly include the locale executable.

MacOS 10.12.6 Installing Perl Module WWW:Curl::Easy error in Availability.h

Check the errors,
I didn't install/reinstall the curl, It is installed by default on my OS
cpan WWW::Curl::Easy
Locating required external dependency bin:curl-config... found at /usr/bin/curl-config.
The version is libcurl 7.54.0
Found curl.h in /usr/include/curl/curl.h
In file included from /usr/include/curl/curl.h:38:
In file included from /usr/include/curl/curlbuild.h:145:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/inttypes.h:30:
In file included from /usr/include/inttypes.h:224:
In file included from /usr/include/Availability.h:190:
/usr/include/AvailabilityInternal.h:22938:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_12
^
/usr/include/AvailabilityInternal.h:22867:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11_4
^
/usr/include/AvailabilityInternal.h:22800:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11_3
^
/usr/include/AvailabilityInternal.h:22737:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11_2
^
/usr/include/AvailabilityInternal.h:22678:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11
^
/usr/include/AvailabilityInternal.h:22623:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10_3
^
/usr/include/AvailabilityInternal.h:22572:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10_2
^
/usr/include/AvailabilityInternal.h:22525:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10
^
/usr/include/AvailabilityInternal.h:22482:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_9
^
/usr/include/AvailabilityInternal.h:22443:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8
^
/usr/include/AvailabilityInternal.h:22408:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_7
^
/usr/include/AvailabilityInternal.h:22377:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_6
^
/usr/include/AvailabilityInternal.h:22350:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_5
^
/usr/include/AvailabilityInternal.h:22327:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_4
^
/usr/include/AvailabilityInternal.h:22308:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_3
^
/usr/include/AvailabilityInternal.h:22293:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_2
^
/usr/include/AvailabilityInternal.h:22282:10: error: unterminated conditional directive
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_1
^
/usr/include/AvailabilityInternal.h:30:2: error: unterminated conditional directive
#ifndef __AVAILABILITY_INTERNAL__
^
In file included from /usr/include/curl/curl.h:38:
In file included from /usr/include/curl/curlbuild.h:145:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/inttypes.h:30:
In file included from /usr/include/inttypes.h:224:
/usr/include/Availability.h:239:2: error: #else without #if
#else
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Building curlopt-constants.c for your libcurl version
Building Easy.pm constants for your libcurl version
Building Share.pm constants for your libcurl version
Checking if your kit is complete...
Looks good
Writing Makefile for WWW::Curl
Writing MYMETA.yml and MYMETA.json
cp lib/WWW/Curl/Easy.pm blib/lib/WWW/Curl/Easy.pm
cp lib/WWW/Curl.pm blib/lib/WWW/Curl.pm
cp lib/WWW/Curl/Form.pm blib/lib/WWW/Curl/Form.pm
cp lib/WWW/Curl/Share.pm blib/lib/WWW/Curl/Share.pm
cp lib/WWW/Curl/Multi.pm blib/lib/WWW/Curl/Multi.pm
/usr/bin/perl "-Iinc" /System/Library/Perl/5.18/ExtUtils/xsubpp -typemap /System/Library/Perl/5.18/ExtUtils/typemap -typemap typemap Curl.xs > Curl.xsc && mv Curl.xsc Curl.c
cc -c -I/usr/include -arch x86_64 -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os -DVERSION=\"4.17\" -DXS_VERSION=\"4.17\" "-I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" Curl.c
In file included from Curl.xs:574:
./curlopt-constants.c:19:58: error: non-void function 'constant' should return a value [-Wreturn-type]
if (strEQ(name, "DID_MEMORY_FUNC_TYPEDEFS")) return CURL_DID_MEMORY_FUNC_TYPEDEFS;
^
./curlopt-constants.c:128:49: error: use of undeclared identifier 'CURL_STRICTER'
if (strEQ(name, "STRICTER")) return CURL_STRICTER;
^
./curlopt-constants.c:2051:44: warning: implicit conversion from 'unsigned long' to 'int' changes value from 18446744073709551599 to -17 [-Wconstant-conversion]
if (strEQ(name, "ANY")) return CURLAUTH_ANY;
~~~~~~ ^~~~~~~~~~~~
/usr/include/curl/curl.h:679:32: note: expanded from macro 'CURLAUTH_ANY'
#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE)
^~~~~~~~~~~~~~~~~~~
In file included from Curl.xs:574:
./curlopt-constants.c:2052:48: warning: implicit conversion from 'unsigned long' to 'int' changes value from 18446744073709551598 to -18 [-Wconstant-conversion]
if (strEQ(name, "ANYSAFE")) return CURLAUTH_ANYSAFE;
~~~~~~ ^~~~~~~~~~~~~~~~
/usr/include/curl/curl.h:680:32: note: expanded from macro 'CURLAUTH_ANYSAFE'
#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings and 2 errors generated.
make: *** [Curl.o] Error 1
SZBALINT/WWW-Curl-4.17.tar.gz
/usr/bin/make -- NOT OK
'YAML' not installed, will not store persistent state
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Tried using cpan install but always receive that error
I need help on what should I do, I don't have background in perl, I just need to run the regression and that module is required.
This is my first time to install a perl module because it is required in my regression file.
So it is not a very easy. But you can build it with some modification. I would also recommend installing a brewed perl instead of using the system perl
$ brew install perl
# Update the CPAN to latest
$ perl -MCPAN -e 'install Bundle::CPAN'
# Install Installer paackage
$ perl -MCPAN -e 'install Module::Install'
Now download the source code from below url
https://cpan.metacpan.org/authors/id/S/SZ/SZBALINT/WWW-Curl-4.17.tar.gz
Extract and it make two changes
Curl.c
#include "curlopt-constants.c"
to
#undef CURL_DID_MEMORY_FUNC_TYPEDEFS
#define CURL_DID_MEMORY_FUNC_TYPEDEFS 0
#include "curlopt-constants.c"
And then in Makefile.PL change
if($e =~ /(OBSOLETE|^CURL_EXTERN|_LAST\z|_LASTENTRY\z)/) {
to
if($e =~ /(OBSOLETE|^CURL_EXTERN|^CURL_STRICTER\z|_LAST\z|_LASTENTRY\z)/) {
And then run the make command in the downloaded folder
References
Failed to install WWW::Curl::Easy: SZBALINT/WWW-Curl-4.17.tar.gz : make NO
https://www.perlmonks.org/?node_id=1208670
https://www.perlmonks.org/?node_id=1208666
The following worked for me (perl 5, version 28, subversion 0 (v5.28.0) built for darwin-thread-multi-2level, XCode 9.4.1):
wget https://www.cpan.org/modules/by-module/WWW/WWW-Curl-4.17.tar.gz
tar zxvf WWW-Curl-4.17.tar.gz
cd WWW-Curl-4.17
cpan Module::Install
git apply cpp.patch
git apply stretch.patch
perl Makefile.PL
make
make install
cpp.patch (see: this SO answer):
diff --git a/Makefile.PL b/Makefile.PL
index f9170bb..124e5fd 100644
--- a/Makefile.PL
+++ b/Makefile.PL
## -100,7 +100,7 ## if (!defined($curl_h)) {
print "Found curl.h in $curl_h\n";
my #syms;
my $has_cpp = 0;
- open(H_IN, "-|", "cpp", $curl_h) and $has_cpp++;
+ open(H_IN, "-|", "cc -E", $curl_h) and $has_cpp++;
unless ($has_cpp) {
warn "No working cpp ($!). Parsing curl.h in Perl";
open(H_IN, "<", $curl_h) or die("Can't open curl.h at path $curl_h, because: ".$!);
stretch.patch (see this ticket):
From 292c05a8aa9c18bd27d0aaff0b4ee601d9b87b92 Mon Sep 17 00:00:00 2001
From: Slaven Rezic <cpansand#cvrsnica-freebsd-101.herceg.de>
Date: Sun, 16 Apr 2017 22:17:00 +0200
Subject: [PATCH] compilation fixes for curl 7.50.2 and newer (RT #117793)
---
Makefile.PL | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.PL b/Makefile.PL
index f9170bb..bb852e4 100644
--- a/Makefile.PL
+++ b/Makefile.PL
## -127,7 +127,7 ## if (!defined($curl_h)) {
close H;
for my $e (sort #syms) {
- if($e =~ /(OBSOLETE|^CURL_EXTERN|_LAST\z|_LASTENTRY\z)/) {
+ if($e =~ /(OBSOLETE|^CURL_EXTERN|^CURL_STRICTER\z|^CURL_DID_MEMORY_FUNC_TYPEDEFS\z|_LAST\z|_LASTENTRY\z)/) {
next;
}
my ($group) = $e =~ m/^([^_]+_)/;
--
2.1.2

MAC OSX10.11.4 python3 import theano error

I upgraded my Mac to a OSX 10.11.4, and sadly I found my theano cannot be imported anymore.
Here is information about my machine:
➜ ~ gcc --version
Configured with: -prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
InstalledDir:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
The logs are list below and I hope somebody can help me out. The output is very long and I just listed part of it here. The full version can be found here.
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015, 21:12:44)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import theano
00001 #include <Python.h>
00002 #include "theano_mod_helper.h"
00003 #include "structmember.h"
00004 #include <sys/time.h>
00005
00006 #if PY_VERSION_HEX >= 0x03000000
00007 #include "numpy/npy_3kcompat.h"
00008 #define PyCObject_AsVoidPtr NpyCapsule_AsVoidPtr
00009 #define PyCObject_GetDesc NpyCapsule_GetDesc
00010 #define PyCObject_Check NpyCapsule_Check
00011 #endif
00012
00013 #ifndef Py_TYPE
00014 #define Py_TYPE(obj) obj->ob_type
00015 #endif
00016
00017 /**
00018
00019 TODO:
00020 - Check max supported depth of recursion
00021 - CLazyLinker should add context information to errors caught during evaluation. Say what node we were on, add the traceback attached to the node.
00022 - Clear containers of fully-useed intermediate results if allow_gc is 1
00023 - Add timers for profiling
00024 - Add support for profiling space used.
00025
00026
00027 */
00028 static double pytime(const struct timeval * tv)
00029 {
00030 struct timeval t;
00031 if (!tv)
00032 {
00033 tv = &t;
00034 gettimeofday(&t, NULL);
00035 }
00036 return (double) tv->tv_sec + (double) tv->tv_usec / 1000000.0;
00037 }
00038
00039 /**
00040 Helper routine to convert a PyList of integers to a c array of integers.
00041 */
00042 static int unpack_list_of_ssize_t(PyObject * pylist, Py_ssize_t **dst, Py_ssize_t *len,
00043 const char* kwname)
00044 {
00045 Py_ssize_t buflen, *buf;
00046 if (!PyList_Check(pylist))
00047 {
00048 PyErr_Format(PyExc_TypeError, "%s must be list", kwname);
00049 return -1;
00050 }
00051 assert (NULL == *dst);
00052 *len = buflen = PyList_Size(pylist);
00053 *dst = buf = (Py_ssize_t*)calloc(buflen, sizeof(Py_ssize_t));
00054 assert(buf);
00055 for (int ii = 0; ii < buflen; ++ii)
00056 {
00057 PyObject * el_i = PyList_GetItem(pylist, ii);
00058 Py_ssize_t n_i = PyNumber_AsSsize_t(el_i, PyExc_IndexError);
00059 if (PyErr_Occurred())
00060 {
00061 free(buf);
00062 *dst = NULL;
00063 return -1;
00064 }
00065 buf[ii] = n_i;
00066 }
00067 return 0;
00068 }
00069
00070 /**
00071
00072 CLazyLinker
00075 */
00076 typedef struct {
00077 PyObject_HEAD
00078 /* Type-specific fields go here. */
00079 PyObject * nodes; // the python list of nodes
00080 PyObject * thunks; // python list of thunks
00081 PyObject * pre_call_clear; //list of cells to clear on call.
00082 int allow_gc;
00083 Py_ssize_t n_applies;
00084 int n_vars; // number of variables in the graph
00085 int * var_computed; // 1 or 0 for every variable
00086 PyObject ** var_computed_cells;
00087 PyObject ** var_value_cells;
00088 Py_ssize_t **dependencies; // list of vars dependencies for GC
00089 Py_ssize_t *n_dependencies;
00090
00091 Py_ssize_t n_output_vars;
00092 Py_ssize_t * output_vars; // variables that *must* be evaluated by call
00093
00094 int * is_lazy; // 1 or 0 for every thunk
00095
00096 Py_ssize_t * var_owner; // nodes[[var_owner[var_idx]]] is var[var_idx]->owner
00097 int * var_has_owner; // 1 or 0
00098
00099 Py_ssize_t * node_n_inputs;
00100 Py_ssize_t * node_n_outputs;
00101 Py_ssize_t ** node_inputs;
00102 Py_ssize_t ** node_outputs;
00103 Py_ssize_t * node_inputs_outputs_base; // node_inputs and node_outputs point into this
00104 Py_ssize_t * node_n_prereqs;
00105 Py_ssize_t ** node_prereqs;
00106
00107 Py_ssize_t * update_storage; // input cells to update with the last outputs in output_vars
00108 Py_ssize_t n_updates;
00109
00110 void ** thunk_cptr_fn;
00111 void ** thunk_cptr_data;
00112 PyObject * call_times;
00113 PyObject * call_counts;
00114 int do_timing;
00115 int need_update_inputs;
00116 int position_of_error; // -1 for no error, otw the index into `thunks` that failed.
00117 } CLazyLinker;
...............
= ==============================
Problem occurred during compilation with the command line below:
/usr/bin/clang++ -dynamiclib -g -march=haswell -target-feature -sse4a -target-feature -avx512bw -target-feature +cx16 -target-feature -tbm -target-feature +xsave -target-feature -fma4 -target-feature -avx512vl -target-feature -prfchw -target-feature +bmi2 -target-feature -adx -target-feature -xsavec -target-feature +fsgsbase -target-feature +avx -target-feature -avx512cd -target-feature -avx512pf -target-feature -rtm -target-feature +popcnt -target-feature +fma -target-feature +bmi -target-feature +aes -target-feature +rdrnd -target-feature -xsaves -target-feature +sse4.1 -target-feature +sse4.2 -target-feature +avx2 -target-feature -avx512er -target-feature +sse -target-feature +lzcnt -target-feature +pclmul -target-feature -avx512f -target-feature +f16c -target-feature +ssse3 -target-feature +mmx -target-feature +cmov -target-feature -xop -target-feature -rdseed -target-feature +movbe -target-feature -hle -target-feature +xsaveopt -target-feature -sha -target-feature +sse2 -target-feature +sse3 -target-feature -avx512dq -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/theano/gof -fvisibility=hidden -o /Users/liuwei/.theano/compiledir_Darwin-15.4.0-x86_64-i386-64bit-i386-3.5.1-64/lazylinker_ext/lazylinker_ext.so /Users/liuwei/.theano/compiledir_Darwin-15.4.0-x86_64-i386-64bit-i386-3.5.1-64/lazylinker_ext/mod.cpp -L/Library/Frameworks/Python.framework/Versions/3.5/lib
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-sse4a'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-tbm'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-fma4'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-prfchw'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-rtm'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-rdseed'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-hle'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-sha'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: unknown argument: '-target-feature'
clang: error: no such file or directory: '+cx16'
clang: error: no such file or directory: '+xsave'
clang: error: no such file or directory: '+bmi2'
clang: error: language not recognized: 'savec'
clang: error: no such file or directory: '+fsgsbase'
clang: error: no such file or directory: '+avx'
clang: error: no such file or directory: '+popcnt'
clang: error: no such file or directory: '+fma'
clang: error: no such file or directory: '+bmi'
clang: error: no such file or directory: '+aes'
clang: error: no such file or directory: '+rdrnd'
clang: error: language not recognized: 'saves'
clang: error: no such file or directory: '+sse4.1'
clang: error: no such file or directory: '+sse4.2'
clang: error: no such file or directory: '+avx2'
clang: error: no such file or directory: '+sse'
clang: error: no such file or directory: '+lzcnt'
clang: error: no such file or directory: '+pclmul'
clang: error: no such file or directory: '+f16c'
clang: error: no such file or directory: '+ssse3'
clang: error: no such file or directory: '+mmx'
clang: error: no such file or directory: '+cmov'
clang: error: language not recognized: 'op'
clang: error: no such file or directory: '+movbe'
clang: error: no such file or directory: '+xsaveopt'
clang: error: no such file or directory: '+sse2'
clang: error: no such file or directory: '+sse3'
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/theano/gof/lazylinker_c.py", line 74, in <module>
raise ImportError()
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/theano/gof/lazylinker_c.py", line 91, in <module>
raise ImportError()
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/theano/__init__.py", line 63, in <module>
from theano.compile import (
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/theano/compile/__init__.py", line 9, in <module>
from theano.compile.function_module import *
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/theano/compile/function_module.py", line 22, in <module>
import theano.compile.mode
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/theano/compile/mode.py", line 12, in <module>
import theano.gof.vm
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/theano/gof/vm.py", line 638, in <module>
from . import lazylinker_c
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/theano/gof/lazylinker_c.py", line 126, in <module>
preargs=args)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/theano/gof/cmodule.py", line 2196, in compile_str
(status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1):
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-sse4a'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-tbm'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-fma4'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-prfchw'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-rtm'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-rdseed'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-hle'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-sha'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: unknown argument: '-target-feature'.
clang: error: no such file or directory: '+cx16'.
clang: error: no such file or directory: '+xsave'.
clang: error: no such file or directory: '+bmi2'.
clang: error: language not recognized: 'savec'.
clang: error: no such file or directory: '+fsgsbase'.
clang: error: no such file or directory: '+avx'.
clang: error: no such file or directory: '+popcnt'.
clang: error: no such file or directory: '+fma'.
clang: error: no such file or directory: '+bmi'.
clang: error: no such file or directory: '+aes'.
clang: error: no such file or directory: '+rdrnd'.
clang: error: language not recognized: 'saves'.
clang: error: no such file or directory: '+sse4.1'.
clang: error: no such file or directory: '+sse4.2'.
clang: error: no such file or directory: '+avx2'.
clang: error: no such file or directory: '+sse'.
clang: error: no such file or directory: '+lzcnt'.
clang: error: no such file or directory: '+pclmul'.
clang: error: no such file or directory: '+f16c'.
clang: error: no such file or directory: '+ssse3'.
clang: error: no such file or directory: '+mmx'.
clang: error: no such file or directory: '+cmov'.
clang: error: language not recognized: 'op'.
clang: error: no such file or directory: '+movbe'.
clang: error: no such file or directory: '+xsaveopt'.
clang: error: no such file or directory: '+sse2'.
clang: error: no such file or directory: '+sse3'.
The problem comes from an interface change in Xcode 7.3. It is fixed in the current master of Theano and there will be release 0.8.1 next Tuesday (2016/03/29) that will be 0.8.0 + the fix.
In the meantime you can either run the master: http://deeplearning.net/software/theano/install.html#bleeding-edge-install-instructions or install version 7.2 of the command line tools and select those with xcode-select to make Theano work.
A new Numpy release (1.11.0) came out yesterday, 3/27/16. Installed it and finally everything on my MacBook OS-X Canopy Python started working correctly. Installed scikit-neuralnetwork, which installs Theano, Numpy, and others. Whew...

error: expected ‘,’ or ‘;’ before ‘__attribute_alloc_size__’

I am using a x64 cpu and trying to build a cross compiler, when making this command below some error comes:
export PATH=/home/me/lab1/crossgcc2/bin:$PATH
/home/me/lab1/gcc-5.1.0/configure \
--prefix=/home/me/lab1/crossgcc2 \
--target=arm-unknown-linux-gnueabihf \
--enable-languages=c \
--with-sysroot=/home/eric/lab1/sysroot \
--with-tune=cortex-a9 --with-float=hard
make
error message:
In file included from /home/fly/lab1/gcc-5.1.0/libgcc/../gcc/tsystem.h:101:0,
from /home/fly/lab1/gcc-5.1.0/libgcc/libgcc2.c:27:
/home/fly/lab1/sysroot/usr/include/stdlib.h:510:35: error: expected ‘,’ or ‘;’ before ‘__attribute_alloc_size__’
__THROW __attribute_malloc__ __attribute_alloc_size__ ((2)) __wur;
^
In file included from /home/fly/lab1/gcc-5.1.0/libgcc/../gcc/tsystem.h:108:0,
from /home/fly/lab1/gcc-5.1.0/libgcc/libgcc2.c:27:
/home/fly/lab1/sysroot/usr/include/time.h:123:5: error: unknown type name ‘__syscall_slong_t’
__syscall_slong_t tv_nsec; /* Nanoseconds. */
can anybody tell me what's wrong please? Thanks

Resources