installing rbenv on mac failure - ruby

I am trying to install rbenv. I tried rbenv install 3.2.0 but I received:
BUILD FAILED (Mac OS X 10.15.7 using ruby-build 20230202)
Inspect or clean up the working tree at /var/folders/yk/clm8vmf15r9cv4hghy2wm6380000gn/T/ruby-build.20230204101926.59465.X5ikLb
Results logged to /var/folders/yk/clm8vmf15r9cv4hghy2wm6380000gn/T/ruby-build.20230204101926.59465.log
Last 10 log lines:
"_strdup", referenced from:
_OSSL_provider_init in p_test-dso-p_test.o
"_strlen", referenced from:
_p_get_params in p_test-dso-p_test.o
ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
x86_64-apple-darwin13.4.0-clang -Iinclude -arch x86_64 -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -D_REENTRANT -DOPENSSL_BUILDING_OPENSSL -DZLIB -DZLIB_SHARED -DNDEBUG -I/Users/shirinvafaei/.rbenv/versions/3.2.0/include -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -MMD -MF test/buildtest_c_blowfish-bin-buildtest_blowfish.d.tmp -MT test/buildtest_c_blowfish-bin-buildtest_blowfish.o -c -o test/buildtest_c_blowfish-bin-buildtest_blowfish.o test/buildtest_blowfish.c
make[1]: *** [test/p_test.dylib] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [build_sw] Error 2
What is wrong that should be solved?
Update:
I tried the following codes from https://github.com/rbenv/ruby-build/issues/1505
sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
$ sudo xcode-select -s /Library/Developer/CommandLineTools
And then rbenv install 3.2.0
I received:
To follow progress, use 'tail -f /var/folders/yk/clm8vmf15r9cv4hghy2wm6380000gn/T/ruby-build.20230204103403.1653.log' or pass --verbose
Downloading openssl-1.1.1s.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa
Installing openssl-1.1.1s...
BUILD FAILED (Mac OS X 10.15.7 using ruby-build 20230202)
Inspect or clean up the working tree at /var/folders/yk/clm8vmf15r9cv4hghy2wm6380000gn/T/ruby-build.20230204103403.1653.L02zPW
Results logged to /var/folders/yk/clm8vmf15r9cv4hghy2wm6380000gn/T/ruby-build.20230204103403.1653.log
Last 10 log lines:
_dgram_write in bss_dgram.o
_fd_write in bss_fd.o
_fd_puts in bss_fd.o
_sock_write in bss_sock.o
_sock_puts in bss_sock.o
(maybe you meant: _UI_method_get_writer, _RAND_write_file , _PEM_write_bio_PKCS7_stream , _PEM_write_X509_AUX , _PEM_write_PrivateKey , _PEM_write_bio_PrivateKey_traditional , _PEM_write_bio_PrivateKey , _PEM_write_PKCS8_PRIV_KEY_INFO , _PEM_write_bio_PKCS8_PRIV_KEY_INFO , _PEM_write_PKCS8PrivateKey , _PEM_write_bio_PKCS8PrivateKey , _PEM_write_bio , _PEM_X509_INFO_write_bio , _PEM_write_bio_PUBKEY , _PEM_write_DHparams , _PEM_write_EC_PUBKEY , _PEM_write_bio_EC_PUBKEY , _PEM_write_bio_ECPKParameters , _PEM_write_DSA_PUBKEY , _PEM_write_bio_RSA_PUBKEY , _PEM_write_RSAPublicKey , _PEM_write_PKCS7 , _PEM_write_bio_PKCS7 , _PEM_write_X509_CRL , _PEM_write_bio_X509_REQ_NEW , _PEM_write_X509_REQ , _PEM_write_bio_X509 , _PEM_write_PKCS8 , _PEM_write_DHxparams , _PEM_write_DSAparams , _PEM_write_ECPKParameters , _PEM_write_bio_RSAPrivateKey , _UI_method_set_writer , _PEM_write_bio_X509_AUX , _PEM_write_ECPrivateKey , _SMIME_write_CMS , _PEM_write_DSAPrivateKey , _PEM_write_X509 , _PEM_write , _PEM_write_bio_DSAPrivateKey , _PEM_write_bio_X509_CRL , _PEM_write_bio_NETSCAPE_CERT_SEQUENCE , _SMIME_write_PKCS7 , _PEM_ASN1_write , _PEM_ASN1_write_bio , _PEM_write_bio_CMS , _CRYPTO_THREAD_write_lock , _PEM_write_bio_DHxparams , _PEM_write_bio_DSAparams , _PEM_write_RSA_PUBKEY , _TXT_DB_write , _PEM_write_PUBKEY , _BIO_meth_set_write_ex , _BIO_meth_set_write , _BIO_meth_get_write , _PEM_write_bio_DSA_PUBKEY , _BIO_write_ex , _PEM_write_bio_X509_REQ , _PEM_write_bio_Parameters , _PEM_write_bio_ECPrivateKey , _PEM_write_bio_PKCS8 , _PEM_write_X509_REQ_NEW , _PEM_write_bio_DHparams , _BIO_ctrl_get_write_guarantee , _BIO_meth_get_write_ex , _PEM_write_bio_PKCS8PrivateKey_nid , _PEM_write_bio_ASN1_stream , _PEM_write_bio_CMS_stream , _BIO_write , _PEM_write_CMS , _PEM_write_RSAPrivateKey , _PEM_write_NETSCAPE_CERT_SEQUENCE , _PEM_write_PKCS8PrivateKey_nid , _SMIME_write_ASN1 , _PEM_write_bio_RSAPublicKey )
ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libcrypto.dylib] Error 1
make: *** [all] Error 2

rbenv install xx installs a ruby version with rbenv. To install rbenv use brew, e.g.
brew install rbenv ruby-build
brew also installs any required dependencies for you.

Related

perl5 macos Regexp::Grammars install dies on B::Hooks::Parser

I am trying to install Damian Conway's cpan Regexp::Grammars on macos. I made sure to install Xcode (gcc, clang), first ran 'capn upgrade' on the macos perl (which is now 5.30.3), and then tried the naive 'install Regexp::Grammars'. Alas,
cpan[2]> install B::Hooks::Parser
Running install for module 'B::Hooks::Parser'
ETHER/B-Hooks-Parser-0.21.tar.gz
Has already been unwrapped into directory /Users/me/.cpan/build/B-Hooks-Parser-0.21-0
ETHER/B-Hooks-Parser-0.21.tar.gz
Has already been prepared
ETHER/B-Hooks-Parser-0.21.tar.gz
Could not make: Unknown error
which appeared after
...many more
cp lib/B/Hooks/Parser.pm blib/lib/B/Hooks/Parser.pm
cp hook_parser.h blib/arch/B/Hooks/Parser/Install/hook_parser.h
Running Mkbootstrap for Parser ()
chmod 644 "Parser.bs"
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Parser.bs blib/arch/auto/B/Hooks/Parser/Parser.bs 644
"/usr/bin/perl" "/System/Library/Perl/5.30/ExtUtils/xsubpp" -typemap '/System/Library/Perl/5.30/ExtUtils/typemap' Parser.xs > Parser.xsc
mv Parser.xsc Parser.c
cc -c -I/System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/B/Hooks/OP/Check/Install -g -pipe -DPERL_USE_SAFE_PUTENV -Wno-error=implicit-function-declaration -Os -DVERSION=\"0.21\" -DXS_VERSION=\"0.21\" -iwithsysroot "/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE" Parser.c
In file included from Parser.xs:16:
./hook_parser.h:5:10: fatal error: 'hook_op_check.h' file not found
#include "hook_op_check.h"
^~~~~~~~~~~~~~~~~
1 error generated.
make: *** [Parser.o] Error 1
ETHER/B-Hooks-Parser-0.21.tar.gz
/usr/bin/make -- NOT OK
... many more
and it failed to install Regexp::Grammars . Regexp::Grammars does seem to install on linux. easy or hard fix?

ERROR: Could not build wheels for pymssql, which is required to install pyproject.toml-based projects In Mac M1

I`m using MacBook with M1 chip and seems like multiple things arent optimised for it.
pyodbc didnt work for me, so I wanted to use pymssql.
Though, I encountered this issue when I tried to run pip install pymssql.
The error is as below.
Using cached pymssql-2.2.2.tar.gz (170 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pymssql
Building wheel for pymssql (pyproject.toml) ... error
ERROR: Command errored out with exit status 1:
Your project path and someinfo about it.
Complete output (25 lines):
setup.py: platform.system() => Darwin
setup.py: platform.architecture() => ('64bit', '')
setup.py: platform.libc_ver() => ('', '')
setup.py: include_dirs => []
setup.py: library_dirs => []
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-3.9
creating build/lib.macosx-10.9-universal2-3.9/pymssql
copying src/pymssql/__init__.py -> build/lib.macosx-10.9-universal2-3.9/pymssql
running build_ext
cythoning src/pymssql/_mssql.pyx to src/pymssql/_mssql.c
cythoning src/pymssql/_pymssql.pyx to src/pymssql/_pymssql.c
building 'pymssql._mssql' extension
creating build/temp.macosx-10.9-universal2-3.9
creating build/temp.macosx-10.9-universal2-3.9/src
creating build/temp.macosx-10.9-universal2-3.9/src/pymssql
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Users/lakshayrohilla/SMS Project Files /cracs-backend/.venv/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/pymssql/_mssql.c -o build/temp.macosx-10.9-universal2-3.9/src/pymssql/_mssql.o -DMSDBLIB
src/pymssql/_mssql.c:682:10: fatal error: 'sqlfront.h' file not found
#include "sqlfront.h"
^~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
**ERROR: Failed building wheel for pymssql**
Failed to build pymssql
**ERROR: Could not build wheels for pymssql, which is required to install pyproject.toml-based projects**
On trying loads of solutions for fixing this issue, Seems like something worked out for me.
I`m providing the code below for solving this issue.
Important Note:
Change the path as per your system.
1. brew install freetds
2. brew install openssl
3. export LDFLAGS="-L/opt/homebrew/Cellar/freetds/1.3.3/lib -L/opt/homebrew/Cellar/openssl#1.1/1.1.1l_1/lib"
4. export CFLAGS="-I/opt/homebrew/Cellar/freetds/1.3.3/include"
5. pip install pymssql
Just run the above commands & it should solve your issue, as it worked out for me.
Running the following commands fixed my issue
$ brew install freetds openssl
$ echo 'export LDFLAGS="-L/opt/homebrew/opt/freetds/lib -L/opt/homebrew/opt/openssl#3/lib"' >> ~/.zshrc
$ echo 'export CFLAGS="-I/opt/homebrew/opt/freetds/include"' >> ~/.zshrc
$ echo 'export CPPFLAGS="-I/opt/homebrew/opt/openssl#3/include"' >> ~/.zshrc
$ source ~/.zshrc
$ pip3 install pymssql

macOS 10.12 brew install openssl issue

