Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MEX file errors - matlab_bgl_sp_mex.c (macOS Monterey 12.5.1) #27

Open
dankozar opened this issue Oct 19, 2022 · 7 comments
Open

MEX file errors - matlab_bgl_sp_mex.c (macOS Monterey 12.5.1) #27

dankozar opened this issue Oct 19, 2022 · 7 comments

Comments

@dankozar
Copy link

Hi,

Thanks for setting all of this up. I am seeking to use the BGL library for calculating directional connectivity index (DCI) on a binary matrix. I have successfully downloaded and unzipped the package folder, but I get an error message when I seek to compile the matlab_bgl_sp_mex.c file. I seek to compile the mex script with:

mex matlab_bgl_sp_mex.c -lmwlapack -lmwblas

And I get the error string below. It is a lot of text, but I figure maybe necessary to establish what is wrong. Apologies for any newbie misunderstanding.



Building with 'Xcode with Clang'.
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:246:13: warning: case value not in enumerated type 'mxClassID' [-Wswitch]
            CHECK_AND_SET_VISITOR_FUNCTION(vis,initialize_vertex,d_vis);
            ^
/Volumes/easystore/Thesis_CH1/Matrices/visitor_macros.h:32:41: note: expanded from macro 'CHECK_AND_SET_VISITOR_FUNCTION'
            case mxFUNCTION_CLASS: case 23:
                                        ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:247:13: warning: case value not in enumerated type 'mxClassID' [-Wswitch]
            CHECK_AND_SET_VISITOR_FUNCTION(vis,discover_vertex,d_vis);
            ^
/Volumes/easystore/Thesis_CH1/Matrices/visitor_macros.h:32:41: note: expanded from macro 'CHECK_AND_SET_VISITOR_FUNCTION'
            case mxFUNCTION_CLASS: case 23:
                                        ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:248:13: warning: case value not in enumerated type 'mxClassID' [-Wswitch]
            CHECK_AND_SET_VISITOR_FUNCTION(vis,examine_vertex,d_vis);
            ^
/Volumes/easystore/Thesis_CH1/Matrices/visitor_macros.h:32:41: note: expanded from macro 'CHECK_AND_SET_VISITOR_FUNCTION'
            case mxFUNCTION_CLASS: case 23:
                                        ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:249:13: warning: case value not in enumerated type 'mxClassID' [-Wswitch]
            CHECK_AND_SET_VISITOR_FUNCTION(vis,finish_vertex,d_vis);
            ^
/Volumes/easystore/Thesis_CH1/Matrices/visitor_macros.h:32:41: note: expanded from macro 'CHECK_AND_SET_VISITOR_FUNCTION'
            case mxFUNCTION_CLASS: case 23:
                                        ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:251:13: warning: case value not in enumerated type 'mxClassID' [-Wswitch]
            CHECK_AND_SET_VISITOR_FUNCTION(vis,examine_edge,d_vis);
            ^
/Volumes/easystore/Thesis_CH1/Matrices/visitor_macros.h:32:41: note: expanded from macro 'CHECK_AND_SET_VISITOR_FUNCTION'
            case mxFUNCTION_CLASS: case 23:
                                        ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:252:13: warning: case value not in enumerated type 'mxClassID' [-Wswitch]
            CHECK_AND_SET_VISITOR_FUNCTION(vis,edge_relaxed,d_vis);
            ^
/Volumes/easystore/Thesis_CH1/Matrices/visitor_macros.h:32:41: note: expanded from macro 'CHECK_AND_SET_VISITOR_FUNCTION'
            case mxFUNCTION_CLASS: case 23:
                                        ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:253:13: warning: case value not in enumerated type 'mxClassID' [-Wswitch]
            CHECK_AND_SET_VISITOR_FUNCTION(vis,edge_not_relaxed,d_vis);
            ^
