Matlab MEX slowdown without code change - performance

I have been developing a bit of code for the last few weeks. The Code is wrapped within a MEX file in MATLAB. Until yesterday my usual test took about 1 second. Suddenly after recompiling the code without changing anything, the same code takes more than 4 seconds.
The only changes happened in a function totally unrelated to the function I am calling. It seems as all compiler optimization has vanished from one second to the other.
Maybe one of you experienced similar happenings in the past and knows how to deal with that?
Thank you for your suggestions.
Edit 1:
As I assume it is something compiler dependent, here the output of the compilation command (using verbose mode)
----------------------------------------------------------------
-> MATLAB = /Applications/MATLAB_R2010b.app
-> CC = gcc-4.0
-> CC flags:
CFLAGS = -fno-common -no-cpp-precomp -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -fexceptions
CDEBUGFLAGS = -g
COPTIMFLAGS = -O2 -DNDEBUG
CLIBS = -L/Applications/MATLAB_R2010b.app/bin/maci64 -lmx -lmex -lmat -lstdc++
arguments = -DMX_COMPAT_32
-> CXX = g++-4.0
-> CXX flags:
CXXFLAGS = -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O2 -DNDEBUG
CXXLIBS = -L/Applications/MATLAB_R2010b.app/bin/maci64 -lmx -lmex -lmat -lstdc++
arguments = -DMX_COMPAT_32
-> FC = gfortran
-> FC flags:
FFLAGS = -fexceptions -m64 -fbackslash
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -L/Applications/MATLAB_R2010b.app/bin/maci64 -lmx -lmex -lmat -L -lgfortran -L -lgfortranbegin
arguments = -DMX_COMPAT_32
-> LD = gcc-4.0
-> Link flags:
LDFLAGS = -Wl,-twolevel_namespace -undefined error -arch x86_64 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -bundle -Wl,-exported_symbols_list,/Applications/MATLAB_R2010b.app/extern/lib/maci64/mexFunction.map
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexmaci64
arguments = /usr/lib/libarmadillo.dylib /usr/lib/liblapack.dylib /usr/lib/libblas.dylib
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments = /usr/lib/libarmadillo.dylib /usr/lib/liblapack.dylib /usr/lib/libblas.dylib
----------------------------------------------------------------
-> g++-4.0 -c -I/usr/include -I/Applications/MATLAB_R2010b.app/extern/include -I/Applications/MATLAB_R2010b.app/simulink/include -DMATLAB_MEX_FILE -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -DMX_COMPAT_32 -O2 -DNDEBUG "file1.cpp"
-> g++-4.0 -c -I/usr/include -I/Applications/MATLAB_R2010b.app/extern/include -I/Applications/MATLAB_R2010b.app/simulink/include -DMATLAB_MEX_FILE -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -DMX_COMPAT_32 -O2 -DNDEBUG "file2.cpp"
-> g++-4.0 -c -I/usr/include -I/Applications/MATLAB_R2010b.app/extern/include -I/Applications/MATLAB_R2010b.app/simulink/include -DMATLAB_MEX_FILE -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -DMX_COMPAT_32 -O2 -DNDEBUG "file3.cpp"
-> gcc-4.0 -O -Wl,-twolevel_namespace -undefined error -arch x86_64 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -bundle -Wl,-exported_symbols_list,/Applications/MATLAB_R2010b.app/extern/lib/maci64/mexFunction.map -o "distanceSplinePoint.mexmaci64" file1.o file2.o file3.o /usr/lib/libarmadillo.dylib /usr/lib/liblapack.dylib /usr/lib/libblas.dylib -L/Applications/MATLAB_R2010b.app/bin/maci64 -lmx -lmex -lmat -lstdc++

As it sometimes is with asking questions: You can spend hours searching for the answer, but once you decided to ask somebody for help you miraculously get the answer in your head.
Clearing the MATLAB-Workspace solved all my problems...
Still, thanks for reading ;)

Related

psycopg2 error with M1 Mac (Rosetta terminal)

