Back to the main page.
Bug 3243 - cannot compile "peer" code using Makefile on OSX
Status | CLOSED WONTFIX |
Reported | 2017-02-06 17:18:00 +0100 |
Modified | 2019-08-10 12:41:40 +0200 |
Product: | FieldTrip |
Component: | peer |
Version: | unspecified |
Hardware: | PC |
Operating System: | Mac OS |
Importance: | P5 normal |
Assigned to: | Robert Oostenveld |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
nno - 2017-02-06 17:18:21 +0100
Compiling the "peer" code using Matlab 2015a on OSX 10.12 gives an error when using the Makefile in src/peer; output below. A google query for Undefined symbols for architecture x86_64: "_mxDeserialize", referenced from: did not return any results. Any suggestions what could be the issue? MacBook-Pro-3:src nick$ cd src/peer MacBook-Pro-3:src nick$ make gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -L. -L/Applications/MATLAB_R2015a.app/bin/maci64 -leng -lmx -L/Applications/MATLAB_R2015a.app/bin/maci64 -leng -lmx -o ../bin/peerslave.maci64 peerslave.o libpeer.a -lm -lpthread -lpeer clang: warning: argument unused during compilation: '-pthread' Undefined symbols for architecture x86_64: "_mxDeserialize", referenced from: _main in peerslave.o "_mxSerialize", referenced from: _main in peerslave.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [peerslave.maci64] Error 1 MacBook-Pro-3:src nick$ make clean rm -f core *.o *.obj *.a *~ MacBook-Pro-3:src nick$ make clean; make rm -f core *.o *.obj *.a *~ gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c tcpserver.c tcpserver.c:204:58: warning: invalid conversion specifier ' ' [-Wformat-invalid-specifier] ...DEBUG(LOG_DEBUG, "tcpserver: started on port %d, id = %\n", host->por... ~^ ./peer.h:88:77: note: expanded from macro 'DEBUG' ...format, ...) {if (level<=syslog_level) fprintf(stderr, format"\... ^ tcpserver.c:274:50: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast] ...rc = pthread_create(&tid, NULL, tcpsocket, (void *)c); ^ 2 warnings generated. gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c udsserver.c udsserver.c:188:50: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast] ...rc = pthread_create(&tid, NULL, tcpsocket, (void *)c); ^ 1 warning generated. gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c tcpsocket.c tcpsocket.c:72:23: warning: incompatible pointer types assigning to 'void **' from 'message_t **' [-Wincompatible-pointer-types] threadlocal.message = &message; ^ ~~~~~~~~ tcpsocket.c:127:85: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat] ...could not write handshake, n = %d, should be %d", n, sizeof(int)); ~~ ^~~~~~~~~~~ %lu ./peer.h:88:92: note: expanded from macro 'DEBUG' ...(level<=syslog_level) fprintf(stderr, format"\n", ## __VA_ARGS__);} ^~~~~~~~~~~ tcpsocket.c:144:68: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat] ..."tcpsocket: read size = %d, should be %d", n, sizeof(hostdef_t)); ~~ ^~~~~~~~~~~~~~~~~ %lu ./peer.h:88:92: note: expanded from macro 'DEBUG' ...(level<=syslog_level) fprintf(stderr, format"\n", ## __VA_ARGS__);} ^~~~~~~~~~~ tcpsocket.c:167:85: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat] ...could not write handshake, n = %d, should be %d", n, sizeof(int)); ~~ ^~~~~~~~~~~ %lu ./peer.h:88:92: note: expanded from macro 'DEBUG' ...(level<=syslog_level) fprintf(stderr, format"\n", ## __VA_ARGS__);} ^~~~~~~~~~~ tcpsocket.c:178:68: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat] ..."tcpsocket: packet size = %d, should be %d", n, sizeof(jobdef_t)); ~~ ^~~~~~~~~~~~~~~~ %lu ./peer.h:88:92: note: expanded from macro 'DEBUG' ...(level<=syslog_level) fprintf(stderr, format"\n", ## __VA_ARGS__);} ^~~~~~~~~~~ tcpsocket.c:230:85: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat] ...could not write handshake, n = %d, should be %d", n, sizeof(int)); ~~ ^~~~~~~~~~~ %lu ./peer.h:88:92: note: expanded from macro 'DEBUG' ...(level<=syslog_level) fprintf(stderr, format"\n", ## __VA_ARGS__);} ^~~~~~~~~~~ tcpsocket.c:251:85: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat] ...could not write handshake, n = %d, should be %d", n, sizeof(int)); ~~ ^~~~~~~~~~~ %lu ./peer.h:88:92: note: expanded from macro 'DEBUG' ...(level<=syslog_level) fprintf(stderr, format"\n", ## __VA_ARGS__);} ^~~~~~~~~~~ tcpsocket.c:272:85: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat] ...could not write handshake, n = %d, should be %d", n, sizeof(int)); ~~ ^~~~~~~~~~~ %lu ./peer.h:88:92: note: expanded from macro 'DEBUG' ...(level<=syslog_level) fprintf(stderr, format"\n", ## __VA_ARGS__);} ^~~~~~~~~~~ 8 warnings generated. gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c discover.c discover.c:105:25: warning: incompatible pointer types assigning to 'void **' from 'hostdef_t **' [-Wincompatible-pointer-types] threadlocal.discovery = &discovery; ^ ~~~~~~~~~~ discover.c:217:96: warning: data argument not used by format string [-Wformat-extra-args] ...DEBUG(LOG_DEBUG, "discover: rejecting %s:%u, id = lu", discovery->name, discovery->port, discovery->id); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ ./peer.h:88:92: note: expanded from macro 'DEBUG' ...{if (level<=syslog_level) fprintf(stderr, format"\n", ## __VA_ARGS__);} ~~~~~~~~~~ ^ discover.c:91:7: warning: unused variable 'i' [-Wunused-variable] int i = 0; ^ 3 warnings generated. gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c announce.c announce.c:85:23: warning: incompatible pointer types assigning to 'void **' from 'hostdef_t **' [-Wincompatible-pointer-types] threadlocal.message = &message; ^ ~~~~~~~~ 1 warning generated. gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c expire.c expire.c:184:24: warning: equality comparison result unused [-Wunused-comparison] watchdog.evidence==0; ~~~~~~~~~~~~~~~~~^~~ expire.c:184:24: note: use '=' to turn this equality comparison into an assignment watchdog.evidence==0; ^~ = 1 warning generated. gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c util.c util.c:307:33: warning: implicit declaration of function 'mach_task_self' is invalid in C99 [-Wimplicit-function-declaration] if (KERN_SUCCESS != task_info(mach_task_self(), TASK_... ^ util.c:304:10: warning: unused variable 'task' [-Wunused-variable] task_t task = MACH_PORT_NULL; ^ 2 warnings generated. gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c extern.c gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c peerinit.c peerinit.c:33:12: warning: using the result of an assignment as a condition without parentheses [-Wparentheses] while (c = (*str++)) ~~^~~~~~~~~~ peerinit.c:33:12: note: place parentheses around the assignment to silence this warning while (c = (*str++)) ^ ( ) peerinit.c:33:12: note: use '==' to turn this assignment into an equality comparison while (c = (*str++)) ^ == peerinit.c:127:20: warning: passing 'char [128]' to parameter of type 'unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] host->id += hash(host->name); ^~~~~~~~~~ peerinit.c:28:35: note: passing argument to parameter 'str' here unsigned long hash(unsigned char *str) ^ peerinit.c:128:20: warning: passing 'char [128]' to parameter of type 'unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] host->id += hash(host->user); ^~~~~~~~~~ peerinit.c:28:35: note: passing argument to parameter 'str' here unsigned long hash(unsigned char *str) ^ peerinit.c:129:20: warning: passing 'char [128]' to parameter of type 'unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] host->id += hash(host->group); ^~~~~~~~~~~ peerinit.c:28:35: note: passing argument to parameter 'str' here unsigned long hash(unsigned char *str) ^ peerinit.c:130:20: warning: passing 'char [128]' to parameter of type 'unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign] host->id += hash(host->socket); ^~~~~~~~~~~~ peerinit.c:28:35: note: passing argument to parameter 'str' here unsigned long hash(unsigned char *str) ^ peerinit.c:134:72: warning: format specifies type 'unsigned long' but the argument has type 'UINT32_T' (aka 'unsigned int') [-Wformat] ..."peerinit: %s@%s, id = %lu", host->user, host->name, host->id); ~~~ ^~~~~~~~ %u ./peer.h:88:92: note: expanded from macro 'DEBUG' ...(level<=syslog_level) fprintf(stderr, format"\n", ## __VA_ARGS__);} ^~~~~~~~~~~ 6 warnings generated. gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c security.c gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c localhost.c gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c smartshare.c smartshare.c:120:58: warning: format specifies type 'int' but the argument has type 'float' [-Wformat] DEBUG(LOG_INFO, "smartshare_check: return value = %d", p); ~~ ^ %f ./peer.h:88:92: note: expanded from macro 'DEBUG' ...(level<=syslog_level) fprintf(stderr, format"\n", ## __VA_ARGS__);} ^~~~~~~~~~~ 1 warning generated. gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c smartmem.c smartmem.c:29:8: warning: unused variable 'str' [-Wunused-variable] char str[256]; ^ smartmem.c:28:9: warning: unused variable 'fp' [-Wunused-variable] void *fp; ^ 2 warnings generated. gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c smartcpu.c smartcpu.c:30:9: warning: unused variable 'AvgLoad1' [-Wunused-variable] float AvgLoad1 = 0, AvgLoad5 = 0, AvgLoad15 = 0; ^ smartcpu.c:30:37: warning: unused variable 'AvgLoad15' [-Wunused-variable] float AvgLoad1 = 0, AvgLoad5 = 0, AvgLoad15 = 0; ^ smartcpu.c:29:8: warning: unused variable 'str' [-Wunused-variable] char str[256]; ^ smartcpu.c:28:9: warning: unused variable 'fp' [-Wunused-variable] void *fp; ^ smartcpu.c:30:23: warning: unused variable 'AvgLoad5' [-Wunused-variable] float AvgLoad1 = 0, AvgLoad5 = 0, AvgLoad15 = 0; ^ 5 warnings generated. gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c connect.c gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -c parser.c ar rv libpeer.a tcpserver.o udsserver.o tcpsocket.o discover.o announce.o expire.o util.o extern.o peerinit.o security.o localhost.o smartshare.o smartmem.o smartcpu.o connect.o parser.o ar: creating archive libpeer.a a - tcpserver.o a - udsserver.o a - tcpsocket.o a - discover.o a - announce.o a - expire.o a - util.o a - extern.o a - peerinit.o a - security.o a - localhost.o a - smartshare.o a - smartmem.o a - smartcpu.o a - connect.o a - parser.o gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -I. -I/Applications/MATLAB_R2015a.app/extern/include -I/Applications/MATLAB_R2015a.app/extern/include -c peerslave.c peerslave.c:760:151: warning: format specifies type 'unsigned long' but the argument has type 'unsigned long long' [-Wformat] ...%lu, timreq=%lu)", ++jobnum, job->host->user, job->host->name, job->job->id, job->job->memreq... ~~~ ^~~~~~~~~~~~~~~~ %llu ./peer.h:88:92: note: expanded from macro 'DEBUG' ...(level<=syslog_level) fprintf(stderr, format"\n", ## __VA_ARGS__);} ^~~~~~~~~~~ peerslave.c:760:169: warning: format specifies type 'unsigned long' but the argument has type 'unsigned long long' [-Wformat] ...%lu)", ++jobnum, job->host->user, job->host->name, job->job->id, job->job->memreq, job->job->timreq); ~~~ ^~~~~~~~~~~~~~~~ %llu ./peer.h:88:92: note: expanded from macro 'DEBUG' ...(level<=syslog_level) fprintf(stderr, format"\n", ## __VA_ARGS__);} ^~~~~~~~~~~ peerslave.c:67:13: warning: unused variable 'udsserverThread' [-Wunused-variable] pthread_t udsserverThread; ^ 3 warnings generated. gcc -I. -I/Applications/MATLAB_R2015a.app/extern/include -fPIC -Wall -pthread -DSYSLOG=2 -L. -L/Applications/MATLAB_R2015a.app/bin/maci64 -leng -lmx -L/Applications/MATLAB_R2015a.app/bin/maci64 -leng -lmx -o ../bin/peerslave.maci64 peerslave.o libpeer.a -lm -lpthread -lpeer clang: warning: argument unused during compilation: '-pthread' Undefined symbols for architecture x86_64: "_mxDeserialize", referenced from: _main in peerslave.o "_mxSerialize", referenced from: _main in peerslave.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [peerslave.maci64] Error 1
Robert Oostenveld - 2017-02-06 22:12:54 +0100
I have not used peer for a long time. I recall that mxSerialize and mxDeserialize have been removed from recent matlab version, or at least hidden even further away. These mex functions have always been undocumented. I can confirm the failure, I have it with 2016b on OS X. When compiling with 2012b on OS X there is no compile error. Ah, I found a reference: please see bug 2452. And also see the solution (hack) in src/mxDeserialize_cpp.cpp
nno - 2017-02-07 13:01:27 +0100
>> Compiling the "peer" code using Matlab 2015a on OSX 10.12 gives an error when using the Makefile in src/peer > I can confirm the failure, I have it with 2016b on OS X. please see bug 2452. And also see the solution (hack) in src/mxDeserialize_cpp.cpp @Robert Oostenveld, thanks for confirming the issue and reference to a possible solution. However, I don't use the peer code myself and this issue does not have sufficient priority for me to try out the solution. Thus, for your information I am not planning to send a PR trying to address it.
Robert Oostenveld - 2017-02-07 13:49:52 +0100
(In reply to nno from comment #2) ok, then this won't be fixed. It is still good to have the information here for future reference.
nno - 2017-02-07 15:36:25 +0100
(In reply to Robert Oostenveld from comment #3) > ok, then this won't be fixed. > It is still good to have the information here for future reference. Absolutely. It may also be useful for others who encounter the same issue in the future. They may find this post to learn that is has been reported and what its current status is.
Robert Oostenveld - 2019-08-10 12:35:27 +0200
This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on https://github.com/fieldtrip/fieldtrip/issues.