rpy2 installation error (OSX 10.8, R 3.1) - rpy2

The error message is
gcc -bundle -undefined dynamic_lookup -g -arch x86_64 -headerpad_max_install_names -arch x86_64 build/temp.macosx-10.6-x86_64-2.7/./rpy/rinterface/_rinterface.o -L/Library/Frameworks/R.framework/Resources/lib -L/Library/Frameworks/R.framework/Resources/modules -lR -llzma -liconv -licucore -lm -o build/lib.macosx-10.6-x86_64-2.7/rpy2/rinterface/_rinterface.so
ld: library not found for -llzma
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

I've just tried rpy2 2.4.0 and successfully installed it with R 3.1.0 on OSX 10.8.5. However, when I run tests after installation
python -m 'rpy2.tests'
it comes with one failure
rpy2 version: 2.4.0
- built against R version: 3-1.0--65387
- running linked to R version: R version 3.1.0 (2014-04-10)
/Users/xxx/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pytz/__init__.py:29: UserWarning: Module rpy2 was already imported from /Users/xxx/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/rpy2-2.4.0-py2.7-macosx-10.6-x86_64.egg/rpy2/__init__.pyc, but /Users/xxx/Downloads/rpy2-2.4.0 is being added to sys.path
from pkg_resources import resource_streamFontconfig error: Cannot load default config file
Ran 374 tests in 8.728s
OK (skipped=1, expected failures=1)

I had a similar problem and was using the brew version of R:
--compile failed with error code 1 in /private/tmp/pip_build_root/rpy2
ld: library not found for -lR
Directly installing from with the .pkg from http://www.r-project.org solved the problem for me.

Related

Building python 3 c modules in MacOS - setup using odd compiler options

I'm trying to build a c module in MacOS. The build fails during the linker process with the error:
ld: warning: object file (build/temp.macosx-11.1-x86_64-3.7/pparser.o) was built for newer macOS version (11.1) than being linked (11.0)
I realize this is just a warning but the resulting so file fails in import to a python script. I'm doing the build with the following setup.py
from distutils.core import setup, Extension
setup(name='pparser', version='1.0', \
ext_modules=[Extension('pparser',
['pparser.cpp'],
extra_compile_args = ["-Wno-nullability-completeness",
"-Wno-undef-prefix",
"-I/usr/local/opt/flex/include",
"-I/usr/local/opt/bison/include",
"-std=gnu++14"])])
What's odd is that I can capture the clang invocation and run it myself at the command line with the verbose option
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -bundle -undefined dynamic_lookup -L/Users/john/.pyenv/versions/3.7.9/lib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -std=gnu++14 -L/usr/local/opt/readline/lib -L/Users/john/.pyenv/versions/3.7.9/lib -L/usr/local/opt/tcl-tk/lib build/temp.macosx-11.1-x86_64-3.7/pparser.o -o build/lib.macosx-11.1-x86_64-3.7/pparser.cpython-37m-darwin.so --verbose
and I see the following:
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -bundle -platform_version macos 11.0.0 11.3 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -undefined dynamic_lookup -undefined dynamic_lookup -o build/lib.macosx-11.1-x86_64-3.7/pparser.cpython-37m-darwin.so -L/Users/john/.pyenv/versions/3.7.9/lib -L/usr/local/opt/readline/lib -L/Users/john/.pyenv/versions/3.7.9/lib -L/usr/local/opt/tcl-tk/lib build/temp.macosx-11.1-x86_64-3.7/pparser.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5/lib/darwin/libclang_rt.osx.a
I suspect that the problem is the ld switch -platform-version macOS 11.0.0 11.3 but where does that come from? It's not in the setup file or in the command line that I typed.
My set up is brew python 3.7.9 in a pyenv virtual environment.
Any help on understanding where python setup is pulling command line options from would be quite helpful.
After more digging, I found the answer here:
Customizing the compiler and linker used by setuptools
It seems that CPython creates a sysconfig file containing all the environment variables used to compile it. These are then used by python when a setup file is built.
You can review these variables in python:
import distutils.sysconfig
distutils.sysconfig.get_config_var()
The author goes on to describe how to override any variable desired.

Running ghc fails with message about iOS simulator