I am trying to setup my project dependencies with my M1 Macbook.
First step : I tried to run pip3 install -r requirements.txt (using bash - ARM64) and got the below error with a particular package.
ERROR: Could not find a version that satisfies the requirement higra>=0.6.2 (from versions: none)
After some research, I got to know that the higra package is not yet supported with ARM architecture. As a workaround, I was told to run the pip3 install -r requirements.txt with rosetta terminal (x86_64 architecture).
Second step: I run the pip3 install with rosetta. I did not get the error from the first step (That package got installed successfully). However, I now get the below error
Running setup.py install for psycopg2 ... error
error: subprocess-exited-with-error
× Running setup.py install for psycopg2 did not run successfully.
│ exit code: 1
╰─> [237 lines of output]
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-3.8
creating build/lib.macosx-10.14-x86_64-3.8/psycopg2
copying lib/_json.py -> build/lib.macosx-10.14-x86_64-3.8/psycopg2
copying lib/extras.py -> build/lib.macosx-10.14-x86_64-3.8/psycopg2
copying lib/errorcodes.py -> build/lib.macosx-10.14-x86_64-3.8/psycopg2
copying lib/tz.py -> build/lib.macosx-10.14-x86_64-3.8/psycopg2
copying lib/_range.py -> build/lib.macosx-10.14-x86_64-3.8/psycopg2
copying lib/_ipaddress.py -> build/lib.macosx-10.14-x86_64-3.8/psycopg2
copying lib/__init__.py -> build/lib.macosx-10.14-x86_64-3.8/psycopg2
copying lib/extensions.py -> build/lib.macosx-10.14-x86_64-3.8/psycopg2
copying lib/errors.py -> build/lib.macosx-10.14-x86_64-3.8/psycopg2
copying lib/sql.py -> build/lib.macosx-10.14-x86_64-3.8/psycopg2
copying lib/pool.py -> build/lib.macosx-10.14-x86_64-3.8/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.macosx-10.14-x86_64-3.8
creating build/temp.macosx-10.14-x86_64-3.8/psycopg
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/psycopgmodule.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/green.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/green.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/pqpath.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/pqpath.o
psycopg/pqpath.c:139:17: warning: implicit conversion from enumeration type 'ConnStatusType' to different enumeration type 'ExecStatusType' [-Wenum-conversion]
PQstatus(conn->pgconn) : PQresultStatus(*pgres)));
^~~~~~~~~~~~~~~~~~~~~~
psycopg/pqpath.c:1723:11: warning: code will never be executed [-Wunreachable-code]
ret = 1;
^
psycopg/pqpath.c:1828:17: warning: implicit conversion from enumeration type 'ConnStatusType' to different enumeration type 'ExecStatusType' [-Wenum-conversion]
PQstatus(curs->conn->pgconn) : PQresultStatus(curs->pgres)));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
psycopg/pqpath.c:139:17: warning: implicit conversion from enumeration type 'ConnStatusType' to different enumeration type 'ExecStatusType' [-Wenum-conversion]
PQstatus(conn->pgconn) : PQresultStatus(*pgres)));
^~~~~~~~~~~~~~~~~~~~~~
psycopg/pqpath.c:1723:11: warning: code will never be executed [-Wunreachable-code]
ret = 1;
^
psycopg/pqpath.c:1828:17: warning: implicit conversion from enumeration type 'ConnStatusType' to different enumeration type 'ExecStatusType' [-Wenum-conversion]
PQstatus(curs->conn->pgconn) : PQresultStatus(curs->pgres)));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/utils.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/utils.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/bytes_format.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/bytes_format.o
In file included from psycopg/bytes_format.c:82:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:69:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...)
^
1 warning generated.
In file included from psycopg/bytes_format.c:82:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:69:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...)
^
1 warning generated.
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/libpq_support.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/libpq_support.o
In file included from psycopg/libpq_support.c:30:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:69:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...)
^
1 warning generated.
In file included from psycopg/libpq_support.c:30:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:69:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...)
^
1 warning generated.
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/win32_support.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/win32_support.o
In file included from psycopg/win32_support.c:28:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:69:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...)
^
1 warning generated.
In file included from psycopg/win32_support.c:28:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:69:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...)
^
1 warning generated.
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/solaris_support.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/solaris_support.o
In file included from psycopg/solaris_support.c:29:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:69:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...)
^
1 warning generated.
In file included from psycopg/solaris_support.c:29:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:69:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...)
^
1 warning generated.
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/aix_support.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/aix_support.o
In file included from psycopg/aix_support.c:29:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:69:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...)
^
1 warning generated.
In file included from psycopg/aix_support.c:29:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:69:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...)
^
1 warning generated.
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/connection_int.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/connection_int.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/connection_type.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/connection_type.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/cursor_int.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/cursor_int.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/cursor_type.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/cursor_type.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/column_type.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/column_type.o
In file included from psycopg/column_type.c:28:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:69:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...)
^
1 warning generated.
In file included from psycopg/column_type.c:28:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:69:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...)
^
1 warning generated.
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/replication_connection_type.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/replication_connection_type.o
In file included from psycopg/replication_connection_type.c:28:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:69:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...)
^
1 warning generated.
In file included from psycopg/replication_connection_type.c:28:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:69:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...)
^
1 warning generated.
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/replication_cursor_type.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/replication_cursor_type.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/replication_message_type.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/replication_message_type.o
In file included from psycopg/replication_message_type.c:28:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:69:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...)
^
1 warning generated.
....
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140002 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Users/I323017/Documents/GitHub/rec-id-service/rec-id-python/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I. -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include/postgresql/server -c psycopg/typecast.c -o build/temp.macosx-10.14-x86_64-3.8/psycopg/typecast.o
clang -bundle -undefined dynamic_lookup -arch arm64 -arch x86_64 -Wl,-headerpad,0x1000 build/temp.macosx-10.14-x86_64-3.8/psycopg/psycopgmodule.o build/temp.macosx-10.14-x86_64-3.8/psycopg/green.o build/temp.macosx-10.14-x86_64-3.8/psycopg/pqpath.o build/temp.macosx-10.14-x86_64-3.8/psycopg/utils.o build/temp.macosx-10.14-x86_64-3.8/psycopg/bytes_format.o build/temp.macosx-10.14-x86_64-3.8/psycopg/libpq_support.o build/temp.macosx-10.14-x86_64-3.8/psycopg/win32_support.o build/temp.macosx-10.14-x86_64-3.8/psycopg/solaris_support.o build/temp.macosx-10.14-x86_64-3.8/psycopg/aix_support.o build/temp.macosx-10.14-x86_64-3.8/psycopg/connection_int.o build/temp.macosx-10.14-x86_64-3.8/psycopg/connection_type.o build/temp.macosx-10.14-x86_64-3.8/psycopg/cursor_int.o build/temp.macosx-10.14-x86_64-3.8/psycopg/cursor_type.o build/temp.macosx-10.14-x86_64-3.8/psycopg/column_type.o build/temp.macosx-10.14-x86_64-3.8/psycopg/replication_connection_type.o build/temp.macosx-10.14-x86_64-3.8/psycopg/replication_cursor_type.o build/temp.macosx-10.14-x86_64-3.8/psycopg/replication_message_type.o build/temp.macosx-10.14-x86_64-3.8/psycopg/diagnostics_type.o build/temp.macosx-10.14-x86_64-3.8/psycopg/error_type.o build/temp.macosx-10.14-x86_64-3.8/psycopg/conninfo_type.o build/temp.macosx-10.14-x86_64-3.8/psycopg/lobject_int.o build/temp.macosx-10.14-x86_64-3.8/psycopg/lobject_type.o build/temp.macosx-10.14-x86_64-3.8/psycopg/notify_type.o build/temp.macosx-10.14-x86_64-3.8/psycopg/xid_type.o build/temp.macosx-10.14-x86_64-3.8/psycopg/adapter_asis.o build/temp.macosx-10.14-x86_64-3.8/psycopg/adapter_binary.o build/temp.macosx-10.14-x86_64-3.8/psycopg/adapter_datetime.o build/temp.macosx-10.14-x86_64-3.8/psycopg/adapter_list.o build/temp.macosx-10.14-x86_64-3.8/psycopg/adapter_pboolean.o build/temp.macosx-10.14-x86_64-3.8/psycopg/adapter_pdecimal.o build/temp.macosx-10.14-x86_64-3.8/psycopg/adapter_pint.o build/temp.macosx-10.14-x86_64-3.8/psycopg/adapter_pfloat.o build/temp.macosx-10.14-x86_64-3.8/psycopg/adapter_qstring.o build/temp.macosx-10.14-x86_64-3.8/psycopg/microprotocols.o build/temp.macosx-10.14-x86_64-3.8/psycopg/microprotocols_proto.o build/temp.macosx-10.14-x86_64-3.8/psycopg/typecast.o -L/opt/homebrew/opt/libpq/lib -lpq -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.8/psycopg2/_psycopg.cpython-38-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> psycopg2
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I don't see an option to go back to bash (ARM) as the packages are not supported there. Could anyone please help me to solve this issue with Rosetta (x86_64)?

