{"action":"created","issue":{"url":"https://api.github.com/repos/DavidFCrouse/Tracker-Component-Library/issues/1","labels_url":"https://api.github.com/repos/DavidFCrouse/Tracker-Component-Library/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/DavidFCrouse/Tracker-Component-Library/issues/1/comments","events_url":"https://api.github.com/repos/DavidFCrouse/Tracker-Component-Library/issues/1/events","html_url":"https://github.com/DavidFCrouse/Tracker-Component-Library/issues/1","id":111346919,"number":1,"title":"compilation under Ubuntu 14.04 and MATLAB R2015b","user":{"login":"michalkvasnicka","id":2698803,"avatar_url":"https://avatars.githubusercontent.com/u/2698803?v=3","gravatar_id":"","url":"https://api.github.com/users/michalkvasnicka","html_url":"https://github.com/michalkvasnicka","followers_url":"https://api.github.com/users/michalkvasnicka/followers","following_url":"https://api.github.com/users/michalkvasnicka/following{/other_user}","gists_url":"https://api.github.com/users/michalkvasnicka/gists{/gist_id}","starred_url":"https://api.github.com/users/michalkvasnicka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michalkvasnicka/subscriptions","organizations_url":"https://api.github.com/users/michalkvasnicka/orgs","repos_url":"https://api.github.com/users/michalkvasnicka/repos","events_url":"https://api.github.com/users/michalkvasnicka/events{/privacy}","received_events_url":"https://api.github.com/users/michalkvasnicka/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-14T08:19:24Z","updated_at":"2015-10-16T09:01:16Z","closed_at":null,"body":"I tried to compile whole Tracker-Component-Library by CompileCLibraries function. But there are a lot of problems and incompatibilities. \r\n\r\nTrivial troubles with // in source code was removed by adding of 'CFLAGS=\"\\$CFLAGS -std=c99\"' to mex commands in CompileCLibraries function. See attached file.\r\n\r\nBut the next problem is more difficult (at least for me, I am not C expert):\r\n\r\n> In CompileCLibraries_Linux (line 42) \r\n/usr/bin/g++ -c -U__STDC_UTF_16__   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I./ -I./3rd_Party_Code/GeographicLib-1.43/include -I\"./Container Classes/Shared C++ Code/\" -I\"./Mathematical Functions/Shared C++ Code/\"  -I\"/usr/local/MATLAB/R2015b/extern/include\" -I\"/usr/local/MATLAB/R2015b/simulink/include\" -ansi -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11 -O -DNDEBUG /home/kva/tmp/Tracker-Component-Library-master/./Navigation/indirectGeodeticProb.cpp -o /tmp/mex_2293036706664339_13060/indirectGeodeticProb.o\r\nError using mex\r\nIn file included from /home/kva/tmp/Tracker-Component-Library-master/./Navigation/indirectGeodeticProb.cpp:65:0:\r\n./MexValidation.h: In function ‘size_t* copySizeTArrayFromMatlab(const mxArray*, size_t*)’:\r\n./MexValidation.h:1171:61: error: ‘memcpy’ was not declared in this scope\r\n                 memcpy(retVal,mexData,numEl*sizeof(uint32_T));\r\n                                                             ^\r\n./MexValidation.h:1199:61: error: ‘memcpy’ was not declared in this scope\r\n                 memcpy(retVal,mexData,numEl*sizeof(uint64_T));\r\n                                                             ^\r\n./MexValidation.h: In function ‘mxArray* doubleMat2Matlab(const double*, size_t, size_t)’:\r\n./MexValidation.h:1476:52: error: ‘memcpy’ was not declared in this scope\r\n     memcpy(dataPtr,arr,numRow*numCol*sizeof(double));\r\n                                                    ^\r\nIn file included from /home/kva/tmp/Tracker-Component-Library-master/./Navigation/indirectGeodeticProb.cpp:65:0:\r\n./MexValidation.h: In function ‘mxArray* unsignedSizeMat2Matlab(const size_t*, size_t, size_t)’:\r\n./MexValidation.h:1604:52: error: ‘memcpy’ was not declared in this scope\r\n     memcpy(dataPtr,arr,numRow*numCol*sizeof(size_t));\r\n                                                    ^\r\n./MexValidation.h: In function ‘mxArray* signedSizeMat2Matlab(const ptrdiff_t*, size_t, size_t)’:\r\n./MexValidation.h:1616:55: error: ‘memcpy’ was not declared in this scope\r\n     memcpy(dataPtr,arr,numRow*numCol*sizeof(ptrdiff_t));\r\n                                                       ^\r\nIn file included from ./Mathematical Functions/Shared C++ Code/mathFuncs.hpp:13:0,\r\n                 from /home/kva/tmp/Tracker-Component-Library-master/./Navigation/indirectGeodeticProb.cpp:70:\r\n./Container Classes/Shared C++ Code/ClusterSetCPP.hpp: In member function ‘void ClusterSetCPP<T>::initWithClusterSizes(const\r\nsize_t*, size_t)’:\r\n./Container Classes/Shared C++ Code/ClusterSetCPP.hpp:66:66: error: there are no arguments to ‘memcpy’ that depend on a template\r\nparameter, so a declaration of ‘memcpy’ must be available [-fpermissive]\r\n         memcpy(clusterSizes,clustSizes,numClusters*sizeof(size_t));\r\n                                                                  ^\r\n./Container Classes/Shared C++ Code/ClusterSetCPP.hpp:66:66: note: (if you use ‘-fpermissive’, G++ will accept your code, but\r\nallowing the use of an undeclared name is deprecated)\r\n\r\n\r\nError in CompileCLibraries_Linux (line 42)\r\nmex('-v','-largeArrayDims','-U__STDC_UTF_16__','CFLAGS=\"\\$CFLAGS\r\n-std=c99\"','-outdir','./0_Compiled_Code/','-I./','-I./3rd_Party_Code/GeographicLib-1.43/include','-I./Container Classes/Shared C++\r\nCode/','-I./Mathematical Functions/Shared C++ Code/','./Navigation/indirectGeodeticProb.cpp','./Mathematical Functions/Shared C++\r\nCode/wrapRangeCPP.cpp','./3rd_Party_Code/GeographicLib-1.43/src/Geodesic.cpp','./3rd_Party_Code/GeographicLib-1.43/src/GeodesicExact.cpp','./3rd_Party_Code/GeographicLib-1.43/src/GeodesicLine.cpp','./3rd_Party_Code/GeographicLib-1.43/src/GeodesicLineExact.cpp','./3rd_Party_Code/GeographicLib-1.43/src/EllipticFunction.cpp','./3rd_Party_Code/GeographicLib-1.43/src/Math.cpp','./3rd_Party_Code/GeographicLib-1.43/src/GeodesicExactC4.cpp'); \r\n\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/DavidFCrouse/Tracker-Component-Library/issues/comments/148659578","html_url":"https://github.com/DavidFCrouse/Tracker-Component-Library/issues/1#issuecomment-148659578","issue_url":"https://api.github.com/repos/DavidFCrouse/Tracker-Component-Library/issues/1","id":148659578,"user":{"login":"michalkvasnicka","id":2698803,"avatar_url":"https://avatars.githubusercontent.com/u/2698803?v=3","gravatar_id":"","url":"https://api.github.com/users/michalkvasnicka","html_url":"https://github.com/michalkvasnicka","followers_url":"https://api.github.com/users/michalkvasnicka/followers","following_url":"https://api.github.com/users/michalkvasnicka/following{/other_user}","gists_url":"https://api.github.com/users/michalkvasnicka/gists{/gist_id}","starred_url":"https://api.github.com/users/michalkvasnicka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michalkvasnicka/subscriptions","organizations_url":"https://api.github.com/users/michalkvasnicka/orgs","repos_url":"https://api.github.com/users/michalkvasnicka/repos","events_url":"https://api.github.com/users/michalkvasnicka/events{/privacy}","received_events_url":"https://api.github.com/users/michalkvasnicka/received_events","type":"User","site_admin":false},"created_at":"2015-10-16T09:01:16Z","updated_at":"2015-10-16T09:01:16Z","body":"I found another another errors during Linux (Ubuntu) compilation:\r\n\r\n0. Add 'CFLAGS=\"\\$CFLAGS -std=c99\"' to all mex command at CompileCLibraries \r\n(use C++ style comments, which start with ...//...) see http://stackoverflow.com/questions/17977442/mex-generates-error-for-while-compiling-c-code-in-linux\r\n\r\n1. Add #include <cstring> to ShortestPathCPP.cpp (memcpy)\r\n\r\n2. Add #include <cstddef> and #include <algorithm> to ClusterSetCPP.hpp (memcpy and sort)\r\n\r\n3. Add #include <cstddef> to ais.h (ais6.cpp:16:9: error: ‘ptrdiff_t’ does not name a type)\r\n\r\n4. Add -fPIC compiler option to Makefile-custom \r\n(/usr/bin/g++ -c -U__STDC_UTF_16__   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I./3rd_Party_Code/libais/ -I./  -I\"/usr/local/MATLAB/R2015b/extern/include\" -I\"/usr/local/MATLAB/R2015b/simulink/include\" -ansi -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11 -O -DNDEBUG /data/kva/Dropbox/Work/LPopt2/RankedAssignments/Tracker-Component-Library/Tracker-Component-Library-master2/./Transponders/decodeAISString.cpp -o /tmp/mex_17307769890566_12718/decodeAISString.o\r\n/usr/bin/g++ -pthread -Wl,--no-undefined  -shared -O -Wl,--version-script,\"/usr/local/MATLAB/R2015b/extern/lib/glnxa64/mexFunction.map\" /tmp/mex_17307769890566_12718/decodeAISString.o   ./0_Compiled_Code/libais.a  -Wl,-rpath-link,/usr/local/MATLAB/R2015b/bin/glnxa64 -L\"/usr/local/MATLAB/R2015b/bin/glnxa64\" -lmx -lmex -lmat -lm -lstdc++ -o /data/kva/Dropbox/Work/LPopt2/RankedAssignments/Tracker-Component-Library/Tracker-Component-Library-master2/./0_Compiled_Code//decodeAISString.mexa64\r\nError using mex\r\n/usr/bin/ld: ./0_Compiled_Code/libais.a(ais.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared\r\nobject; recompile with -fPIC\r\n./0_Compiled_Code/libais.a: error adding symbols: Bad value\r\ncollect2: error: ld returned 1 exit status)\r\n\r\n5. Add -fPIC compiler option to makefile\r\n(/usr/bin/gcc -c -U__STDC_UTF_16__   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I./3rd_Party_Code/sofa/src/ -I./  -I\"/usr/local/MATLAB/R2015b/extern/include\" -I\"/usr/local/MATLAB/R2015b/simulink/include\" \\-ansi -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c99 -O -DNDEBUG \"/data/kva/Dropbox/Work/LPopt2/RankedAssignments/Tracker-Component-Library/Tracker-Component-Library-master2/./Astronomical Code/changeEpoch.c\" -o /tmp/mex_18215113938096_12718/changeEpoch.o\r\n/usr/bin/gcc -pthread -Wl,--no-undefined -Wl,-rpath-link,/usr/local/MATLAB/R2015b/bin/glnxa64 -shared  -O -Wl,--version-script,\"/usr/local/MATLAB/R2015b/extern/lib/glnxa64/mexFunction.map\" /tmp/mex_18215113938096_12718/changeEpoch.o   ./0_Compiled_Code/libsofa_c.a  -L\"/usr/local/MATLAB/R2015b/bin/glnxa64\" -lmx -lmex -lmat -lm -lstdc++ -o /data/kva/Dropbox/Work/LPopt2/RankedAssignments/Tracker-Component-Library/Tracker-Component-Library-master2/./0_Compiled_Code//changeEpoch.mexa64\r\nError using mex\r\n/usr/bin/ld: ./0_Compiled_Code/libsofa_c.a(iauStarpm.o): relocation R_X86_64_PC32 against undefined symbol `sqrt@@GLIBC_2.2.5' can\r\nnot be used when making a shared object; recompile with -fPIC\r\n/usr/bin/ld: final link failed: Bad value\r\ncollect2: error: ld returned 1 exit status)\r\n\r\nI am not sure if I correct all errors properly (especially errors 3, 4 and 5). So, it is up to you to decide how to correct all problems.\r\n"}}