Currently have FreeTDS 0.92.4 / unixODBC 2.3.1 up and running, connecting with a MSSQL server and able to execute queries etc.
I've found this list of ODBC implementations for Go, and have tried the two in bold:
BenoyRNair https://github.com/BenoyRNair/godbc/
Wei guangjing https://github.com/weigj/go-odbc
Mark Severson https://bitbucket.org/miquella/mgodbc
Luke Mauldin https://github.com/LukeMauldin/lodbc
Robert Johnstone https://bitbucket.org/rj/odbc3-go/
brainman http://code.google.com/p/odbc/
mgodbc
I'm getting a bunch of deprecation warnings (looking at the headers they're deprecated for OSX 10.8 and later):
cc1: warnings being treated as errors
mgodbc.go: In function 'mSQLColAttribute':
mgodbc.go:31: warning: 'SQLColAttributeW' is deprecated (declared at /usr/include/sqlucode.h:128)
mgodbc.go: At top level:
mgodbc.go:44: warning: 'SQLDisconnect' is deprecated (declared at /usr/include/sql.h:896)
mgodbc.go:51: warning: 'SQLGetDiagRecW' is deprecated (declared at /usr/include/sqlucode.h:233)
mgodbc.go:62: warning: 'SQLGetInfoW' is deprecated (declared at /usr/include/sqlucode.h:273)
mgodbc.go:67: warning: 'SQLBindParameter' is deprecated (declared at /usr/include/sqlext.h:2519)
mgodbc.go:70: warning: 'SQLDriverConnectW' is deprecated (declared at /usr/include/sqlucode.h:336)
mgodbc.go:73: warning: 'SQLSetEnvAttr' is deprecated (declared at /usr/include/sql.h:1120)
mgodbc.go:74: warning: 'SQLFreeHandle' is deprecated (declared at /usr/include/sql.h:942)
mgodbc.go:75: warning: 'SQLSetConnectAttrW' is deprecated (declared at /usr/include/sqlucode.h:245)
mgodbc.go:78: warning: 'SQLGetDiagFieldW' is deprecated (declared at /usr/include/sqlucode.h:223)
mgodbc.go:82: warning: 'SQLRowCount' is deprecated (declared at /usr/include/sql.h:1076)
mgodbc.go:98: warning: 'SQLGetData' is deprecated (declared at /usr/include/sql.h:975)
mgodbc.go:99: warning: 'SQLEndTran' is deprecated (declared at /usr/include/sql.h:902)
mgodbc.go:102: warning: 'SQLCloseCursor' is deprecated (declared at /usr/include/sql.h:831)
mgodbc.go:103: warning: 'SQLPrepareW' is deprecated (declared at /usr/include/sqlucode.h:239)
mgodbc.go:107: warning: 'SQLNumResultCols' is deprecated (declared at /usr/include/sql.h:1058)
mgodbc.go:113: warning: 'SQLAllocHandle' is deprecated (declared at /usr/include/sql.h:799)
mgodbc.go:114: warning: 'SQLExecute' is deprecated (declared at /usr/include/sql.h:921)
mgodbc.go:115: warning: 'SQLFetch' is deprecated (declared at /usr/include/sql.h:924)
mgodbc.go:119: warning: 'SQLNumParams' is deprecated (declared at /usr/include/sqlext.h:2448)
Update
Following a suggestion from mac01021, from go-nuts irc, I've added
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
This gets rid of the deprecation warnings, but still doesn't build against the included iODBC of OS X
Replacing the above line with:
#cgo darwin CFLAGS: -I/opt/local/include
and voila, mgodbc builds now (using the installed unixODBC)
although now a nice little segfault occurs upon import =(
odbc
I'm getting build errors:
# code.google.com/p/odbc/api
api/api.go:13: undefined: SQLSMALLINT
api/api.go:14: undefined: SQLUSMALLINT
api/api.go:15: undefined: SQLUSMALLINT
api/api.go:19: undefined: SQLSMALLINT
api/api.go:20: undefined: SQLUSMALLINT
api/api.go:21: undefined: SQLUSMALLINT
api/api.go:22: undefined: SQLUSMALLINT
api/api.go:23: undefined: SQLUSMALLINT
api/api.go:24: undefined: SQLUSMALLINT
api/api.go:25: undefined: SQLUINTEGER
api/api.go:25: too many errors
Update
Thanks #alex for the cgo info. I've modified api_unix.go with the below
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build linux darwin
// +build cgo
package api
// #cgo linux LDFLAGS: -lodbc
// #cgo darwin LDFLAGS: -lodbc
// #cgo darwin CFLAGS: -I /opt/local/include
// #include <sql.h>
// #include <sqlext.h>
import "C"
The iODBC included with OS X has some things that are listed as deprecated (and I've had better luck with unixODBC in the past)
I've added the -I /opt/local/include to the CFLAGS to, hopefully, point to the unixODBC headers, and not the ones included by Apple (which have the deprecation warnings etc.)
Running # go build -x gives me:
WORK=/var/folders/z2/k9vxn7gn6395vb3y2qc7_1040000gn/T/go-build784364461
mkdir -p $WORK/code.google.com/p/odbc/api/_obj/
mkdir -p $WORK/code.google.com/p/odbc/
cd /Users/jr/Development/go/src/code.google.com/p/odbc/api
/usr/local/go/pkg/tool/darwin_amd64/cgo -objdir $WORK/code.google.com/p/odbc/api/_obj/ -- -I /opt/local/include -I $WORK/code.google.com/p/odbc/api/_obj/ api_unix.go
/usr/local/go/pkg/tool/darwin_amd64/6c -F -V -w -I $WORK/code.google.com/p/odbc/api/_obj/ -I /usr/local/go/pkg/darwin_amd64 -o $WORK/code.google.com/p/odbc/api/_obj/_cgo_defun.6 -D GOOS_darwin -D GOARCH_amd64 $WORK/code.google.com/p/odbc/api/_obj/_cgo_defun.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -print-libgcc-file-name
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -I /opt/local/include -I $WORK/code.google.com/p/odbc/api/_obj/ -o $WORK/code.google.com/p/odbc/api/_obj/_cgo_main.o -c $WORK/code.google.com/p/odbc/api/_obj/_cgo_main.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -I /opt/local/include -I $WORK/code.google.com/p/odbc/api/_obj/ -o $WORK/code.google.com/p/odbc/api/_obj/_cgo_export.o -c $WORK/code.google.com/p/odbc/api/_obj/_cgo_export.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -I /opt/local/include -I $WORK/code.google.com/p/odbc/api/_obj/ -o $WORK/code.google.com/p/odbc/api/_obj/api_unix.cgo2.o -c $WORK/code.google.com/p/odbc/api/_obj/api_unix.cgo2.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -o $WORK/code.google.com/p/odbc/api/_obj/_cgo_.o $WORK/code.google.com/p/odbc/api/_obj/_cgo_main.o $WORK/code.google.com/p/odbc/api/_obj/_cgo_export.o $WORK/code.google.com/p/odbc/api/_obj/api_unix.cgo2.o -lodbc
/usr/local/go/pkg/tool/darwin_amd64/cgo -objdir $WORK/code.google.com/p/odbc/api/_obj/ -dynimport $WORK/code.google.com/p/odbc/api/_obj/_cgo_.o -dynout $WORK/code.google.com/p/odbc/api/_obj/_cgo_import.c
/usr/local/go/pkg/tool/darwin_amd64/6c -F -V -w -I $WORK/code.google.com/p/odbc/api/_obj/ -I /usr/local/go/pkg/darwin_amd64 -o $WORK/code.google.com/p/odbc/api/_obj/_cgo_import.6 -D GOOS_darwin -D GOARCH_amd64 $WORK/code.google.com/p/odbc/api/_obj/_cgo_import.c
gcc -I . -g -O2 -fPIC -m64 -pthread -fno-common -o $WORK/code.google.com/p/odbc/api/_obj/_all.o $WORK/code.google.com/p/odbc/api/_obj/_cgo_export.o $WORK/code.google.com/p/odbc/api/_obj/api_unix.cgo2.o -Wl,-r -nostdlib /usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/x86_64/libgcc.a
/usr/local/go/pkg/tool/darwin_amd64/6g -o $WORK/code.google.com/p/odbc/api/_obj/_go_.6 -p code.google.com/p/odbc/api -D _/Users/jr/Development/go/src/code.google.com/p/odbc/api -I $WORK ./api.go $WORK/code.google.com/p/odbc/api/_obj/_cgo_gotypes.go $WORK/code.google.com/p/odbc/api/_obj/api_unix.cgo1.go
/usr/local/go/pkg/tool/darwin_amd64/pack grcP $WORK $WORK/code.google.com/p/odbc/api.a $WORK/code.google.com/p/odbc/api/_obj/_go_.6 $WORK/code.google.com/p/odbc/api/_obj/_cgo_import.6 $WORK/code.google.com/p/odbc/api/_obj/_cgo_defun.6 $WORK/code.google.com/p/odbc/api/_obj/_all.o
mkdir -p $WORK/code.google.com/p/odbc/_obj/
mkdir -p $WORK/code.google.com/p/
cd /Users/jr/Development/go/src/code.google.com/p/odbc
/usr/local/go/pkg/tool/darwin_amd64/6g -o $WORK/code.google.com/p/odbc/_obj/_go_.6 -p code.google.com/p/odbc -complete -D _/Users/jr/Development/go/src/code.google.com/p/odbc -I $WORK -I /Users/jr/Development/go/pkg/darwin_amd64 ./column.go ./conn.go ./driver.go ./error.go ./handle.go ./odbcstmt.go ./param.go ./result.go ./rows.go ./stats.go ./stmt.go ./tx.go
# code.google.com/p/odbc
./column.go:22: undefined: api.SQLGetData
./column.go:28: undefined: api.SQLBindCol
./column.go:47: undefined: api.SQLDescribeCol
./conn.go:20: undefined: api.SQLAllocHandle
./conn.go:28: undefined: api.SQLDriverConnect
./conn.go:39: undefined: api.SQLDisconnect
./driver.go:26: undefined: api.SQLAllocHandle
./driver.go:34: undefined: api.SQLSetEnvAttr
./driver.go:43: undefined: api.SQLSetEnvAttr
./driver.go:50: undefined: api.SQLSetEnvAttr
./driver.go:50: too many errors
It looks like the header path include is being passed correctly?
But still looks like things are not quite linking correctly?
for SQLGetData I do see a matching definition from the //sys SQLGetData... comment from api.go within /opt/local/include/sql.h
UPDATE
The library mentioned at the top:
brainman http://code.google.com/p/odbc/
Now works as a go-gettable package on OSX. There's even documentation to get you started with the odbc/tds portions.
On Windows:
>go version
go version devel +edd229b63fa4 Wed Jun 26 11:36:18 2013 -0700 windows/amd64
>go get -v code.google.com/p/odbc
code.google.com/p/odbc (download)
code.google.com/p/odbc/api
code.google.com/p/odbc
>go get -v bitbucket.org/miquella/mgodbc
bitbucket.org/miquella/mgodbc (download)
bitbucket.org/miquella/mgodbc
>
On Linux:
$ go version
go version devel +65e2aba21abe Wed Jun 26 13:14:11 2013 -0700 linux/amd64
$ sudo apt-get install unixodbc unixodbc-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
unixodbc is already the newest version.
unixodbc-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
$ go get -v code.google.com/p/odbc
code.google.com/p/odbc (download)
code.google.com/p/odbc/api
code.google.com/p/odbc
$ go get -v bitbucket.org/miquella/mgodbc
bitbucket.org/miquella/mgodbc (download)
bitbucket.org/miquella/mgodbc
$
On Darwin, you seem to have issues with SQL header files.
/usr/include/sql.h
/usr/include/sqlext.h
/usr/include/sqltypes.h
/usr/include/sqlucode.h
Contact the odbc package authors to report these problems.
UPDATE:
When you tell us about the error
mgodbc.go:180: cannot convert &state[0] (type *uint16) to type *_Ctype_SQLWCHAR
you don't tell us what the type of _Ctype_SQLWCHAR is. We can only guess! My guess would be that it should look like this
package main
func main() {
type _Ctype_ushort uint16
type _Ctype_WCHAR _Ctype_ushort
type _Ctype_SQLWCHAR _Ctype_WCHAR
var state [6]uint16
// (*C.SQLWCHAR)(&state[0])
_ = (*_Ctype_SQLWCHAR)(&state[0])
}
which compiles with no errors.
UPDATE:
Use a systematic approach to problem solving.
Read about Go build contraints: Build Constraints, Package build.
Read the files in code.google.com/p/odbc/api.
Grep the files in code.google.com/p/odbc/api.
$ grep -r 'linux' *
api_unix.go:// +build linux
api_unix.go:// #cgo linux LDFLAGS: -lodbc
Makefile: GOOS=linux ./mksyscall_unix.pl $^ \
mksyscall_unix.pl:// +build linux
mksyscall_unix.pl:// #cgo linux LDFLAGS: -lodbc
zapi_unix.go:// +build linux
zapi_unix.go:// #cgo linux LDFLAGS: -lodbc
$
Clearly, after reading the api_unix.go, zapi_unix.go, mksyscall_unix.pl, and Makefile files, when the api_unix.go file is modified, the zapi_unix.go file should be modified too.
You probably didn't do that. Therefore, darwin is not included in the zapi_unix.go build constraints. The package api names that you show as undefined are defined in zapi_unix.go.
api.SQLGetData
api.SQLBindCol
api.SQLDescribeCol
api.SQLAllocHandle
api.SQLDriverConnect
api.SQLDisconnect
api.SQLAllocHandle
api.SQLSetEnvAttr
Related
everyone. I tried to install rpy2 in Centos6.10, with Python 3.6.4 and R version 3.5.2. I used the comand 'pip3 install rpy2'. I got the following errors:
cwd: /tmp/pip-install-7bxzxlni/rpy2_0e939a480cc0488d918a202af1b64127/
Complete output (153 lines):
['cffi>=1.10.0', 'jinja2', 'pytz', 'tzlocal']
running install
running build
cffi mode: CFFI_MODE.ANY
running build_py
file _rinterface_cffi_abi.py (for module _rinterface_cffi_abi) not found
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/rpy2
...(many copy information like this "copying ./rpy2/rinterface_lib/memorymanagement.py -> build/lib.linux-x86_64-3.6/rpy2/rinterface_lib")
file _rinterface_cffi_abi.py (for module _rinterface_cffi_abi) not found
generating cffi module 'build/lib.linux-x86_64-3.6/_rinterface_cffi_abi.py'
running build_ext
generating cffi module 'build/temp.linux-x86_64-3.6/_rinterface_cffi_api.c'
creating build/temp.linux-x86_64-3.6
building '_rinterface_cffi_api' extension
creating build/temp.linux-x86_64-3.6/build
creating build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6
gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -O2 -pipe -fPIC -DRPY2_RLEN_LONG=True -DR_INTERFACE_PTRS=True -Irpy2/rinterface_lib/ -I/home/work/.jumbo/include/python3.6m -c build/temp.linux-x86_64-3.6/_rinterface_cffi_api.c -o build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6/_rinterface_cffi_api.o
In file included from build/temp.linux-x86_64-3.6/_rinterface_cffi_api.c:569:
rpy2/rinterface_lib/R_API.h:199: warning: function declaration isn’t a prototype
In file included from build/temp.linux-x86_64-3.6/_rinterface_cffi_api.c:570:
rpy2/rinterface_lib/R_API_eventloop.h:26: error: redefinition of typedef ‘InputHandler’
rpy2/rinterface_lib/R_API_eventloop.h:8: note: previous declaration of ‘InputHandler’ was here
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/work/.jumbo/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7bxzxlni/rpy2_0e939a480cc0488d918a202af1b64127/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7bxzxlni/rpy2_0e939a480cc0488d918a202af1b64127/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-lx5dv6cc/install-record.txt --single-version-externally-managed --compile --install-headers /home/work/.jumbo/include/python3.6m/rpy2 Check the logs for full command output.
'''
Since there is "command 'gcc' failed with exit status 1", I installed all things mentioned in here. Since "Command errored out with exit status 1", I referred here~, e.g, I have tried 'pip3 install --upgrade rpy2' and I also tried to first upgrade my pip3. But these ways did not help me. Besides, I followed by this way and this~. The first did not help and the latter will pose 'error: option --r-home not recognized' after my command 'python3 setup.py build --r-home /usr/lib64/R/ install'.
Here is some other information:
echo$PATH
bash:echo/home/work/.jumbo/bin/core_perl:/home/work/.jumbo/bin:/home/work/.jumbo/bin/core_perl:/home/work/.jumbo/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/opt/bin:/home/opt/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/bin:/home/opt/bin:/usr/local/git/bin:/home/work/bin: No such file or directory
echo$R_HOME
bash: echo/usr/lib64/R: No such file or directory
echo$LD_LIBRARY_PATH
Please help me!
I get my "R_HOME" by starting R and input 'Sys.getenv("R_HOME")'. The output is "/usr/lib64/R". This is why I creat the variable "R_HOME" by "export R_HOME=/usr/lib64/R" in my /etc/profile. Now I use 'which R' and I get '/usr/bin/R', so I changed "R_HOME" variable from "/usr/lib64/R" into "/usr/bin/" which solved my problem! Oh yeah! I hope my experience can help some guys.
I am working in building Japanese NLP sentiment analysis, to tokenise the Japanese sentence we have a package called "SudachiPy".I tried to install it but I am getting error while installing the package. I'm using anaconda in MAC Book pro.
I tried all the steps mentioned in stack overflow by installing following libraries to debug the error.
pip3 install python3-dev
Also I tried launching an "Ubuntu" instance from AWS and try to install "SudachiPy" but still encountering the same error.
pip3 install SudachiPy
Building wheels for collected packages: dartsclone
Building wheel for dartsclone (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/lf/4754h1x94x39xfw_q6c8_ryc0000gn/T/pip-install-st3sqcmm/dartsclone/setup.py'"'"'; __file__='"'"'/private/var/folders/lf/4754h1x94x39xfw_q6c8_ryc0000gn/T/pip-install-st3sqcmm/dartsclone/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/lf/4754h1x94x39xfw_q6c8_ryc0000gn/T/pip-wheel-x8k1ryul --python-tag cp36
cwd: /private/var/folders/lf/4754h1x94x39xfw_q6c8_ryc0000gn/T/pip-install-st3sqcmm/dartsclone/
Complete output (25 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.7-x86_64-3.6
creating build/lib.macosx-10.7-x86_64-3.6/dartsclone
copying dartsclone/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/dartsclone
running build_ext
cythoning dartsclone/_dartsclone.pyx to dartsclone/_dartsclone.cpp
/anaconda3/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /private/var/folders/lf/4754h1x94x39xfw_q6c8_ryc0000gn/T/pip-install-st3sqcmm/dartsclone/dartsclone/_dartsclone.pxd
tree = Parsing.p_module(s, pxd, full_module_name)
warning: dartsclone/_dartsclone.pyx:119:49: local variable 'result' referenced before assignment
warning: dartsclone/_dartsclone.pyx:120:15: local variable 'result' referenced before assignment
building 'dartsclone._dartsclone' extension
creating build/temp.macosx-10.7-x86_64-3.6
creating build/temp.macosx-10.7-x86_64-3.6/dartsclone
creating build/temp.macosx-10.7-x86_64-3.6/csrc
creating build/temp.macosx-10.7-x86_64-3.6/csrc/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -I./csrc/include -I/anaconda3/include/python3.6m -c dartsclone/_dartsclone.cpp -o build/temp.macosx-10.7-x86_64-3.6/dartsclone/_dartsclone.o
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
dartsclone/_dartsclone.cpp:610:10: fatal error: 'ios' file not found
#include "ios"
^~~~~
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for dartsclone
You need to install some deps before, similar to Linux build-essential:
xcode-select install
Also, you may need to specify the right compiler, by setting this env. variable:
CFLAGS='-stdlib=libc++'
I'm trying to install an R package called treatSens with conda to use it in Jupyter notebook. The commands I executed:
conda install conda-build
conda skeleton cran treatSens
conda build r-treatsens
conda install -c local r-treatsens
And I got the error about C compiler
* installing *source* package ‘dbarts’ ...
** package ‘dbarts’ successfully unpacked and MD5 sums checked
checking for gcc... x86_64-apple-darwin13.4.0-clang
checking whether the C compiler works... no
configure: error: in `/Users/myusername/anaconda3/conda-bld/r-dbarts_1543961434509/myenvname':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘dbarts’
My clang version:
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Users/myusername/anaconda3/envs/myenvname/bin
Looking into the config.log file I see
configure:3570: x86_64-apple-darwin13.4.0-clang -V >&5
clang-4.0: error: argument to '-V' is missing (expected 1 value)
clang-4.0: error: no input files
configure:3581: $? = 1
configure:3570: x86_64-apple-darwin13.4.0-clang -qversion >&5
clang-4.0: error: unknown argument: '-qversion'
clang-4.0: error: no input files
configure:3581: $? = 1
configure:3601: checking whether the C compiler works
configure:3623: x86_64-apple-darwin13.4.0-clang -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/myusername/anaconda3/envs/work/conda-bld/r-dbarts_1543961045662/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include -fdebug-prefix-map=/Users/myusername/anaconda3/envs/work/conda-bld/r-dbarts_1543961045662/work=/usr/local/src/conda/r-dbarts-0.9_5 -fdebug-prefix-map=/Users/myusername/anaconda3/envs/work/conda-bld/r-dbarts_1543961045662/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol=/usr/local/src/conda-prefix -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/Users/myusername/anaconda3/envs/work/conda-bld/r-dbarts_1543961045662/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/myusername/anaconda3/envs/work/conda-bld/r-dbarts_1543961045662/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib -L/Users/myusername/anaconda3/envs/work/conda-bld/r-dbarts_1543961045662/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib conftest.c >&5
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
ld: dynamic main executables must link with libSystem.dylib for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
It seems it's a problem about Conda build using the certain version of Apple C compiler. My guess is that I need to customize the C compiler for conda build. So my question becomes
What correct gcc version do I need.
How to set it for conda build.
As a quick and dirty workaround (from this comment), I was able to install packages in R using below code in RStudio (opened in conda env)
Sys.setenv(CONDA_BUILD_SYSROOT="/")
Now, you can install any R package via RStudio Console e.g.
install.packages("tidyverse")
Hope this helps.
There are several things you must do to get things building properly in MacOS Mojave. For reasons mysterious to me, the Anaconda folks are not keen to make this smooth, which is especially maddening for those of us who use esoteric R packages. I will write what seems current as of 2019-04-20:
1. Install Xcode (v10.2.1)
2. Install headers in the place open source tends to expect finding them. From the command line:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
3. Install the command-line tools
As a belt-and braces approach, I downloaded and installed the DMG Command_Line_Tools_macOS_10.14_for_Xcode_10.2.1 from https://developer.apple.com/download/more/
I believe this is also what is done by xcode-select --install. If you run that command (once the tools are installed), you should see the message
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
4. Download a copy of older MacOS SDK files. For example, from here
5. Create a directory /opt
sudo mkdir /opt
6. Copy the SDK files there
sudo cp -r ~/Downloads/MacOSX10.9.sdk /opt/
sudo chmod -R a+rX /opt
7. Create a conda_build_config.yaml file that will be referenced by Conda-build and related software. It should contain the following
macos_min_version:
- 10.9
macos_machine:
- x86_64-apple-darwin13.4.0
MACOSX_DEPLOYMENT_TARGET:
- 10.9
CONDA_BUILD_SYSROOT: # [osx]
- /opt/MacOSX10.9.sdk # [osx]
In a terminal you can do that with:
mkdir ~/.conda || echo 'Dir already present'
echo "macos_min_version:" >> ~/.conda/conda_build_config.yaml
echo " - 10.9" >> ~/.conda/conda_build_config.yaml
echo "macos_machine:" >> ~/.conda/conda_build_config.yaml
echo " - x86_64-apple-darwin13.4.0" >> ~/.conda/conda_build_config.yaml
echo "MACOSX_DEPLOYMENT_TARGET:" >> ~/.conda/conda_build_config.yaml
echo " - 10.9" >> ~/.conda/conda_build_config.yaml
echo "CONDA_BUILD_SYSROOT:" >> ~/.conda/conda_build_config.yaml
echo " - /opt/MacOSX10.9.sdk" >> ~/.conda/conda_build_config.yaml
8. Tell Conda about your YAML file via your .condarc. It should contain the lines:
conda_build:
config_file: ~/.conda/conda_build_config.yaml
which can be accomplished using
echo "conda_build:" >> ~/.condarc
echo " config_file: ~/.conda/conda_build_config.yaml" >> ~/.condarc
Rcpp is failing to install for me. When I run the following within the R console (R 2.15.1 on Mac 10.8):
install.packages("Rcpp")
I get the following error:
/usr/bin/clang++ -I/usr/local/Cellar/r/2.15.1/R.framework/Resources/include \
-DNDEBUG -I../inst/include/ -I/usr/local/Cellar/readline/6.2.4/include \
-isystem /usr/local/include -I/opt/X11/include -fPIC -Os -w -pipe - \
march=native -Qunused-arguments -mmacosx-version-min=10.8 \
-c exceptions.cpp -o exceptions.o
exceptions.cpp:82:14: fatal error: 'bits/exception_defines.h' file not found
#include <bits/exception_defines.h>
^
1 error generated.
make: *** [exceptions.o] Error 1
ERROR: compilation failed for package ‘Rcpp’
What am I doing wrong?
Which version of Rcpp? This is fixed in SVN:
2012-07-06 Dirk Eddelbuettel <edd#debian.org>
* inst/include/Rcpp/config.h: In order to not attempt to include
exception_defines.h if on OS X (as the clang runtime may not have
predictable access to g+++ headers providing these), do not define
RCPP_HAS_DEMANGLING which is used in src/exceptions.cpp
and was discussed on the rcpp-devel list.
I tried to accomodate OS X and clang >= 3.0, but the interaction of clang and g++ is a little tricky. Try to fetch the file from SVN or just edit the section in it to yield
#ifdef __GNUC__
// from http://sourceforge.net/apps/mediawiki/predef/index.php?\
// title=Operating_Systems#MacOS
#ifndef __APPLE__
#ifndef __MACH__
#define RCPP_HAS_DEMANGLING
#endif
#endif
#endif
which turns this off for all OS X instances.
I am unable to build sqlcipher on Windows with following these steps.
install Win32 OpenSSL v0.9.8m
install TclTk
rename MINGWPATH/bin/tclsh84.exe to tclsh.exe
cd sqlcipher
$ ./configure --disable-tcl --disable-amalgamation
CFLAGS="-DSQLITE_HAS_CODEC -I../OpenSSL/include /c/Windows/System32/libeay32.dll"
$ make
$ make dll
$ make install
At the link stage, gcc gives this error:
libtool: link: gcc -g -O2 -DSQLITE_OS_WIN=1 -I. -I./src -I./ext/rtree -D_HAVE_SQ
LITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_E
XTENSION=1 -DHAVE_READLINE=0 -o .libs/sqlite3.exe ./src/shell.c ./.libs/libsqli
te3.a -lpthread -L/usr/local/lib
./.libs/libsqlite3.a(func.o): In function `sqlite3RegisterBuiltinFunctions':
c:\sqlcipher/./src/func.c:1439: **undefined reference to `sqlcipher_exportFunc**'
collect2: ld çıkış durumu 1 ile döndü
make: *** [sqlite3.exe] Error 1
You forget to define SQLITE_TEMP_STORE as document has specified.
I can confirm it's working smoothly on Ubuntu 12.04 LTS , with latest source on github:
In short for dynamic linking:
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2" LDFLAGS="-lcrypto"