meson setting proper kinker flag in static library

in my project I need to compile a static library, the meson.build for it is the following
# libcustomLog library project.
#
project(
'customLog',
'c',
version : '1.0.0',
default_options : ['warning_level=3']
)
project_description = 'An example shared library'
project_headers = [
'libcustomLog.h'
]
project_source_files = [
'libcustomLog.c',
'libcustomLogGet.c',
'libcustomLogStripe.c'
]
build_args = [
]
# ===================================================================
# ======
# Target
# ======
public_headers = include_directories('../',
'../public'
)
build_args = [
'-DQNXNTO',
'-DQNX_VER=7',
'-DfwPLATFORM_NTO',
'-Wall',
'-Werror',
'-fsigned-char',
'-Wno-char-subscripts',
'-Wno-switch',
'-Wno-parentheses',
'-Wno-pointer-sign',
'-Wredundant-decls',
'-Wmissing-declarations',
'-Wmissing-prototypes',
'-O3',
'-fno-strict-aliasing',
'-std=gnu99',
'-g',
]
project_target = static_library(
meson.project_name(),
project_source_files,
install : true,
c_args : build_args,
gnu_symbol_visibility : 'hidden',
include_directories : public_headers,
)
# =======
# Project
# =======
# Make this library usable as a Meson subproject.
project_dep = declare_dependency(
include_directories: public_headers,
link_with : project_target
)
set_variable(meson.project_name() + '_dep', project_dep)
# Make this library usable from the system's
# package manager.
install_headers(project_headers, subdir : meson.project_name())
pkg_mod = import('pkgconfig')
pkg_mod.generate(
name : meson.project_name(),
filebase : meson.project_name(),
description : project_description,
subdirs : meson.project_name(),
libraries : project_target,
)
the compilation output is
$ meson compile --verbose
Found runner: ['/usr/bin/ninja']
ninja: Entering directory `.'
[1/4] /opt/qnx700/host/linux/x86_64/usr/bin/ntox86_64-gcc -Isrc/mon/libcustomLog.a.p -Isrc/mon -I../../src/mon -Isrc -I../../src -I../../src/public -fvisibility=hidden -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -fPIC -DQNXNTO -DQNX_VER=7 -DfwPLATFORM_NTO -Wall -Werror -fsigned-char -Wno-char-subscripts -Wno-switch -Wno-parentheses -Wno-pointer-sign -Wredundant-decls -Wmissing-declarations -Wmissing-prototypes -O3 -fno-strict-aliasing -std=gnu99 -g -MD -MQ src/mon/libcustomLog.a.p/libcustomLogStripe.c.o -MF src/mon/libcustomLog.a.p/libcustomLogStripe.c.o.d -o src/mon/libcustomLog.a.p/libcustomLogStripe.c.o -c ../../src/mon/libcustomLogStripe.c
[2/4] /opt/qnx700/host/linux/x86_64/usr/bin/ntox86_64-gcc -Isrc/mon/libcustomLog.a.p -Isrc/mon -I../../src/mon -Isrc -I../../src -I../../src/public -fvisibility=hidden -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -fPIC -DQNXNTO -DQNX_VER=7 -DfwPLATFORM_NTO -Wall -Werror -fsigned-char -Wno-char-subscripts -Wno-switch -Wno-parentheses -Wno-pointer-sign -Wredundant-decls -Wmissing-declarations -Wmissing-prototypes -O3 -fno-strict-aliasing -std=gnu99 -g -MD -MQ src/mon/libcustomLog.a.p/libcustomLogGetCode.c.o -MF src/mon/libcustomLog.a.p/libcustomLogGetCode.c.o.d -o src/mon/libcustomLog.a.p/libcustomLogGetCode.c.o -c ../../src/mon/libcustomLogGetCode.c
[3/4] /opt/qnx700/host/linux/x86_64/usr/bin/ntox86_64-gcc -Isrc/mon/libcustomLog.a.p -Isrc/mon -I../../src/mon -Isrc -I../../src -I../../src/public -fvisibility=hidden -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -fPIC -DQNXNTO -DQNX_VER=7 -DfwPLATFORM_NTO -Wall -Werror -fsigned-char -Wno-char-subscripts -Wno-switch -Wno-parentheses -Wno-pointer-sign -Wredundant-decls -Wmissing-declarations -Wmissing-prototypes -O3 -fno-strict-aliasing -std=gnu99 -g -MD -MQ src/mon/libcustomLog.a.p/libcustomLog.c.o -MF src/mon/libcustomLog.a.p/libcustomLog.c.o.d -o src/mon/libcustomLog.a.p/libcustomLog.c.o -c ../../src/mon/libcustomLog.c
[4/4] rm -f src/mon/libcustomLog.a && /opt/qnx700/host/linux/x86_64/usr/bin/ntox86_64-ar csrD src/mon/libcustomLog.a src/mon/libcustomLog.a.p/libcustomLog.c.o src/mon/libcustomLog.a.p/libcustomLogGetCode.c.o src/mon/libcustomLog.a.p/libcustomLogStripe.c.o
now I would change the archive flags
...ntox86_64-ar csrD .....
in
...ntox86_64-ar -ru .....
how can I ovverride the default ones and add the "-ru"
I've tried to modify the meson.build
build_ar_args = [
'-ru'
]
project_target = static_library(
meson.project_name(),
project_source_files,
install : true,
c_args : build_args,
gnu_symbol_visibility : 'hidden',
include_directories : public_headers,
link_args: build_ar_args
)
but the output is the same.

Error using mex Undefined symbols for architecture x86_64

Hello I'm trying to compile a code in c using mex command in a Mac 10.12.3 Sierra:
mex -v foldin.c -lmwlapack -lmwblas
However, I 've obtained in the vervose mode the next error:
Verbose mode is on.
Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require the use of
-largeArrayDims and remove the -compatibleArrayDims option.
For more information:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
... Looking for compiler 'Xcode with Clang' ...
... Looking for environment variable 'DEVELOPER_DIR' ...No.
... Executing command 'xcode-select -print-path' ...Yes ('/Applications/Xcode.app/Contents/Developer').
... Looking for folder '/Applications/Xcode.app/Contents/Developer' ...Yes.
... Executing command 'which xcrun' ...Yes ('/usr/bin/xcrun').
... Looking for folder '/usr/bin' ...Yes.
... Executing command 'defaults read com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense' ...No.
... Executing command 'defaults read /Library/Preferences/com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense' ...Yes ('8.2.1').
... Executing command '
agreed=8.2.1
if echo $agreed | grep -E '[\.\"]' >/dev/null; then
lhs=`expr "$agreed" : '\([0-9]*\)[\.].*'`
rhs=`expr "$agreed" : '[0-9]*[\.]\(.*\)$'`
if echo $rhs | grep -E '[\."]' >/dev/null; then
rhs=`expr "$rhs" : '\([0-9]*\)[\.].*'`
fi
if [ $lhs -gt 4 ] || ( [ $lhs -eq 4 ] && [ $rhs -ge 3 ] ); then
echo $agreed
else
exit 1
fi
fi' ...Yes ('8.2.1').
... Executing command 'xcode-select -print-path' ...Yes ('/Applications/Xcode.app/Contents/Developer').
... Looking for folder '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk' ...Yes.
... Executing command 'xcode-select -print-path' ...Yes ('/Applications/Xcode.app/Contents/Developer').
... Looking for folder '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk' ...Yes.
... Executing command 'echo /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk | rev | cut -c1-10 | rev | egrep -oh '[0-9]+\.[0-9]+'' ...Yes ('10.12').
Found installed compiler 'Xcode with Clang'.
Options file details
-------------------------------------------------------------------
Compiler location: /Applications/Xcode.app/Contents/Developer
Options file: /Applications/MATLAB_R2016b.app/bin/maci64/mexopts/clang_maci64.xml
CMDLINE200 : /usr/bin/xcrun -sdk macosx10.12 clang -Wl,-twolevel_namespace -undefined error -arch x86_64 -mmacosx-version-min=10.9 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -bundle -Wl,-exported_symbols_list,"/Applications/MATLAB_R2016b.app/extern/lib/maci64/mexFunction.map" /var/folders/1s/1bkm1bj15jd090r2jxl5t0gw0000gn/T/mex_9034902856557_5843/foldin.o /var/folders/1s/1bkm1bj15jd090r2jxl5t0gw0000gn/T/mex_9034902856557_5843/c_mexapi_version.o -O -Wl,-exported_symbols_list,"/Applications/MATLAB_R2016b.app/extern/lib/maci64/c_exportsmexfileversion.map" -lmwlapack -lmwblas -L"/Applications/MATLAB_R2016b.app/bin/maci64" -lmx -lmex -lmat -lc++ -o foldin.mexmaci64
CC : /usr/bin/xcrun -sdk macosx10.12 clang
DEFINES : -DMX_COMPAT_32 -DMATLAB_MEX_FILE
MATLABMEX : -DMATLAB_MEX_FILE
MACOSX_DEPLOYMENT_TARGET : 10.9
CFLAGS : -fno-common -arch x86_64 -mmacosx-version-min=10.9 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
INCLUDE : -I"/Applications/MATLAB_R2016b.app/extern/include" -I"/Applications/MATLAB_R2016b.app/simulink/include"
COPTIMFLAGS : -O2 -fwrapv -DNDEBUG
CDEBUGFLAGS : -g
LD : /usr/bin/xcrun -sdk macosx10.12 clang
LDFLAGS : -Wl,-twolevel_namespace -undefined error -arch x86_64 -mmacosx-version-min=10.9 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -bundle -Wl,-exported_symbols_list,"/Applications/MATLAB_R2016b.app/extern/lib/maci64/mexFunction.map"
LDBUNDLE : -bundle
FUNCTIONMAP : "/Applications/MATLAB_R2016b.app/extern/lib/maci64/mexFunction.map"
VERSIONMAP : "/Applications/MATLAB_R2016b.app/extern/lib/maci64/c_exportsmexfileversion.map"
LINKEXPORT : -Wl,-exported_symbols_list,"/Applications/MATLAB_R2016b.app/extern/lib/maci64/mexFunction.map"
LINKEXPORTVER : -Wl,-exported_symbols_list,"/Applications/MATLAB_R2016b.app/extern/lib/maci64/c_exportsmexfileversion.map"
LINKLIBS : -lmwlapack -lmwblas -L"/Applications/MATLAB_R2016b.app/bin/maci64" -lmx -lmex -lmat -lc++
LDOPTIMFLAGS : -O
LDDEBUGFLAGS : -g
OBJEXT : .o
LDEXT : .mexmaci64
SETENV : CC="/usr/bin/xcrun -sdk macosx10.12 clang"
CXX="/usr/bin/xcrun -sdk macosx10.12 clang"
CFLAGS="-fno-common -arch x86_64 -mmacosx-version-min=10.9 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -DMX_COMPAT_32 -DMATLAB_MEX_FILE"
CXXFLAGS="-fno-common -arch x86_64 -mmacosx-version-min=10.9 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -DMX_COMPAT_32 -DMATLAB_MEX_FILE"
COPTIMFLAGS="-O2 -fwrapv -DNDEBUG"
CXXOPTIMFLAGS="-O2 -fwrapv -DNDEBUG"
CDEBUGFLAGS="-g"
CXXDEBUGFLAGS="-g"
LD="/usr/bin/xcrun -sdk macosx10.12 clang"
LDXX="/usr/bin/xcrun -sdk macosx10.12 clang"
LDFLAGS="-Wl,-twolevel_namespace -undefined error -arch x86_64 -mmacosx-version-min=10.9 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -bundle -Wl,-exported_symbols_list,"/Applications/MATLAB_R2016b.app/extern/lib/maci64/mexFunction.map" -lmwlapack -lmwblas -L"/Applications/MATLAB_R2016b.app/bin/maci64" -lmx -lmex -lmat -lc++ -Wl,-exported_symbols_list,"/Applications/MATLAB_R2016b.app/extern/lib/maci64/mexFunction.map""
LDDEBUGFLAGS="-g"
DEVELOPER_DIR_CHECK :
XCODE_DIR : /Applications/Xcode.app/Contents/Developer
XCRUN_DIR : /usr/bin
XCODE_AGREED_VERSION : 8.2.1
ISYSROOT : /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
SDKVER : 10.12
MATLABROOT : /Applications/MATLAB_R2016b.app
ARCH : maci64
SRC : /Users/jorge/Documents/Simulaciones/Simulaciones-Estatica/SIMULACION-ESTATICA/foldin.c;/Applications/MATLAB_R2016b.app/extern/version/c_mexapi_version.c
OBJ : /var/folders/1s/1bkm1bj15jd090r2jxl5t0gw0000gn/T/mex_9034902856557_5843/foldin.o;/var/folders/1s/1bkm1bj15jd090r2jxl5t0gw0000gn/T/mex_9034902856557_5843/c_mexapi_version.o
OBJS : /var/folders/1s/1bkm1bj15jd090r2jxl5t0gw0000gn/T/mex_9034902856557_5843/foldin.o /var/folders/1s/1bkm1bj15jd090r2jxl5t0gw0000gn/T/mex_9034902856557_5843/c_mexapi_version.o
SRCROOT : /Users/jorge/Documents/Simulaciones/Simulaciones-Estatica/SIMULACION-ESTATICA/foldin
DEF : /var/folders/1s/1bkm1bj15jd090r2jxl5t0gw0000gn/T/mex_9034902856557_5843/foldin.def
EXP : foldin.exp
LIB : foldin.lib
EXE : foldin.mexmaci64
ILK : foldin.ilk
MANIFEST : foldin.mexmaci64.manifest
TEMPNAME : foldin
EXEDIR :
EXENAME : foldin
OPTIM : -O2 -fwrapv -DNDEBUG
LINKOPTIM : -O
CMDLINE100_0 : /usr/bin/xcrun -sdk macosx10.12 clang -c -DMX_COMPAT_32 -DMATLAB_MEX_FILE -I"/Applications/MATLAB_R2016b.app/extern/include" -I"/Applications/MATLAB_R2016b.app/simulink/include" -fno-common -arch x86_64 -mmacosx-version-min=10.9 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -O2 -fwrapv -DNDEBUG /Users/jorge/Documents/Simulaciones/Simulaciones-Estatica/SIMULACION-ESTATICA/foldin.c -o /var/folders/1s/1bkm1bj15jd090r2jxl5t0gw0000gn/T/mex_9034902856557_5843/foldin.o
CMDLINE100_1 : /usr/bin/xcrun -sdk macosx10.12 clang -c -DMX_COMPAT_32 -DMATLAB_MEX_FILE -I"/Applications/MATLAB_R2016b.app/extern/include" -I"/Applications/MATLAB_R2016b.app/simulink/include" -fno-common -arch x86_64 -mmacosx-version-min=10.9 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -O2 -fwrapv -DNDEBUG /Applications/MATLAB_R2016b.app/extern/version/c_mexapi_version.c -o /var/folders/1s/1bkm1bj15jd090r2jxl5t0gw0000gn/T/mex_9034902856557_5843/c_mexapi_version.o
-------------------------------------------------------------------
Building with 'Xcode with Clang'.
/usr/bin/xcrun -sdk macosx10.12 clang -c -DMX_COMPAT_32 -DMATLAB_MEX_FILE -I"/Applications/MATLAB_R2016b.app/extern/include" -I"/Applications/MATLAB_R2016b.app/simulink/include" -fno-common -arch x86_64 -mmacosx-version-min=10.9 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -O2 -fwrapv -DNDEBUG /Users/jorge/Documents/Simulaciones/Simulaciones-Estatica/SIMULACION-ESTATICA/foldin.c -o /var/folders/1s/1bkm1bj15jd090r2jxl5t0gw0000gn/T/mex_9034902856557_5843/foldin.o
In file included from /Users/jorge/Documents/Simulaciones/Simulaciones-Estatica/SIMULACION-ESTATICA/foldin.c:2:
/Users/jorge/Documents/Simulaciones/Simulaciones-Estatica/SIMULACION-ESTATICA/fold.c:101:6: warning: implicit declaration of function 'dgemm_' is invalid in C99 [-Wimplicit-function-declaration]
DGEMM(&transa, &transb, &i_len, &m_len, &l_len, &alpha,
^
/Users/jorge/Documents/Simulaciones/Simulaciones-Estatica/SIMULACION-ESTATICA/fold.c:84:16: note: expanded from macro 'DGEMM'
# define DGEMM dgemm_
^
/Users/jorge/Documents/Simulaciones/Simulaciones-Estatica/SIMULACION-ESTATICA/fold.c:279:2: warning: implicit declaration of function 'mxErrMsgTxt' is invalid in C99 [-Wimplicit-function-declaration]
mxErrMsgTxt("Sizes of folded indices do not match");
^
2 warnings generated.
/usr/bin/xcrun -sdk macosx10.12 clang -c -DMX_COMPAT_32 -DMATLAB_MEX_FILE -I"/Applications/MATLAB_R2016b.app/extern/include" -I"/Applications/MATLAB_R2016b.app/simulink/include" -fno-common -arch x86_64 -mmacosx-version-min=10.9 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -O2 -fwrapv -DNDEBUG /Applications/MATLAB_R2016b.app/extern/version/c_mexapi_version.c -o /var/folders/1s/1bkm1bj15jd090r2jxl5t0gw0000gn/T/mex_9034902856557_5843/c_mexapi_version.o
/usr/bin/xcrun -sdk macosx10.12 clang -Wl,-twolevel_namespace -undefined error -arch x86_64 -mmacosx-version-min=10.9 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -bundle -Wl,-exported_symbols_list,"/Applications/MATLAB_R2016b.app/extern/lib/maci64/mexFunction.map" /var/folders/1s/1bkm1bj15jd090r2jxl5t0gw0000gn/T/mex_9034902856557_5843/foldin.o /var/folders/1s/1bkm1bj15jd090r2jxl5t0gw0000gn/T/mex_9034902856557_5843/c_mexapi_version.o -O -Wl,-exported_symbols_list,"/Applications/MATLAB_R2016b.app/extern/lib/maci64/c_exportsmexfileversion.map" -lmwlapack -lmwblas -L"/Applications/MATLAB_R2016b.app/bin/maci64" -lmx -lmex -lmat -lc++ -o foldin.mexmaci64
Error using mex
Undefined symbols for architecture x86_64:
"_mxErrMsgTxt", referenced from:
_mexFunction in foldin.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The _mexFunction is the following one:
void
mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
double *ndx1, *ndx1max, *ndx2, *ndx2max;
if (nrhs != 6) {
mexErrMsgTxt("Wrong number of arguments");
}
if (nlhs > 1) {
mexErrMsgTxt("Too many output arguments expected");
}
ndx1 = mxGetPr(prhs[2]);
if (mxGetNumberOfElements(prhs[2]) > 1) {
ndx1max = ndx1 + 1;
} else {
ndx1max = ndx1;
}
ndx2 = mxGetPr(prhs[5]);
if (mxGetNumberOfElements(prhs[5]) > 1) {
ndx2max = ndx2 + 1;
} else {
ndx2max = ndx2;
}
plhs[0] = fold(prhs[0], mxGetScalar(prhs[1]), *ndx1, *ndx1max,
prhs[3], mxGetScalar(prhs[4]), *ndx2, *ndx2max);
}
The problem is that the program fold.c is not mine and I don't know if there is a problem with the program itself or I have not use mex command appropriately. On the other hand I'm using Xcode 8 as compiler. Could anyone help me please?
I just had the same problem compiling code that wasn't mine. Just replace the occurences of mxErrMsgTxt("bliblablu") with mexErrMsgIdAndTxt("xxx","bliblablu").
(see https://www.mathworks.com/help/matlab/apiref/mexerrmsgtxt.html eg. https://www.mathworks.com/help/matlab/apiref/mexerrmsgidandtxt.html)

Error while Installing ruby2.1.5 from sources on freebsd 7

I am trying to install ruby2.2 in in freebsd 7 i386, but it is throwing below error.
Can someone help how to resolve it
I
# make
CC = /usr/local/bin/gcc48
LD = ld
LDSHARED = /usr/local/bin/gcc48 -shared
CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra
-Wno-unused-parameter -Wno-parentheses
-Wno-long-long -Wno-missing-field-initializers
-Wunused-variable -Wpointer-arith
-Wwrite-strings -Wdeclaration-after-statement
-Wimplicit-function-declaration
-ansi -std=iso9899:199409
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector
-fno-strict-overflow -fvisibility=hidden
-DRUBY_EXPORT -fPIE
CPPFLAGS = -I. -I.ext/include/i386-freebsd7.1 -I./include -I.
DLDFLAGS = -Wl,-soname,showflags -fstack-protector -pie
SOLIBS =
Using built-in specs.
COLLECT_GCC=/usr/local/bin/gcc48
COLLECT_LTO_WRAPPER=
/usr/local/libexec/gcc48/gcc/i386-portbld- freebsd7.1/4.8.3/lto-wrapper
Target: i386-portbld-freebsd7.1
Configured with: ./../gcc-4.8.3/configure
--disable-bootstrap --disable-nls
--enable-gnu-indirect-function
--libdir=/usr/local/lib/gcc48
--libexecdir=/usr/local/libexec/gcc48
--program-suffix=48
--with- as=/usr/local/bin/as
--with-gmp=/usr/local
--with-gxx-include-dir=/usr/local/lib/gcc48/include/c++/
--with-ld=/usr/local/bin/ld
--with-pkgversion='FreeBSD Ports Collection'
--with-system-zlib --disable-libgcj
--enable-languages=c,c++,objc,fortran
--prefix=/usr/local --mandir=/usr/local/man
--infodir=/usr/local/info/gcc48
--build=i386-portbld-freebsd7.1
Thread model: posix
gcc version 4.8.3 (FreeBSD Ports Collection)
compiling math.c
**math.c: In function 'math_log':
**math.c:466:9: internal compiler error: Segmentation fault: 11
d += numbits * log(2); /* log(2**numbits) */****
^
no stack trace because unwind library not available
Please submit a full bug report,
with preprocessed source if appropriate.

Where can I get the nsslowhash lib from for fedora 16? Source preferably

While trying to build the mysql2 gem with ruby 1.9.2-p320 on Fedora 16, I ran into this error,
reproducible like so:
gremlin:mysql2 $ cat conftest.c
#include "ruby.h"
/*top*/
int main() {return 0;}
int t() {
void ((*volatile p)());
p = (void ((*)()))rb_thread_blocking_region;
return 0;
}
gremlin:mysql2 $ gcc -o conftest -I/usr/local/include/ruby-1.9.1/i686-linux \
-I/usr/local/include/ruby-1.9.1/ruby/backward
-I/usr/local/include/ruby-1.9.1 -I.
-I/usr/local/include/ruby-1.9.1/
-D_FILE_OFFSET_BITS=64 -O3 -ggdb -Wextra -Wno-unused-parameter
-Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers
-Wno-long-long conftest.c -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L.
-rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/usr/local/lib -L/usr/local/lib
-lruby-static -lpthread -lrt -ldl -lnss3 -lcrypt -lm -lc
/usr/lib/gcc/i686-redhat-linux/4.6.3/../../../libcrypt.a(md5-crypt.o):
In function `__md5_crypt_r':
(.text+0x96): undefined reference to `NSSLOW_Init'
/usr/lib/gcc/i686-redhat-linux/4.6.3/../../../libcrypt.a(md5-crypt.o):
In function `__md5_crypt_r':
(.text+0xb1): undefined reference to `NSSLOWHASH_NewContext'
... and many more messages for other global functions in the nsslowhash library,
which it looks like /usr/lib/libcrypt.a expects to have available, but I don't have
it installed, and can't find the source for.
Actually, that's not totally true. I found nsslowhash as part of
the Mozilla-Central build for Firefox, but when I run nm on the compiled
.a and .so files, none of them define anything that matches NSSLOW.
So where do these names come from?
Any help appreciated.
Problem solved by adding -lfreebl3 to the LIBS CONFIG setting.

Resources