I tried running ghc to compile a haskell program, and I get the following error:
$ ghc --make main
Linking main ...
ld: building for macOS, but linking in object file built for iOS Simulator, file 'main.o' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`clang' failed in phase `Linker'. (Exit code: 1)
Here are some details about my machine:
macOS Catalina 10.15.7
Xcode 12.2
The Xcode developer tools were installed with xcode-select --install
I installed ghc with brew install ghc
Some other output that might be relevant:
$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
If I run ghc --make main -v, this is what the output looks like right before it fails (apologies for the long line, not sure how to format this better):
clang -o main -fno-common -U__PIC__ -D__PIC__ -Wl,-no_compact_unwind main.o -L/usr/local/Cellar/ghc/8.10.1_2/lib/ghc-8.10.1/base-4.14.0.0 -L/usr/local/Cellar/ghc/8.10.1_2/lib/ghc-8.10.1/integer-gmp-1.0.3.0 -L/usr/local/Cellar/ghc/8.10.1_2/libexec/integer-gmp/lib -L/usr/local/Cellar/ghc/8.10.1_2/lib/ghc-8.10.1/ghc-prim-0.6.1 -L/usr/local/Cellar/ghc/8.10.1_2/lib/ghc-8.10.1/rts /var/folders/5j/wwtlv8lx0m5fmhc3hy5w5_000000gp/T/ghc49162_0/ghc_2.o -Wl,-u,_base_GHCziTopHandler_runIO_closure -Wl,-u,_base_GHCziTopHandler_runNonIO_closure -Wl,-u,_ghczmprim_GHCziTuple_Z0T_closure -Wl,-u,_ghczmprim_GHCziTypes_True_closure -Wl,-u,_ghczmprim_GHCziTypes_False_closure -Wl,-u,_base_GHCziPack_unpackCString_closure -Wl,-u,_base_GHCziWeak_runFinalizzerBatch_closure -Wl,-u,_base_GHCziIOziException_stackOverflow_closure -Wl,-u,_base_GHCziIOziException_heapOverflow_closure -Wl,-u,_base_GHCziIOziException_allocationLimitExceeded_closure -Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnMVar_closure -Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnSTM_closure -Wl,-u,_base_GHCziIOziException_cannotCompactFunction_closure -Wl,-u,_base_GHCziIOziException_cannotCompactPinned_closure -Wl,-u,_base_GHCziIOziException_cannotCompactMutable_closure -Wl,-u,_base_ControlziExceptionziBase_absentSumFieldError_closure -Wl,-u,_base_ControlziExceptionziBase_nonTermination_closure -Wl,-u,_base_ControlziExceptionziBase_nestedAtomically_closure -Wl,-u,_base_GHCziEventziThread_blockedOnBadFD_closure -Wl,-u,_base_GHCziConcziSync_runSparks_closure -Wl,-u,_base_GHCziConcziIO_ensureIOManagerIsRunning_closure -Wl,-u,_base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure -Wl,-u,_base_GHCziConcziSignal_runHandlersPtr_closure -Wl,-u,_base_GHCziTopHandler_flushStdHandles_closure -Wl,-u,_base_GHCziTopHandler_runMainIO_closure -Wl,-u,_ghczmprim_GHCziTypes_Czh_con_info -Wl,-u,_ghczmprim_GHCziTypes_Izh_con_info -Wl,-u,_ghczmprim_GHCziTypes_Fzh_con_info -Wl,-u,_ghczmprim_GHCziTypes_Dzh_con_info -Wl,-u,_ghczmprim_GHCziTypes_Wzh_con_info -Wl,-u,_base_GHCziPtr_Ptr_con_info -Wl,-u,_base_GHCziPtr_FunPtr_con_info -Wl,-u,_base_GHCziInt_I8zh_con_info -Wl,-u,_base_GHCziInt_I16zh_con_info -Wl,-u,_base_GHCziInt_I32zh_con_info -Wl,-u,_base_GHCziInt_I64zh_con_info -Wl,-u,_base_GHCziWord_W8zh_con_info -Wl,-u,_base_GHCziWord_W16zh_con_info -Wl,-u,_base_GHCziWord_W32zh_con_info -Wl,-u,_base_GHCziWord_W64zh_con_info -Wl,-u,_base_GHCziStable_StablePtr_con_info -Wl,-u,_hs_atomic_add8 -Wl,-u,_hs_atomic_add16 -Wl,-u,_hs_atomic_add32 -Wl,-u,_hs_atomic_add64 -Wl,-u,_hs_atomic_sub8 -Wl,-u,_hs_atomic_sub16 -Wl,-u,_hs_atomic_sub32 -Wl,-u,_hs_atomic_sub64 -Wl,-u,_hs_atomic_and8 -Wl,-u,_hs_atomic_and16 -Wl,-u,_hs_atomic_and32 -Wl,-u,_hs_atomic_and64 -Wl,-u,_hs_atomic_nand8 -Wl,-u,_hs_atomic_nand16 -Wl,-u,_hs_atomic_nand32 -Wl,-u,_hs_atomic_nand64 -Wl,-u,_hs_atomic_or8 -Wl,-u,_hs_atomic_or16 -Wl,-u,_hs_atomic_or32 -Wl,-u,_hs_atomic_or64 -Wl,-u,_hs_atomic_xor8 -Wl,-u,_hs_atomic_xor16 -Wl,-u,_hs_atomic_xor32 -Wl,-u,_hs_atomic_xor64 -Wl,-u,_hs_cmpxchg8 -Wl,-u,_hs_cmpxchg16 -Wl,-u,_hs_cmpxchg32 -Wl,-u,_hs_cmpxchg64 -Wl,-u,_hs_atomicread8 -Wl,-u,_hs_atomicread16 -Wl,-u,_hs_atomicread32 -Wl,-u,_hs_atomicread64 -Wl,-u,_hs_atomicwrite8 -Wl,-u,_hs_atomicwrite16 -Wl,-u,_hs_atomicwrite32 -Wl,-u,_hs_atomicwrite64 -Wl,-search_paths_first -Wl,-dead_strip -lHSbase-4.14.0.0 -lHSinteger-gmp-1.0.3.0 -lHSghc-prim-0.6.1 -lHSrts -lCffi -liconv -lgmp -lm -ldl -Wl,-dead_strip_dylibs
ld: building for macOS, but linking in object file built for iOS Simulator, file 'main.o' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