/Volumes/easystore/Thesis_CH1/Matrices/visitor_macros.h:32:41: note: expanded from macro 'CHECK_AND_SET_VISITOR_FUNCTION'
            case mxFUNCTION_CLASS: case 23:
                                        ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:255:36: warning: incompatible pointer types passing 'mwIndex *' (aka 'unsigned long *') to parameter of type 'mbglIndex *' (aka 'int *') [-Wincompatible-pointer-types]
            dijkstra_sp_visitor(n, ja, ia, a,
                                   ^~
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl.h:190:34: note: passing argument to parameter 'ja' here
    mbglIndex nverts, mbglIndex *ja, mbglIndex *ia, double weight, / connectivity params */
                                 ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:255:40: warning: incompatible pointer types passing 'mwIndex *' (aka 'unsigned long *') to parameter of type 'mbglIndex *' (aka 'int *') [-Wincompatible-pointer-types]
            dijkstra_sp_visitor(n, ja, ia, a,
                                       ^~
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl.h:190:49: note: passing argument to parameter 'ia' here
    mbglIndex nverts, mbglIndex *ja, mbglIndex *ia, double weight, / connectivity params */
                                                ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:257:20: warning: incompatible pointer types passing 'mwIndex *' (aka 'unsigned long *') to parameter of type 'mbglIndex ' (aka 'int ') [-Wincompatible-pointer-types]
                d, (mwIndex
)pred, dinf, d_vis);
                   ^~~~~~~~~~~~~~
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl.h:192:27: note: passing argument to parameter 'pred' here
    double
d, mbglIndex *pred, double dinf,
                          ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:261:28: warning: incompatible pointer types passing 'mwIndex *' (aka 'unsigned long *') to parameter of type 'mbglIndex *' (aka 'int *') [-Wincompatible-pointer-types]
            dijkstra_sp(n, ja, ia, a,
                           ^~
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl.h:185:34: note: passing argument to parameter 'ja' here
    mbglIndex nverts, mbglIndex *ja, mbglIndex *ia, double weight, / connectivity params */
                                 ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:261:32: warning: incompatible pointer types passing 'mwIndex *' (aka 'unsigned long *') to parameter of type 'mbglIndex *' (aka 'int *') [-Wincompatible-pointer-types]
            dijkstra_sp(n, ja, ia, a,
                               ^~
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl.h:185:49: note: passing argument to parameter 'ia' here
    mbglIndex nverts, mbglIndex *ja, mbglIndex *ia, double weight, / connectivity params */
                                                ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:263:20: warning: incompatible pointer types passing 'mwIndex *' (aka 'unsigned long *') to parameter of type 'mbglIndex ' (aka 'int ') [-Wincompatible-pointer-types]
                d, (mwIndex
)pred, dinf);
                   ^~~~~~~~~~~~~~
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl.h:187:27: note: passing argument to parameter 'pred' here
    double
d, mbglIndex *pred, double dinf);
                          ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:275:13: warning: case value not in enumerated type 'mxClassID' [-Wswitch]
            CHECK_AND_SET_VISITOR_FUNCTION(vis,initialize_vertex,bf_vis);
            ^
/Volumes/easystore/Thesis_CH1/Matrices/visitor_macros.h:32:41: note: expanded from macro 'CHECK_AND_SET_VISITOR_FUNCTION'
            case mxFUNCTION_CLASS: case 23:
                                        ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:277:13: warning: case value not in enumerated type 'mxClassID' [-Wswitch]
            CHECK_AND_SET_VISITOR_FUNCTION(vis,examine_edge,bf_vis);
            ^
/Volumes/easystore/Thesis_CH1/Matrices/visitor_macros.h:32:41: note: expanded from macro 'CHECK_AND_SET_VISITOR_FUNCTION'
            case mxFUNCTION_CLASS: case 23:
                                        ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:278:13: warning: case value not in enumerated type 'mxClassID' [-Wswitch]
            CHECK_AND_SET_VISITOR_FUNCTION(vis,edge_relaxed,bf_vis);
            ^
/Volumes/easystore/Thesis_CH1/Matrices/visitor_macros.h:32:41: note: expanded from macro 'CHECK_AND_SET_VISITOR_FUNCTION'
            case mxFUNCTION_CLASS: case 23:
                                        ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:279:13: warning: case value not in enumerated type 'mxClassID' [-Wswitch]
            CHECK_AND_SET_VISITOR_FUNCTION(vis,edge_not_relaxed,bf_vis);
            ^
/Volumes/easystore/Thesis_CH1/Matrices/visitor_macros.h:32:41: note: expanded from macro 'CHECK_AND_SET_VISITOR_FUNCTION'
            case mxFUNCTION_CLASS: case 23:
                                        ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:280:13: warning: case value not in enumerated type 'mxClassID' [-Wswitch]
            CHECK_AND_SET_VISITOR_FUNCTION(vis,edge_minimized,bf_vis);
            ^
/Volumes/easystore/Thesis_CH1/Matrices/visitor_macros.h:32:41: note: expanded from macro 'CHECK_AND_SET_VISITOR_FUNCTION'
            case mxFUNCTION_CLASS: case 23:
                                        ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:281:13: warning: case value not in enumerated type 'mxClassID' [-Wswitch]
            CHECK_AND_SET_VISITOR_FUNCTION(vis,edge_not_minimized,bf_vis);
            ^
/Volumes/easystore/Thesis_CH1/Matrices/visitor_macros.h:32:41: note: expanded from macro 'CHECK_AND_SET_VISITOR_FUNCTION'
            case mxFUNCTION_CLASS: case 23:
                                        ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:283:40: warning: incompatible pointer types passing 'mwIndex *' (aka 'unsigned long *') to parameter of type 'mbglIndex *' (aka 'int *') [-Wincompatible-pointer-types]
            bellman_ford_sp_visitor(n, ja, ia, a,
                                       ^~
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl.h:201:34: note: passing argument to parameter 'ja' here
    mbglIndex nverts, mbglIndex *ja, mbglIndex *ia, double weight, / connectivity params */
                                 ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:283:44: warning: incompatible pointer types passing 'mwIndex *' (aka 'unsigned long *') to parameter of type 'mbglIndex *' (aka 'int *') [-Wincompatible-pointer-types]
            bellman_ford_sp_visitor(n, ja, ia, a,
                                           ^~
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl.h:201:49: note: passing argument to parameter 'ia' here
    mbglIndex nverts, mbglIndex *ja, mbglIndex *ia, double weight, / connectivity params */
                                                ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:285:16: warning: incompatible pointer types passing 'mwIndex *' (aka 'unsigned long *') to parameter of type 'mbglIndex ' (aka 'int ') [-Wincompatible-pointer-types]
            d, (mwIndex
)pred, dinf, bf_vis);
               ^~~~~~~~~~~~~~
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl.h:203:27: note: passing argument to parameter 'pred' here
    double
d, mbglIndex *pred, double dinf,
                          ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:289:32: warning: incompatible pointer types passing 'mwIndex *' (aka 'unsigned long *') to parameter of type 'mbglIndex *' (aka 'int *') [-Wincompatible-pointer-types]
            bellman_ford_sp(n, ja, ia, a,
                               ^~
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl.h:196:34: note: passing argument to parameter 'ja' here
    mbglIndex nverts, mbglIndex *ja, mbglIndex *ia, double weight, / connectivity params */
                                 ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:289:36: warning: incompatible pointer types passing 'mwIndex *' (aka 'unsigned long *') to parameter of type 'mbglIndex *' (aka 'int *') [-Wincompatible-pointer-types]
            bellman_ford_sp(n, ja, ia, a,
                                   ^~
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl.h:196:49: note: passing argument to parameter 'ia' here
    mbglIndex nverts, mbglIndex *ja, mbglIndex *ia, double weight, / connectivity params */
                                                ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:291:16: warning: incompatible pointer types passing 'mwIndex *' (aka 'unsigned long *') to parameter of type 'mbglIndex ' (aka 'int ') [-Wincompatible-pointer-types]
            d, (mwIndex
)pred, dinf);
               ^~~~~~~~~~~~~~
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl.h:198:27: note: passing argument to parameter 'pred' here
    double
d, mbglIndex *pred, double dinf);
                          ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:298:19: warning: incompatible pointer types passing 'mwIndex *' (aka 'unsigned long *') to parameter of type 'mbglIndex *' (aka 'int *') [-Wincompatible-pointer-types]
        dag_sp(n, ja, ia, a,
                  ^~
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl.h:207:34: note: passing argument to parameter 'ja' here
    mbglIndex nverts, mbglIndex *ja, mbglIndex *ia, double weight, / connectivity params */
                                 ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:298:23: warning: incompatible pointer types passing 'mwIndex *' (aka 'unsigned long *') to parameter of type 'mbglIndex *' (aka 'int *') [-Wincompatible-pointer-types]
        dag_sp(n, ja, ia, a,
                      ^~
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl.h:207:49: note: passing argument to parameter 'ia' here
    mbglIndex nverts, mbglIndex *ja, mbglIndex *ia, double weight, / connectivity params */
                                                ^
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl_sp_mex.c:300:16: warning: incompatible pointer types passing 'mwIndex *' (aka 'unsigned long *') to parameter of type 'mbglIndex ' (aka 'int ') [-Wincompatible-pointer-types]
            d, (mwIndex
)pred, dinf);
               ^~~~~~~~~~~~~~
/Volumes/easystore/Thesis_CH1/Matrices/matlab_bgl.h:209:27: note: passing argument to parameter 'pred' here
    double
d, mbglIndex *pred, double dinf);
                          ^
28 warnings generated.

Error using mex
Undefined symbols for architecture x86_64:
  "_bellman_ford_sp", referenced from:
      _mexFunction in matlab_bgl_sp_mex.o
  "_bellman_ford_sp_visitor", referenced from:
      _mexFunction in matlab_bgl_sp_mex.o
  "_dag_sp", referenced from:
      _mexFunction in matlab_bgl_sp_mex.o
  "_dijkstra_sp", referenced from:
      _mexFunction in matlab_bgl_sp_mex.o
  "_dijkstra_sp_visitor", referenced from:
      _mexFunction in matlab_bgl_sp_mex.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Thanks!
-Daniel Kozar
PhD Student
UC Davis

@dgleich
Copy link
Owner

dgleich commented Oct 19, 2022

Can you try one of the precompiled ones? e.g.

www.cs.purdue.edu/homes/dgleich/scratch/matlab-bgl-full-dir-20191008.tar.gz

@dgleich
Copy link
Owner

dgleich commented Oct 19, 2022 via email

@dankozar
Copy link
Author

Great thank you! That worked.

One more question - to use this mex file in a HPC cluster (Linux), what file extension should I use? Now that my code runs on my personal computer, I just am seeking to run it over this cluster. Any help would be great!

Thanks

@dgleich
Copy link
Owner

dgleich commented Oct 20, 2022

mexa64

@frankgarcea
Copy link

Hi @dgleich

I'm running into a similar issue and I have tried all of the suggestions you've provided in this thread and others here. In short: when I try to run the betweenness centrality analysis, I get the following error:

Invalid MEX-file '/Users/MyComputerDocuments/MATLAB/toolboxes/matlab_bgl/private/betweenness_centrality_mex.mexmaci64':
dlopen(/Users/MyComputer/Documents/MATLAB/toolboxes/matlab_bgl/private/betweenness_centrality_mex.mexmaci64, 0x0006): Library
not loaded: '@loader_path/libmex.dylib'
Referenced from: '/Users/MyComputer/Documents/MATLAB/toolboxes/matlab_bgl/private/betweenness_centrality_mex.mexmaci64'
Reason: tried: '/Users/MyComputer/Documents/MATLAB/toolboxes/matlab_bgl/private/libmex.dylib' (no such file),
'/usr/local/lib/libmex.dylib' (no such file), '/usr/lib/libmex.dylib' (no such file)

It would appear that others have had similar issues on their mac
https://www.mathworks.com/matlabcentral/answers/763346-mexfile-error-libmex-dylib-not-loaded
https://www.mathworks.com/matlabcentral/answers/463577-mexmaci64-and-dylib-issue

And I can confirm that I don't have 'libmex.dylib' in the /usr/lib folder. It's in the /Applications/Matlab/bin/maci64 folder.

Have you encountered such an issue before? Any pointers would be appreciated.

Thanks in advance,
FG

@dgleich
Copy link
Owner

dgleich commented Jan 5, 2023

I'm not going to have a chance to take a close look for a few weeks. Sorry about that.

@frankgarcea
Copy link

Hi @dgleich,

No worries. I'll continue working on it.
If I find a solution I'll let you know.

FG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants