I'm trying to install pypcap from: https://github.com/dugsong/pypcap/blob/master/INSTALL#L75
I'm trying to install it on Windows 10 - 64 bit and python 2.7.11 64 bit. I downloaded the source and moved it to c:\pypcap. downloaded pyrex and installed it as well. It put the wpdpack files in c:\wpdpack like the install page says. Created the config file and changed the makefile.
I also installed the mingw from their website with the basic package and the g++ package.
I try to do:
C:\pypcap> set PATH=%PATH%;c:\MinGW\bin;c:\Python27
C:\pypcap> mingw32-make
and here it fails, it gets the following error:
In file included from C:\Python27\include/Python.h:8:0,
from pcap.c:4:
C:\Python27\include/pyconfig.h:68:16: fatal error: io.h: No such file or directory
#include <io.h>
so I don't got this io.h file. What can I do to make it compile and use the pypcap?
Before trying that I tried to do
C:\pypcap>pip install pypcap
Collecting pypcap
Using cached pypcap-1.1.4.tar.gz
Complete output from command python setup.py egg_info:
pcap.h not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\USER\appdata\local\temp\pip-build-fvgkhs\pypcap\
and after that I tried using the wheel download but it failed as well.
Thanks in advance for your help
Unzip the WinPcap Developer pack so that you have C:\WpdPack\Include and C:\WpdPack\Lib
Unzip the pypcap source so that you have C:\pypcap-1.1.4\setup.py
Install the Microsoft Visual C++ Compiler for Python 2.7
Start the relevant cmd prompt for your Python27 bitness from:
Start -> Programs -> Microsoft Visual C++ Compiler Package for Python 2.7
Install/build pypcap from that cmd prompt with:
set INCLUDE=%INCLUDE%;c:\WpdPack\Include
set LIB=%LIB%;c:\WpdPack\Lib
pushd C:\pypcap-1.1.4
python setup.py install
Changed answer
Download https://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download.
Run it.
Select:
mingw32-base
mingw32-gcc-g++
Select menu Installtion => Apply Changes
Now you have a fully functional MinGW GCC compiler including header files.
io.h should reside in C:\MinGW\include.
UPDATE
I have successfully compiled it now using Python 2.7.11 (under Wine, since I don't run Windows, but it should be the same) by following the procedure you described in your question.
One thing I had to do was to modify parts of setup.py in pypcap, because it didn't set the proper paths to the pcap includes.
Let me know if/when you get there.
Hope it helps.
CHANGES TO setup.py
Replace the function _pcap_config with this modified version:
def _pcap_config(self, dirs=[ None ]):
cfg = {}
if not dirs[0]:
dirs = [ '/usr', sys.prefix ] + glob.glob('/opt/libpcap*') + \
glob.glob('../libpcap*') + glob.glob('../wpdpack*')
for d in dirs:
for sd in ('include/pcap', 'include', ''):
if os.path.exists(os.path.join(d, sd, 'pcap.h')):
cfg.setdefault('include_dirs', []).append(os.path.join(d, sd))
for d in dirs:
for sd in ('include/pcap', 'include', ''):
for sd in ('lib', 'lib64', ''):
for lib in (('pcap', 'libpcap.a'),
('pcap', 'libpcap.so'),
('pcap', 'libpcap.dylib'),
('wpcap', 'wpcap.lib')):
if os.path.exists(os.path.join(d, sd, lib[1])):
cfg['library_dirs'] = [ os.path.join(d, sd) ]
cfg['libraries'] = [ lib[0] ]
if lib[0] == 'wpcap':
cfg['libraries'].append('iphlpapi')
cfg['extra_compile_args'] = \
[ '-DWIN32', '-DWPCAP' ]
print 'found', cfg
self._write_config_h(cfg)
return cfg
raise Exception("couldn't find pcap build or installation directory")
It basically just adds ALL paths containing pcap.h to the includes.
COMPILATION
Z:\pypcap-master>mingw32-make
python setup.py config --with-pcap=c:\\wpdpack
running config
found {'libraries': ['wpcap', 'iphlpapi'], 'library_dirs': ['c:\\wpdpack\\lib'], 'extra_compile_args': ['-DWIN32', '-DWPCAP'], 'include_dirs': ['c:\\wpdpack\\include/pcap', 'c:\\wpdpack\\include']}
python setup.py build
running build
running build_ext
building 'pcap' extension
creating build
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
C:\MinGW\bin\gcc.exe -mdll -O -Wall -Ic:\wpdpack\include/pcap -Ic:\wpdpack\include -IC:\Python27\include -IC:\Python27\PC -c pcap.c -o build\temp.win32-2.7\Release\pcap.o -DWIN32 -DWPCAP
pcap.c: In function '__pyx_f_4pcap_3bpf_filter':
pcap.c:328:48: warning: passing argument 2 of 'PyObject_AsCharBuffer' from incompatible pointer type
__pyx_1 = (PyObject_AsCharBuffer(__pyx_v_buf,(&__pyx_v_p),(&__pyx_v_n)) < 0);
^
In file included from C:\Python27\include/Python.h:133:0,
from pcap.c:4:
C:\Python27\include/abstract.h:476:22: note: expected 'const char **' but argument is of type 'char **'
PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj,
^
pcap.c:337:86: warning: pointer targets in passing argument 2 of 'bpf_filter' differ in signedness [-Wpointer-sign]
__pyx_1 = (bpf_filter(((struct __pyx_obj_4pcap_bpf *)__pyx_v_self)->fcode.bf_insns,__pyx_v_p,__pyx_v_n,__pyx_v_n) == 0);
^
In file included from pcap.c:30:0:
c:\wpdpack\include/pcap/pcap.h:354:7: note: expected 'const u_char *' but argument is of type 'char *'
u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
^
pcap.c: In function '__pyx_f_4pcap_4pcap_dispatch':
pcap.c:955:91: warning: passing argument 3 of 'pcap_dispatch' from incompatible pointer type
__pyx_v_n = pcap_dispatch(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap,__pyx_1,__pyx_f_4pcap___pcap_handler,((unsigned char *)(&__pyx_v_ctx)));
^
In file included from pcap.c:30:0:
c:\wpdpack\include/pcap/pcap.h:300:5: note: expected 'pcap_handler' but argument is of type 'void (*)(void *, struct pcap_pkthdr *, char *)'
int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *);
^
pcap.c: In function '__pyx_f_4pcap_4pcap_loop':
pcap.c:1059:99: warning: passing argument 3 of 'pcap_ex_next' from incompatible pointer type
__pyx_v_n = pcap_ex_next(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap,(&__pyx_v_hdr),(&__pyx_v_pkt));
^
In file included from pcap.c:31:0:
pcap_ex.h:13:7: note: expected 'u_char **' but argument is of type 'char **'
int pcap_ex_next(pcap_t *pcap, struct pcap_pkthdr **hdr, u_char **pkt);
^
pcap.c: In function '__pyx_f_4pcap_4pcap_sendpacket':
pcap.c:1154:98: warning: pointer targets in passing argument 2 of 'pcap_sendpacket' differ in signedness [-Wpointer-sign]
__pyx_3 = PyInt_FromLong(pcap_sendpacket(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap,__pyx_1,__pyx_2)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}
^
In file included from pcap.c:30:0:
c:\wpdpack\include/pcap/pcap.h:311:5: note: expected 'const u_char *' but argument is of type 'char *'
int pcap_sendpacket(pcap_t *, const u_char *, int);
^
pcap.c: In function '__pyx_f_4pcap_4pcap___next__':
pcap.c:1312:99: warning: passing argument 3 of 'pcap_ex_next' from incompatible pointer type
__pyx_v_n = pcap_ex_next(((struct __pyx_obj_4pcap_pcap *)__pyx_v_self)->__pcap,(&__pyx_v_hdr),(&__pyx_v_pkt));
^
In file included from pcap.c:31:0:
pcap_ex.h:13:7: note: expected 'u_char **' but argument is of type 'char **'
int pcap_ex_next(pcap_t *pcap, struct pcap_pkthdr **hdr, u_char **pkt);
^
C:\MinGW\bin\gcc.exe -mdll -O -Wall -Ic:\wpdpack\include/pcap -Ic:\wpdpack\include -IC:\Python27\include -IC:\Python27\PC -c pcap_ex.c -o build\temp.win32-2.7\Release\pcap_ex.o -DWIN32 -DWPCAP
pcap_ex.c: In function 'pcap_ex_next':
pcap_ex.c:237:34: warning: passing argument 3 of 'pcap_next_ex' from incompatible pointer type
return (pcap_next_ex(pcap, hdr, pkt));
^
In file included from pcap_ex.c:16:0:
c:\wpdpack\include/pcap/pcap.h:303:6: note: expected 'const u_char **' but argument is of type 'u_char **'
int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **);
^
writing build\temp.win32-2.7\Release\pcap.def
creating build\lib.win32-2.7
C:\MinGW\bin\gcc.exe -shared -s build\temp.win32-2.7\Release\pcap.o build\temp.win32-2.7\Release\pcap_ex.o build\temp.win32-2.7\Release\pcap.def -Lc:\wpdpack\lib -LC:\Python27\libs -LC:\Python27\PCbuild -LC:\Python27\PC\VS9.0 -lwpcap -liphlpapi -lpython27 -lmsvcr90 -o build\lib.win32-2.7\pcap.pyd
Z:\pypcap-master>
LINKING
With MinGW (32-bit) you need a 32-bit Python installation. With a 64-bit Python you need to install MinGW (64-bit).
So you can either install a 32-bit Python or install a 64-bit MinGW.
We are close now, you will make it :-)
Related
The cython "Hello World" example from http://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html
is not running on my windows system, while the compiler works
Any hints are appreciated, I try to work this out for days...
Here in more detail:
GCC seems to work on windows; because compiling this C example worked:
#include <stdio.h>
int main (){
printf("Hello world");
return 0;
}
Now back to the Cython example:
it worked on Ubuntu, but throws the folowing error in windows:
Compiling helloworld.pyx because it changed.
[1/1] Cythonizing helloworld.pyx
running build_ext
building 'helloworld' extension
creating build
creating build\temp.win32-3.6
creating build\temp.win32-3.6\Release
C:\MinGW\bin\gcc.exe -mdll -O -Wall -DMS_WIN32 -IC:\Users\Tom\Anaconda3\include
-IC:\Users\Tom\Anaconda3\include -c helloworld.c -o build\temp.win32-3.6\Release
\helloworld.o
In file included from C:\Users\Tom\Anaconda3\include/Python.h:8:0,
from helloworld.c:16:
C:\Users\Tom\Anaconda3\include/pyconfig.h:68:0: Warnung: »MS_WIN32« redefiniert
#define MS_WIN32 /* only support win32 and greater. */
<Kommandozeile>:0:0: Anmerkung: dies ist die Stelle der vorherigen Definition
In file included from C:\Users\Tom\Anaconda3\include/Python.h:65:0,
from helloworld.c:16:
C:\Users\Tom\Anaconda3\include/pytime.h:111:12: Warnung: »struct timeval« declar
ed inside parameter list will not be visible outside of this definition or decla
ration
struct timeval *tv,
^~~~~~~
C:\Users\Tom\Anaconda3\include/pytime.h:116:12: Warnung: »struct timeval« declar
ed inside parameter list will not be visible outside of this definition or decla
ration
struct timeval *tv,
^~~~~~~
writing build\temp.win32-3.6\Release\helloworld.cp36-win32.def
C:\MinGW\bin\gcc.exe -shared -s build\temp.win32-3.6\Release\helloworld.o build\
temp.win32-3.6\Release\helloworld.cp36-win32.def -LC:\Users\Tom\Anaconda3\libs -
LC:\Users\Tom\Anaconda3\PCbuild\win32 -lpython36 -lmsvcr140 -o "C:\Users\...\hw\helloworld.cp36-win32.pyd"
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot fin
d -lmsvcr140
collect2.exe: Fehler: ld gab 1 als Ende-Status zurück
error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
here the hello world code:
helloworld.pyx:
print("Hello World")
setup.py:
from distutils.core import setup
from Cython.Build import cythonize
setup(
ext_modules = cythonize("helloworld.pyx")
)
command:
python setup.py build_ext --inplace
I launched R in my command-line and typed the following:
install.packages("XML")
After selecting a mirror site, I saw the following output:
trying URL 'https://cloud.r-project.org/src/contrib/XML_3.98-1.4.tar.gz'
Content type 'application/x-gzip' length 1599214 bytes (1.5 MB)
==================================================
downloaded 1.5 MB
* installing *source* package ‘XML’ ...
** package ‘XML’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for sed... /usr/local/Library/ENV/4.3/sed
checking for pkg-config... /usr/local/bin/pkg-config
checking for xml2-config... /Users/richiethomas/anaconda/bin/xml2-config
USE_XML2 = yes
SED_EXTENDED_ARG: -E
Minor 9, Patch 2 for 2.9.2
Located parser file -I/Users/richiethomas/anaconda/include/libxml2/parser.h
Checking for 1.8: -I/Users/richiethomas/anaconda/include/libxml2
Using libxml2.*
checking for gzopen in -lz... yes
checking for xmlParseFile in -lxml2... yes
You are trying to use a version 2.* edition of libxml
but an incompatible library. The header files and library seem to be
mismatched. If you have specified LIBXML_INCDIR, make certain to also
specify an appropriate LIBXML_LIBDIR if the libxml2 library is not in the default
directories.
ERROR: configuration failed for package ‘XML’
* removing ‘/usr/local/lib/R/3.2/site-library/XML’
The downloaded source packages are in
‘/private/var/folders/jy/0cwn40p951xc7f1480z3sxzm0000gn/T/RtmpvWMrkH/downloaded_packages’
Warning message:
In install.packages("XML") :
installation of package ‘XML’ had non-zero exit status
I Googled around and found this link, which suggested running the 'which xmllint' command in the command line to find any XML installations which might conflict with the one R depends on. The output when I ran it was:
/Users/richiethomas/anaconda/bin/xmllint
Correct me if I'm wrong, but it appears that my Python installation has an XML dependency which conflicts with the one R wants to download. Is this right? And if so, how can I fix it so that both Python and R are installed on my machine?
EDIT: I am using OSX. I ran "brew install libxml2" but Homebrew said it was already installed.
EDIT #2: I tried un-installing and re-installing R via Homebrew, and I am still getting the same error.
EDIT #3: I ran "brew info libxml2" and saw that there is an "--with-python" flag which enables a build with Python support. I also noticed the following:
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/libxml2/lib
CPPFLAGS: -I/usr/local/opt/libxml2/include
I ran "brew uninstall libxml2" and then "brew install libxml2 --with-python", and then set the above 2 environment variables using the "export" command. Then I re-ran R and again tried to install the XML package. I saw dozens of warnings of the type "passing argument to parameter here" (see below), followed by a non-zero exit code:
* installing *source* package ‘XML’ ...
** package ‘XML’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for sed... /usr/local/Library/ENV/4.3/sed
checking for pkg-config... /usr/local/bin/pkg-config
checking for xml2-config... /Users/richiethomas/anaconda/bin/xml2-config
USE_XML2 = yes
SED_EXTENDED_ARG: -E
Minor 9, Patch 2 for 2.9.2
Located parser file -I/Users/richiethomas/anaconda/include/libxml2/parser.h
Checking for 1.8: -I/Users/richiethomas/anaconda/include/libxml2
Using libxml2.*
checking for gzopen in -lz... yes
checking for xmlParseFile in -lxml2... yes
checking for xmlHashSize in -lxml2... yes
Using built-in xmlHashSize
Checking DTD parsing (presence of externalSubset)...
checking for xmlHashSize in -lxml2... yes
Found xmlHashSize
checking for xmlOutputBufferCreateBuffer in -lxml2... yes
have xmlOutputBufferCreateBuffer()
checking for xmlDocDumpFormatMemoryEnc in -lxml2... yes
checking libxml/xmlversion.h usability... yes
checking libxml/xmlversion.h presence... yes
checking for libxml/xmlversion.h... yes
Expat: FALSE
Checking for return type of xmlHashScan element routine.
No return value for xmlHashScan
xmlNs has a context field
Checking for cetype_t enumeration
Using recent version of R with cetype_t enumeration type for encoding
checking for xmlsec1-config... no
nodegc default
xml-debug default
Version has XML_WITH_ZLIB
Version has xmlHasFeature()
****************************************
Configuration information:
Libxml settings
libxml include directory: -I/Users/richiethomas/anaconda/include/libxml2
libxml library directory: -L/Users/richiethomas/anaconda/lib -lxml2 -lz -liconv -lm -lz -lxml2
libxml 2: -DLIBXML2=1
Compilation flags: -DLIBXML -I/Users/richiethomas/anaconda/include/libxml2 -DUSE_EXTERNAL_SUBSET=1 -DROOT_HAS_DTD_NODE=1 -DDUMP_WITH_ENCODING=1 -DUSE_XML_VERSION_H=1 -DXML_ELEMENT_ETYPE=1 -DXML_ATTRIBUTE_ATYPE=1 -DNO_XML_HASH_SCANNER_RETURN=1 -DLIBXML_NAMESPACE_HAS_CONTEXT=1 -DHAVE_R_CETYPE_T=1 -DHAVE_XML_WITH_ZLIB=1 -DHAVE_XML_HAS_FEATURE=1 -DUSE_R=1 -D_R_=1 -DHAVE_VALIDITY=1 -DXML_REF_COUNT_NODES=1
Link flags: -L/Users/richiethomas/anaconda/lib -lxml2 -lz -liconv -lm -lz -lxml2
****************************************
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/supports.R
config.status: creating inst/scripts/RSXML.csh
config.status: creating inst/scripts/RSXML.bsh
** libs
clang -I/usr/local/Cellar/r/3.2.4_1/R.framework/Resources/include -DNDEBUG -DLIBXML -I/Users/richiethomas/anaconda/include/libxml2 -DUSE_EXTERNAL_SUBSET=1 -DROOT_HAS_DTD_NODE=1 -DDUMP_WITH_ENCODING=1 -DUSE_XML_VERSION_H=1 -DXML_ELEMENT_ETYPE=1 -DXML_ATTRIBUTE_ATYPE=1 -DNO_XML_HASH_SCANNER_RETURN=1 -DLIBXML_NAMESPACE_HAS_CONTEXT=1 -DHAVE_R_CETYPE_T=1 -DHAVE_XML_WITH_ZLIB=1 -DHAVE_XML_HAS_FEATURE=1 -DUSE_R=1 -D_R_=1 -DHAVE_VALIDITY=1 -DXML_REF_COUNT_NODES=1 -I. -DLIBXML2=1 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -fPIC -g -O2 -c DocParse.c -o DocParse.o
DocParse.c:375:60: warning: passing 'const char *' to parameter of type 'const xmlChar *' (aka 'const unsigned char *') converts between
pointers to integer types with different sign [-Wpointer-sign]
SET_STRING_ELT(VECTOR_ELT(rdoc, FILE_ELEMENT_NAME), 0, ENC_COPY_TO_USER_STRING(doc->name ? XMLCHAR_TO_CHAR(doc->name) : fileName));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Utils.h:235:74: note: expanded from macro 'ENC_COPY_TO_USER_STRING'
#define ENC_COPY_TO_USER_STRING(x) CreateCharSexpWithEncoding(encoding, CHAR_TO_XMLCHAR (x))
^~~~~~~~~~~~~~~~~~~
./Utils.h:12:31: note: expanded from macro 'CHAR_TO_XMLCHAR'
#define CHAR_TO_XMLCHAR(val) ((xmlChar *) val)
^~~~~~~~~~~~~~~~~
./Utils.h:220:73: note: passing argument to parameter 'str' here
SEXP CreateCharSexpWithEncoding(const xmlChar *encoding, const xmlChar *str);
.....
/usr/local/Cellar/r/3.2.4_1/R.framework/Resources/include/Rinternals.h:822:28: note: passing argument to parameter here
SEXP Rf_mkChar(const char *);
^
schema.c:122:25: warning: passing 'const char *' to parameter of type 'const xmlChar *' (aka 'const unsigned char *') converts between pointers
to integer types with different sign [-Wpointer-sign]
p = xmlHashLookup(t, CHAR_DEREF(STRING_ELT(name, 0)));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./RSCommon.h:140:27: note: expanded from macro 'CHAR_DEREF'
#define CHAR_DEREF(x) CHAR((x))
^~~~~~~~~
/usr/local/Cellar/r/3.2.4_1/R.framework/Resources/include/Rinternals.h:440:18: note: expanded from macro 'CHAR'
#define CHAR(x) R_CHAR(x)
^~~~~~~~~
/Users/richiethomas/anaconda/include/libxml2/libxml/hash.h:171:22: note: passing argument to parameter 'name' here
const xmlChar *name);
^
2 warnings generated.
clang -I/usr/local/Cellar/r/3.2.4_1/R.framework/Resources/include -DNDEBUG -DLIBXML -I/Users/richiethomas/anaconda/include/libxml2 -DUSE_EXTERNAL_SUBSET=1 -DROOT_HAS_DTD_NODE=1 -DDUMP_WITH_ENCODING=1 -DUSE_XML_VERSION_H=1 -DXML_ELEMENT_ETYPE=1 -DXML_ATTRIBUTE_ATYPE=1 -DNO_XML_HASH_SCANNER_RETURN=1 -DLIBXML_NAMESPACE_HAS_CONTEXT=1 -DHAVE_R_CETYPE_T=1 -DHAVE_XML_WITH_ZLIB=1 -DHAVE_XML_HAS_FEATURE=1 -DUSE_R=1 -D_R_=1 -DHAVE_VALIDITY=1 -DXML_REF_COUNT_NODES=1 -I. -DLIBXML2=1 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -fPIC -g -O2 -c xmlsecurity.c -o xmlsecurity.o
clang -I/usr/local/Cellar/r/3.2.4_1/R.framework/Resources/include -DNDEBUG -DLIBXML -I/Users/richiethomas/anaconda/include/libxml2 -DUSE_EXTERNAL_SUBSET=1 -DROOT_HAS_DTD_NODE=1 -DDUMP_WITH_ENCODING=1 -DUSE_XML_VERSION_H=1 -DXML_ELEMENT_ETYPE=1 -DXML_ATTRIBUTE_ATYPE=1 -DNO_XML_HASH_SCANNER_RETURN=1 -DLIBXML_NAMESPACE_HAS_CONTEXT=1 -DHAVE_R_CETYPE_T=1 -DHAVE_XML_WITH_ZLIB=1 -DHAVE_XML_HAS_FEATURE=1 -DUSE_R=1 -D_R_=1 -DHAVE_VALIDITY=1 -DXML_REF_COUNT_NODES=1 -I. -DLIBXML2=1 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -fPIC -g -O2 -c xpath.c -o xpath.o
xpath.c:36:41: warning: passing 'const xmlChar *' (aka 'const unsigned char *') to parameter of type 'const char *' converts between pointers
to integer types with different sign [-Wpointer-sign]
SET_NAMES(ref, ScalarString(mkCharCE(el->name, encoding)));
^~~~~~~~
/usr/local/Cellar/r/3.2.4_1/R.framework/Resources/include/Rdefines.h:135:54: note: expanded from macro 'SET_NAMES'
#define SET_NAMES(x, n) setAttrib(x, R_NamesSymbol, n)
^
/usr/local/Cellar/r/3.2.4_1/R.framework/Resources/include/Rinternals.h:889:30: note: passing argument to parameter here
SEXP Rf_mkCharCE(const char *, cetype_t);
^
1 warning generated.
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/3.2.4_1/R.framework/Resources/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -L/usr/local/lib -o XML.so DocParse.o EventParse.o ExpatParse.o HTMLParse.o NodeGC.o RSDTD.o RUtils.o Rcatalog.o Utils.o XMLEventParse.o XMLHashTree.o XMLTree.o fixNS.o libxmlFeatures.o schema.o xmlsecurity.o xpath.o -L/Users/richiethomas/anaconda/lib -lxml2 -lz -liconv -lm -lz -lxml2 -F/usr/local/Cellar/r/3.2.4_1/R.framework/.. -framework R -lintl -Wl,-framework -Wl,CoreFoundation
installing to /usr/local/lib/R/3.2/site-library/XML/libs
** R
** inst
** preparing package for lazy loading
Creating a generic function for ‘source’ from package ‘base’ in package ‘XML’
in method for ‘xmlAttrsToDataFrame’ with signature ‘"AsIs"’: no definition for class “AsIs”
in method for ‘readKeyValueDB’ with signature ‘"AsIs"’: no definition for class “AsIs”
in method for ‘readSolrDoc’ with signature ‘"AsIs"’: no definition for class “AsIs”
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error : .onLoad failed in loadNamespace() for 'XML', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/usr/local/lib/R/3.2/site-library/XML/libs/XML.so':
dlopen(/usr/local/lib/R/3.2/site-library/XML/libs/XML.so, 6): Library not loaded: libxml2.2.dylib
Referenced from: /usr/local/lib/R/3.2/site-library/XML/libs/XML.so
Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/3.2/site-library/XML’
The downloaded source packages are in
‘/private/var/folders/jy/0cwn40p951xc7f1480z3sxzm0000gn/T/RtmpEi0XEv/downloaded_packages’
Warning message:
In install.packages("XML") :
installation of package ‘XML’ had non-zero exit status
I solved this problem by using anaconda to install XML:
conda install -c r r-xml=3.98_1.5
Solution for Mac OS Catalina (i.e. in zsh).
I'm a novice, but this worked for me.
Make sure you have libxml2 installed in homebrew. (If you got it, brew list | grep libxml2 should confirm it; otherwise install it brew install libxml2. Don't have homebrew? Install it.)
Either create a zsh run com, touch ~/.zshrc, or find it in your home directory cd ~. (Use ls -a in Terminal to see if its in ~.)
Then make sure: export PATH="/usr/local/opt/libxml2/bin:$PATH" is in there (i.e. in ~/.zshrc). It shouldn't be in there yet! Add it using sudo nano ~/.zshrc. Then save it (ctrl + x, Y, enter). This should make sure the path to brew's libxml2 is the first thing that comes up when looking for libxml2. (FYI, I also added it to ~/.zprofile. I don't know which one is correct.)
Ok, now restart your terminal. Then run R in the Terminal using R. Once R has started, install.packages("XML"), pick a server to download it, and you should be good to go.
adding to #Travis's answer using conda install -c r r-xml=3.98_1.5 or conda install -c conda-forge r-xml works.
But make sure to run conda update r-essentials and reopen/restart the r terminal\notebook (whichever is your case).
You explained what is wrong and that helps.
XML package documentation in here: https://cran.r-project.org/web/packages/XML/index.html
Pay attetion to where it says You are trying to use a version 2.* edition of libxml
but an incompatible library.
What system are you using? I use OSX and when I had a similar issue I did run
brew install libxml2
and then it worked
I also see you use R 3.0+ and that should be very compatible.
I am having some problems building PyQt5 on Ubuntu 14.04. I am working with some code that has a hard dependency on Python 2.7; so, I am unable to use the python3 packages from Ubuntu's repository. Further searches of Ubuntu's packages reveal that there are dev and doc packages for Python 2 pyqt5. But, nothing to install the libraries necessary to write code.
This has led me to creating a custom build for PyQt5. I obtained the source for version 5.5 from here: https://www.riverbankcomputing.com/software/pyqt/download5 and I am using sip as provided by the Ubuntu repos (installation of kubuntu-desktop requires sip).
I read that its easy to have mismatched versions of sip so I did the following check:
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sip
>>> print(sip, sip.SIP_VERSION_STR)
(<module 'sip' from '/usr/lib/python2.7/dist-packages/sip.so'>, '4.16.9')
And:
$ sip -V
4.16.9
Also I am using the Qt5 tools provided by the Ubuntu repos. This included installing qtdeclarative5-* (probably overkill) and qt5-default. Here is some information about qmake:
qmake --version
QMake version 3.0
Using Qt version 5.2.1 in /usr/lib/x86_64-linux-gnu
I currently have PyQt4 installed and read on the installation notes that this would be fine as long as they were both compiled against the same version of sip.
After downloading, I unpacked the tarball and attempted a build as follows:
sudo ln -s /usr/include/python2.7 /usr/local/include/python2.7
python configure.py --sip-incdir=/usr/include/python2.7/
make
The configuration output appeared to identify the correct version of sip and I get the following (seemingly) sip related compile errors from make:
make[1]: Entering directory `~/Downloads/PyQt-gpl-5.5/QtWebKit'
g++ -c -m64 -pipe -fno-exceptions -O2 -Wall -W -D_REENTRANT -fPIC -DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQT_NO_DEBUG -DQT_PLUGIN -DQT_WEBKIT_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I. -I. -I/usr/include/python2.7 -I/usr/include/qt5 -I/usr/include/qt5/QtWebKit -I/usr/include/qt5/QtNetwork -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I. -o sipQtWebKitQWebSecurityOrigin.o sipQtWebKitQWebSecurityOrigin.cpp
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp: In function ‘PyObject* meth_QWebSecurityOrigin_addAccessWhitelistEntry(PyObject*, PyObject*)’:
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:384:9: error: ‘SubdomainSetting’ is not a member of ‘QWebSecurityOrigin’
QWebSecurityOrigin::SubdomainSetting a2;
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:384:46: error: expected ‘;’ before ‘a2’
QWebSecurityOrigin::SubdomainSetting a2;
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:387:214: error: ‘a2’ was not declared in this scope
if (sipParseArgs(&sipParseErr, sipArgs, "BJ1J1E", &sipSelf, sipType_QWebSecurityOrigin, &sipCpp, sipType_QString,&a0, &a0State, sipType_QString,&a1, &a1State, sipType_QWebSecurityOrigin_SubdomainSetting, &a2))
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:389:21: error: ‘class QWebSecurityOrigin’ has no member named ‘addAccessWhitelistEntry’
sipCpp->addAccessWhitelistEntry(*a0,*a1,a2);
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp: In function ‘PyObject* meth_QWebSecurityOrigin_removeAccessWhitelistEntry(PyObject*, PyObject*)’:
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:417:9: error: ‘SubdomainSetting’ is not a member of ‘QWebSecurityOrigin’
QWebSecurityOrigin::SubdomainSetting a2;
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:417:46: error: expected ‘;’ before ‘a2’
QWebSecurityOrigin::SubdomainSetting a2;
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:420:214: error: ‘a2’ was not declared in this scope
if (sipParseArgs(&sipParseErr, sipArgs, "BJ1J1E", &sipSelf, sipType_QWebSecurityOrigin, &sipCpp, sipType_QString,&a0, &a0State, sipType_QString,&a1, &a1State, sipType_QWebSecurityOrigin_SubdomainSetting, &a2))
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:422:21: error: ‘class QWebSecurityOrigin’ has no member named ‘removeAccessWhitelistEntry’
sipCpp->removeAccessWhitelistEntry(*a0,*a1,a2);
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp: In function ‘void* init_type_QWebSecurityOrigin(sipSimpleWrapper*, PyObject*, PyObject*, PyObject**, PyObject**, PyObject**)’:
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:477:48: error: no matching function for call to ‘QWebSecurityOrigin::QWebSecurityOrigin(const QUrl&)’
sipCpp = new QWebSecurityOrigin(*a0);
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:477:48: note: candidates are:
In file included from ~/Downloads/PyQt-gpl-5.5/sip/QtWebKit/qwebsecurityorigin.sip:26:0:
/usr/include/qt5/QtWebKit/qwebsecurityorigin.h:64:5: note: QWebSecurityOrigin::QWebSecurityOrigin(QWebSecurityOriginPrivate*)
QWebSecurityOrigin(QWebSecurityOriginPrivate* priv);
^
/usr/include/qt5/QtWebKit/qwebsecurityorigin.h:64:5: note: no known conversion for argument 1 from ‘const QUrl’ to ‘QWebSecurityOriginPrivate*’
/usr/include/qt5/QtWebKit/qwebsecurityorigin.h:58:5: note: QWebSecurityOrigin::QWebSecurityOrigin(const QWebSecurityOrigin&)
QWebSecurityOrigin(const QWebSecurityOrigin& other);
^
/usr/include/qt5/QtWebKit/qwebsecurityorigin.h:58:5: note: no known conversion for argument 1 from ‘const QUrl’ to ‘const QWebSecurityOrigin&’
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp: At global scope:
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:516:48: error: ‘AllowSubdomains’ is not a member of ‘QWebSecurityOrigin’
{sipName_AllowSubdomains, static_cast<int>(QWebSecurityOrigin::AllowSubdomains), 21},
^
~/Downloads/PyQt-gpl-5.5/QtWebKit/sipQtWebKitQWebSecurityOrigin.cpp:517:51: error: ‘DisallowSubdomains’ is not a member of ‘QWebSecurityOrigin’
{sipName_DisallowSubdomains, static_cast<int>(QWebSecurityOrigin::DisallowSubdomains), 21},
^
make[1]: *** [sipQtWebKitQWebSecurityOrigin.o] Error 1
make[1]: Leaving directory `~/Downloads/PyQt-gpl-5.5/QtWebKit'
make: *** [sub-QtWebKit-make_first-ordered] Error 2
The outcome is that I can make install and get some of the functionality that I'd expect; however, I am missing some required functionality with the WebKit widgets. I hope that I have supplied enough information to describe where i'm stuck. I feel just shy of digging into the code; however, I'm assuming that the answer is actually much simpler.
Thanks in advance!
So,
I started digging through the source package for the file that is failing to be compiled. In the sip directory there is a sip file QWebSecurityOrigin that contains the following:
%If (Qt_5_2_0 -)
enum SubdomainSetting
{
AllowSubdomains,
DisallowSubdomains,
};
%End
I can reasonably expect that this code be included as qmake tells me the following:
qmake --version
QMake version 3.0
Using Qt version 5.2.1 in /usr/lib/x86_64-linux-gnu
Next I wanted to look into the qwebsecurityorigin.h that was provided by Qt to see if the error could come from there. Mine is installed here: /usr/include/qt5/QtWebKit/qwebsecurityorigin.h
#ifndef _WEBSECURITYORIGIN_H_
#define _WEBSECURITYORIGIN_H_
#include <QtCore/qurl.h>
#include <QtCore/qshareddata.h>
#include "qwebkitglobal.h"
namespace WebCore {
class SecurityOrigin;
class ChromeClientQt;
}
class QWebSecurityOriginPrivate;
class QWebDatabase;
class QWebFrame;
class QWEBKIT_EXPORT QWebSecurityOrigin {
public:
static QList<QWebSecurityOrigin> allOrigins();
static void addLocalScheme(const QString& scheme);
static void removeLocalScheme(const QString& scheme);
static QStringList localSchemes();
~QWebSecurityOrigin();
QString scheme() const;
QString host() const;
int port() const;
qint64 databaseUsage() const;
qint64 databaseQuota() const;
void setDatabaseQuota(qint64 quota);
void setApplicationCacheQuota(qint64 quota);
QList<QWebDatabase> databases() const;
QWebSecurityOrigin(const QWebSecurityOrigin& other);
QWebSecurityOrigin &operator=(const QWebSecurityOrigin& other);
private:
friend class QWebDatabase;
friend class QWebFrameAdapter;
friend class WebCore::ChromeClientQt;
QWebSecurityOrigin(QWebSecurityOriginPrivate* priv);
private:
QExplicitlySharedDataPointer<QWebSecurityOriginPrivate> d;
};
Note, no enum is defined. A search of Qt 5.5 suggests that the enum should be there: http://doc.qt.io/qt-5/qwebsecurityorigin.html#SubdomainSetting-enum
Finally, had recalled that I installed libqt5webkit separately from the bulk of the Qt libraries; so, I did a version check on the package:
dpkg -s libqt5webkit5
Package: libqt5webkit5
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 34225
Maintainer: Ubuntu Developers <ubuntu-devel-discuss#lists.ubuntu.com>
Architecture: amd64
Multi-Arch: same
Source: qtwebkit-opensource-src
Version: 5.1.1-1ubuntu8
This output is almost identical for the dev package. So this makes it appear as the bulk of the Qt5 distribution, in the repos, is on a different version than webkit. Furthermore, if QWebKit is on 5.1.1, it would explain why the enum is missing as the sip file seems to suggest it was an addition in 5.2.0.
So my solution was to download and install Qt 5.5 from the Qt website using the automated installer (ran with sudo, using defaults). I then started fresh with the PyQt5 source by blowing away the build directory and unpacking source again:
python configure.py --sip-incdir=/usr/include/python2.7/ --qmake=/opt/Qt/5.5/gcc_64/bin/qmake
make
sudo make install
The licenses are not compatible; however, a quick search through the pyqt5 configure.py script, using the error output, may give some insight into getting the code configured and compiling.
I try to use Python/C API on msys2-mingw, so I install
this package mingw-w64-x86_64-python2, and I write main.cpp:
#include <python2.7\Python.h>
int main(){
return 0;
}
And when I enter this $ g++ main.cpp -o main,
It gives me these msg:
In file included from \msys64\mingw64\include/python2.7\Python.h:58:0,
from main.cpp:1:
\msys64\mingw64\include/python2.7\pyport.h:907:2: 錯誤:#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
^
In file included from \msys64\mingw64\include/python2.7\Python.h:8:0,
from main.cpp:1:
/usr/include/cygwin/types.h:78:20: 錯誤:一個宣告指定了多個類型
typedef __uint32_t uid_t;
^
/usr/include/cygwin/types.h:78:20: 錯誤:沒有宣告任何東西 [-fpermissive]
/usr/include/cygwin/types.h:84:20: 錯誤:一個宣告指定了多個類型
typedef __uint32_t gid_t;
^
/usr/include/cygwin/types.h:84:20: 錯誤:沒有宣告任何東西 [-fpermissive]
makefile:2: recipe for target 'main' failed
make: *** [main] Error 1
I have no idea why these happen. It's not a error about linking file(since I hadn't link any file.). Is my method wrong, or I include the wrong file ?
You mix GCC's: mingw-w64 GCC and msys GCC. For mingw-w64 GCC under MSYS2 you must not have includes from /usr. See your error message /usr/include/cygwin/types.h
I'm having some trouble installing psyco on my Macbook pro running Snow Leopard with python 2.6.1.
I've been trying to force python to run in 32-bit mode using the command
defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
Further, I have tried the Macport py26-psyco, which seems to finish but the module cannot be found when compiling.
$ sudo python setup.py install
PROCESSOR = 'ivm'
running install
running build
running build_py
running build_ext
building 'psyco._psyco' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DALL_STATIC=1 -Ic/ivm -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c c/psyco.c -o build/temp.macosx-10.6-universal-2.6/c/psyco.o
In file included from c/initialize.h:48,
from c/psyco.c:14:
c/psyfunc.c: In function ‘psycofunction_call’:
c/psyfunc.c:801: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type
In file included from c/initialize.h:49,
from c/psyco.c:14:
c/stats.c: In function ‘psyco_stats_reset’:
c/stats.c:260: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type
c/stats.c: In function ‘psyco_stats_dump’:
c/stats.c:298: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type
c/stats.c: In function ‘psyco_stats_top’:
c/stats.c:326: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type
In file included from c/initialize.h:75,
from c/psyco.c:14:
c/Objects/pstructmember.c: In function ‘PsycoMember_GetOne’:
c/Objects/pstructmember.c:16: warning: unused variable ‘w2’
c/psyco.c: At top level:
c/codegen.c:748: warning: ‘integer_lshift’ defined but not used
c/ivm/prolog/insns-igen.i:175: warning: ‘psyco_insn_assertdepth’ defined but not used
c/ivm/prolog/insns-igen.i:197: warning: ‘psyco_insn_dynamicfreq’ defined but not used
c/codegen.c:66: warning: ‘cc_from_vsource’ defined but not used
c/Objects/plongobject.c:20: warning: ‘PsycoLong_AsDouble’ defined but not used
c/Objects/plistobject.c:116: warning: ‘PsycoList_SingletonNew’ defined but not used
c/codegen.c: In function ‘psyco_generic_call’:
c/codegen.c:423: warning: ‘_arg’ may be used uninitialized in this function
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
In file included from c/initialize.h:48,
from c/psyco.c:14:
c/psyfunc.c: In function ‘psycofunction_call’:
c/psyfunc.c:801: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type
In file included from c/initialize.h:49,
from c/psyco.c:14:
c/stats.c: In function ‘psyco_stats_reset’:
c/stats.c:260: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type
c/stats.c: In function ‘psyco_stats_dump’:
c/stats.c:298: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type
c/stats.c: In function ‘psyco_stats_top’:
c/stats.c:326: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type
In file included from c/initialize.h:75,
from c/psyco.c:14:
c/Objects/pstructmember.c: In function ‘PsycoMember_GetOne’:
c/Objects/pstructmember.c:16: warning: unused variable ‘w2’
c/psyco.c: At top level:
c/codegen.c:748: warning: ‘integer_lshift’ defined but not used
c/ivm/prolog/insns-igen.i:175: warning: ‘psyco_insn_assertdepth’ defined but not used
c/ivm/prolog/insns-igen.i:197: warning: ‘psyco_insn_dynamicfreq’ defined but not used
c/codegen.c:66: warning: ‘cc_from_vsource’ defined but not used
c/Objects/plongobject.c:20: warning: ‘PsycoLong_AsDouble’ defined but not used
c/Objects/plistobject.c:116: warning: ‘PsycoList_SingletonNew’ defined but not used
c/codegen.c: In function ‘psyco_generic_call’:
c/codegen.c:423: warning: ‘_arg’ may be used uninitialized in this function
c/psyco.c: At top level:
c/psyco.c:1064: fatal error: error writing to -: Broken pipe
compilation terminated.
In file included from c/psyco.c:1:
c/psyco.h:13:3: error: #error "64-bit systems not supported at all. See help on psyco.sf.net"
In file included from c/dispatcher.h:10,
from c/codemanager.h:10,
from c/psyco.c:3:
c/vcompiler.h: In function ‘PsycoObject_New’:
c/vcompiler.h:743: warning: comparison is always false due to limited range of data type
c/vcompiler.h: In function ‘PsycoObject_Resize’:
c/vcompiler.h:757: warning: comparison is always false due to limited range of data type
In file included from c/dispatcher.h:12,
from c/codemanager.h:10,
from c/psyco.c:3:
c/codegen.h:15:3: error: #error "-----------------------------------------------------"
c/codegen.h:16:3: error: #error "Sorry, non-32-bit platforms are not supported at all."
c/codegen.h:17:3: error: #error "You may try with a Python compiled in 32-bit "
c/codegen.h:18:3: error: #error "compatibility mode. Note that Psyco will probably "
c/codegen.h:19:3: error: #error "never support non-32-bit platforms, as it is no "
c/codegen.h:20:3: error: #error "longer actively developed. Instead, the PyPy group "
c/codegen.h:21:3: error: #error "plans to replace it with a more flexible and easily "
c/codegen.h:22:3: error: #error "retargettable Psyco-for-PyPy during the year 2006. "
c/codegen.h:23:3: error: #error "See http://codespeak.net/pypy/ "
c/codegen.h:24:3: error: #error "-----------------------------------------------------"
In file included from c/ivm/iinitialize.h:12,
from c/initialize.h:42,
from c/psyco.c:14:
c/ivm/idispatcher.c: In function ‘psyco_unify’:
c/ivm/idispatcher.c:202: warning: comparison is always false due to limited range of data type
In file included from c/initialize.h:46,
from c/psyco.c:14:
c/dispatcher.c: In function ‘fz_internal_copy’:
c/dispatcher.c:131: warning: comparison is always false due to limited range of data type
c/dispatcher.c: In function ‘fz_compress’:
c/dispatcher.c:233: warning: cast from pointer to integer of different size
c/dispatcher.c:239: warning: cast to pointer from integer of different size
In file included from c/initialize.h:48,
from c/psyco.c:14:
c/psyfunc.c: In function ‘psycofunction_call’:
c/psyfunc.c:801: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type
In file included from c/initialize.h:49,
from c/psyco.c:14:
c/stats.c: In function ‘psyco_stats_reset’:
c/stats.c:260: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type
c/stats.c: In function ‘psyco_stats_dump’:
c/stats.c:298: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type
c/stats.c: In function ‘psyco_stats_top’:
c/stats.c:326: warning: passing argument 2 of ‘PyDict_Next’ from incompatible pointer type
In file included from c/initialize.h:53,
from c/psyco.c:14:
c/codemanager.c: In function ‘psyco_shrink_code_buffer’:
c/codemanager.c:235: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long int’
In file included from c/initialize.h:60,
from c/psyco.c:14:
c/Objects/pobject.c: In function ‘getdictoffset’:
c/Objects/pobject.c:257: error: ‘SIZE_OF_LONG_BITS’ undeclared (first use in this function)
c/Objects/pobject.c:257: error: (Each undeclared identifier is reported only once
c/Objects/pobject.c:257: error: for each function it appears in.)
In file included from c/initialize.h:61,
from c/psyco.c:14:
c/Objects/pabstract.c:723:3: error: #error "omitted code from Python 2.3 here"
In file included from c/initialize.h:75,
from c/psyco.c:14:
c/Objects/pstructmember.c: In function ‘PsycoMember_GetOne’:
c/Objects/pstructmember.c:16: warning: unused variable ‘w2’
lipo: can't open input file: /var/tmp//ccjHgyCU.out (No such file or directory)
error: command 'gcc-4.2' failed with exit status
Try doing this before compiling:
export ARCHFLAGS="-arch i386"
then in the setup.py
replace
extra_link_args = [ ]
with
extra_link_args = [ '-L/Developer/SDKs/MacOSX10.6.sdk/usr/lib' ]
then just run:
python setup.py install
Hope this helps!
I ran into the same problem on my MacBook Pro using OS X 10.7.
I was able to compile it using "sudo python2.5 setup.py install"
Not it work's like charm. Hope this might help someone else.
I don't have an answer to your question, but as an alternative, did you try installing from the source, as detailed here and here?
Furthermore, you can force 32bit python as well by invoking the command python2.6-32 in the terminal, which may be a bit more convenient for testing purposes.
Why compile things on your own when there is an easy way out?
Install ActivePython 2.6 for Mac
Open Terminal and type pypm install psyco