Trying to install openssl on homebrew using:
brew install openssl
Is giving the following error during make:
clang -I. -Iinclude -fPIC -arch x86_64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/etc/openssl#1.1\"" -DENGINESDIR="\"/usr/local/Cellar/openssl#1.1/1.1.1l/lib/engines-1.1\"" -D_REENTRANT -DNDEBUG -MMD -MF crypto/rand/randfile.d.tmp -MT crypto/rand/randfile.o -c -o crypto/rand/randfile.o crypto/rand/randfile.c
In file included from crypto/rand/rand_unix.c:38:
/usr/include/CommonCrypto/CommonRandom.h:35:9: error: unknown type name 'CCCryptorStatus'
typedef CCCryptorStatus CCRNGStatus;
^
crypto/rand/rand_unix.c:385:47: error: use of undeclared identifier 'kCCSuccess'
if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess)
^
2 errors generated.
make[1]: *** [crypto/rand/rand_unix.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2
Do not report this issue to Homebrew/brew or Homebrew/core!
Brew is trying to install openssl 1.1.1l:
==> Downloading https://www.openssl.org/source/openssl-1.1.1l.tar.gz
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/b6ccc5a2a602c2af3480bbcf1656bd9844595974ba60501871ac12504508e818--openssl-1.1.1l.tar.gz
I need this dependency to install many other applications/tools, e.g., wget or python - and would like to use homebrew to do this.
The brew version I am using is:
Homebrew 3.2.9
Homebrew/homebrew-core (git revision fa395c6627; last commit 2021-08-27)
Homebrew/homebrew-cask (git revision 606ed52390; last commit 2021-08-27)
macOS is: 10.12.6 (Sierra) and I am using a MacBook Pro (13-inch, Early 2011)
Is there any way I can get around this issue to install openssl? Or anyway I can install python specifying a different openssl to use as a dependency?
I was able to install openssl 1.0 using the following brew command:
brew install rbenv/tap/openssl#1.0
However, python continually tries to use openssl 1.1.1l which is failing with the above error.
I managed to resolve it by editing formula (brew edit openssl)
and adding
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
to args array in configure_args.
As below:
def configure_args
args = %W[
--prefix=#{prefix}
--openssldir=#{openssldir}
no-ssl3
no-ssl3-method
no-zlib
##### add the line here ####
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
]
on_linux do
args += (ENV.cflags || "").split
args += (ENV.cppflags || "").split
args += (ENV.ldflags || "").split
args << "enable-md2"
end
args
end
I had to change the following file on Sierra (MacOs 10.12):
sudo chmod a+w /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/CommonCrypto/CommonRandom.h
vi /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/CommonCrypto/CommonRandom.h
I've added the following line before the typedef statement:
#include "CommonCrypto/CommonCryptoError.h"
And also followed the advice of #Hulkur - run command:
brew edit openssl
and added
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
to args array in configure_args.
Seems a bug of openssl itself. https://github.com/openssl/openssl/issues/16487
~~What about export SDKROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk "?~~
Homebrew pre-build packages for some versions of macOS. But it keep dropping this pre-building support for old macOS. On macOS 10.12, you're building openssl from the source code and Xcode command line tool is needed.
xcode-select --install
Then brew install openssl again.
I had the same issue in Mac Sierra 10.13.6 (17G14042)
brew install openssl#1.1
I have updated the openssl
brew edit openssl
add the line inside def configure_args
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
def configure_args
args = %W[
--prefix=#{prefix}
--openssldir=#{openssldir}
no-ssl3
no-ssl3-method
no-zlib
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
]
Run the below comment after this.
RUBY_CONFIGURE_OPTS="--disable-install-doc --with-openssl-dir=$(brew --prefix openssl#1.1)" rbenv install 3.0.2
First, to edit the file:
$ export EDITOR=nano
$ export VISUAL="$EDITOR"
then
brew edit openssl
After file open add the line
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
# help debug inevitable breakage.
def configure_args
args = %W[
--prefix=#{prefix}
--openssldir=#{openssldir}
no-ssl3
no-ssl3-method
no-zlib
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
]
on_linux do
args += (ENV.cflags || "").split
args += (ENV.cppflags || "").split
args += (ENV.ldflags || "").split
args << "enable-md2"
end
args
end
Save edition and install
brew install openssl
Notice: the installation took a long time, but it's worked.
After brew edit openssl, I end up with a new error:
=> perl ./Configure --prefix=/usr/local/Cellar/openssl#1.1/1.1.1l --openssldir=/usr/local/etc/openssl#1.1 no-ssl3 no-ssl3-method no-zlib -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include darwin64-x86_64-cc enable-ec_nistp_64_gcc_128
==> make
Last 15 lines from /Users/francis/Library/Logs/Homebrew/openssl#1.1/02.make:
include "CommonCrypto/CommonCryptoError.h"
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/CommonCrypto/CommonRandom.h:35:9: error: expected identifier or '('
include "CommonCrypto/CommonCryptoError.h"
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/CommonCrypto/CommonRandom.h:52:1: error: unknown type name 'CCRNGStatus'
CCRNGStatus CCRandomGenerateBytes(void *bytes, size_t count)
^
crypto/rand/rand_unix.c:385:47: error: use of undeclared identifier 'kCCSuccess'
if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess)
^
4 errors generated.
make[1]: *** [crypto/rand/rand_unix.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2
Edit
Silly me, I had:
include "CommonCrypto/CommonCryptoError.h"
Instead of
#include "CommonCrypto/CommonCryptoError.h"
So make sure you have a hash first.
This issue has now been resolved (since 9/11/2021) and patches are no longer required
For MacOS prior to 10.12 (e.g. 10.11 El Capitan) there is another issue - test failure:
Test Summary Report
-------------------
../test/recipes/05-test_rand.t (Wstat: 256 Tests: 2 Failed: 1)
Failed test: 1
Non-zero exit status: 1
Files=1, Tests=2, 5 wallclock secs ( 0.38 usr 0.06 sys + 5.71 cusr 2.48 csys = 8.63 CPU)
Result: FAIL
make[1]: *** [_tests] Error 1
make: *** [tests] Error 2
There is an issue and a pull request for OpenSSL that is open to fix this:
https://github.com/openssl/openssl/issues/16517
https://github.com/openssl/openssl/pull/16587
If you have this issue go over and vote for them

Error installing devtools, dplyr,ggplot2 on R-devel 3.4.0 on Windows

I will submitting my package to CRAN. I have already built with R 3.2.4 and I now am trying to build on R-devel 3.4.0 before submitting to CRAN as required. I am having problems installing packages. I have installed Rtools33.exe for Windows. But I get an errors when installing the following packages - devtools, dplyr, ggplot2 etc. Here are the errors for devtools
> install.packages("devtools")
also installing the dependencies ‘mime’, ‘openssl’, ‘httr’, ‘memoise’, ‘digest’, ‘jsonlite’, ‘git2r’
* installing *source* package 'mime' ...
** package 'mime' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
d:/Compiler/gcc-4.9.3/mingw_32/bin/gcc -I"C:/software/R/R- DEVE~1/include" -DNDEBUG -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -Wall -std=gnu99 -mtune=core2 -c rawmatch.c -o rawmatch.o
d:/Compiler/gcc-4.9.3/mingw_32/bin/gcc: not found
make: *** [rawmatch.o] Error 127
Warning: running command 'make -f "C:/software/R/R-DEVE~1/etc/i386/Makeconf" -f "C:/software/R/R-DEVE~1/share/make/winshlib.mk" SHLIB="mime.dll" OBJECTS="rawmatch.o"' had status 2
ERROR: compilation failed for package 'mime'
* removing 'C:/software/R/R-devel-Mar30/library/mime'
Warning in install.packages :
running command '"C:/software/R/R-DEVE~1/bin/x64/R" CMD INSTALL -l "C:\software\R\R-devel-Mar30\library" C:\Users\Ganesh\AppData\Local\Temp\Rtmpq4DzNw/downloaded_packages/mime_0.4.tar.gz' had status 1
Warning in install.packages :
installation of package ‘mime’ had non-zero exit status
* installing *source* package 'openssl' ...
** package 'openssl' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
"C:/software/R/R-DEVE~1/bin/i386/Rscript.exe" "../tools/winlibs.R"
d:/Compiler/gcc-4.9.3/mingw_32/bin/gcc -I"C:/software/R/R-DEVE~1/include" -DNDEBUG -I../windows/openssl-1.0.2d/include -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -Wall -std=gnu99 -mtune=core2 -c win32/ipv6.c -o win32/ipv6.o
d:/Compiler/gcc-4.9.3/mingw_32/bin/gcc: not found
make: *** [win32/ipv6.o] Error 127
Warning: running command 'make -f "Makevars.win" -f "C:/software/R/R- DEVE~1/etc/i386/Makeconf" -f "C:/software/R/R-DEVE~1/share/make/winshlib.mk" SHLIB="openssl.dll" OBJECTS="aes.o base64.o bignum.o cert.o envelope.o error.o hash.o info.o keygen.o onload.o openssh.o rand.o read.o rsa.o signing.o ssl.o stream.o write.o"' had status 2
ERROR: compilation failed for package 'openssl'
* removing 'C:/software/R/R-devel-Mar30/library/openssl'
Warning in install.packages :
running command '"C:/software/R/R-DEVE~1/bin/x64/R" CMD INSTALL -l "C:\software\R\R-devel-Mar30\library" C:\Users\Ganesh\AppData\Local\Temp\Rtmpq4DzNw/downloaded_packages/openssl_0.9.2.tar.gz' had status 1
Warning in install.packages :
installation of package ‘openssl’ had non-zero exit status
* installing *source* package 'digest' ...
** package 'digest' successfully unpacked and MD5 sums checked
** libs
Similar errors regarding gcc occurs. Please let me know what needs to be done
Since R 3.4.0 is still in early development stages the errors are expected. This is the response I got from CRAN. As of now we need to build on a more stable R 3.3.0

Mex function with OS X 10.9.5 and Xcode 6.2?

I'm using Matlab Coder in Matlab-r2014b in OS X 10.9.5. I have Xcode 6.2. I'm unable to generate a Mex function using Matlab compiler. I'm reporting here a sample code with structure and type of variables similar to my real one.
1) The script that calls the entry-point
clear all
N=3 ;
Res=alg(N);
2) The entry-point
function val=alg(N)
profindex=randi(N+1,2^(N-1),1);
for s=1:10
coder.varsize('matrix');
matrix=zeros(1,3*N+2);
for k=1:2^(N-1)
if profindex(k)==N-1
matrix=[matrix; randi(1,1,3*N+2)];
end
end
if size(matrix,1)>1
matrix(1,:)=[];
end
for k=1:size(matrix,1)
for h=1:size(matrixfinal,1)
if sum(matrix(k,2+2*N:3*N)==matrixfinal(h,2+2*N:3*N))==N-1
matrixfinal(h,3*N+1)=matrixfinal(h,3*N+1)+matrix(k,3*N+1);
matrixfinal(h,3*N+2)=matrixfinal(h,3*N+2)+matrix(k,3*N+2);
end
end
end
end
if size(matrixfinal,1)>1
matrixfinal(1,:)=[];
end
val=matrixfinal(1,1);
end
When I try to built the Mex Function I get the following error
??? Build error: Compilation returned error status code 2. See the
target build log in the report for further details.
Error in ==> alg Line: 1 Column: 1 Code generation failed: Open error report.
If I open error report, It reads
1 xcrun -sdk macosx10.7 clang -c -fno-common -arch x86_64
-isysroot -mmacosx-version-min=10.7 -fexceptions -DMX_COMPAT_32 -O2 -DNDEBUG -I ".... 2 xcodebuild: error: SDK "macosx10.7" cannot be located. 3 xcrun: error: unable to find utility "clang", not a
developer tool or in PATH 4 gmake: *** [alg_mexutil.o] Error 72
I found these instructions but they are for 10.8 and if I replace 10.8 with 10.9.5 it does not work and I get always the same errors and in the following order
SDK "macosx10.7" cannot be located
SDK "macosx10.8" cannot be located
SDK "macosx10.9.5" cannot be located.
How to fix these errors?

Resources