ld: error: unable to find library -lmysqlclient

I am trying to compile my game program and it s giving me this
root#vps:/usr/src/Sursa/Server/source/game/src # gmake -j20
linking ../game
ld: error: unable to find library -lmysqlclient
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [Makefile:228: ../game] Error 1
root#vps:/usr/src/Sursa/Server/source/game/src #
This is my Makefile path for library
# mysql
INCDIR += -I../../../extern/mysql
LIBDIR += -L/usr/local/lib/mysq
LIBS += -lmysqlclient -lz -pthread -lm -lssl -lcrypto
### END
You need to update your GCC compiler since some features of c++14 is not supported by gcc4.9.
You can search the available packages in FreeBSD using
pkg search <package_name>
and install whatever you want via
pkg install <package_name>
Note : you might need sudo before those commands if your current user is not root
Finally if you have problems such as
Fatal error : "some_file"."some_extension" file not found
you can search the package name via the aforementioned command and install them in order to compile successfully.
For example to mitigate the following error
fatal error: 'boost/intrusive_ptr.hpp' file not found
you can install the boost-libs package.

azure aztk installation pycryptodome

When I am installing the requirements for [Spark Aztk][1] there is an error while installing the dependencies for pycryptodome.
gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-3.6/src/MD2.o -L/usr/lib64 -lpython3.6m -o build/lib.linux-x86_64-3.6/Crypto/Hash/_MD2.cpython-36m-x86_64-linux-gnu.so
/bin/ld: cannot find -lpython3.6m
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
I think the problem is that it might be an error in the installation script that is missing one space in the "python3.6m" file using "-lpython3.6m" instead. But I'm not sure. I don't know if it is possible to use a different version of the dependency or not. Because I have already installed python 3.6 properly.
The OS is CentOS on Azure.
I just had this problem and saw that I didn't compiled the python interpreter correctly (I used --prefix but moved the interpreter to another place)

Build sqlcipher on ubuntu

Hi I'm trying to build sqlcipher on ubuntu (11.10 minimal). On Mac OS X I had no problems though.
I followed the instructions from sqlcipher.net. First step was configure. I tried to execute configure with the following command:
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
but I got the following error message: "configure: error: C compiler cannot create executables"
In the config.log some lines caught my eyes but I don't know how to fix it:
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
configure:2544: $? = 0
configure:2551: gcc -V >&5
gcc: error: unrecognized option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2555: $? = 4
configure:2578: checking for C compiler default output file name
configure:2600: gcc -DSQLITE_HAS_CODEC -lcrypto conftest.c >&5
/usr/bin/ld: cannot find -lcrypto
collect2: ld returned 1 exit status
Has anybody successfully build sqlcipher on ubuntu yet? Regards
You will need to install the GNU compiler toolchain in order to build from source. Execute the following command in a terminal.
$ sudo apt-get install build-essential

Resources