statgen / bamUtil

http://genome.sph.umich.edu/wiki/BamUtil
89 stars 30 forks source link

Make Error with CentOS #6

Open chaelir opened 11 years ago

chaelir commented 11 years ago

HashErrorModel.cpp: In member function ‘uint8_t HashErrorModel::getQemp(BaseData&)’: HashErrorModel.cpp:96: error: ‘class std::unordered_map<long unsigned int, HashErrorModel::SMatches, std::hash, std::equal_to, std::allocator<std::pair<const long unsigned int, HashErrorModel::SMatches> > >’ has no member named ‘at’ make[2]: * [../obj/HashErrorModel.o] Error 1 make[2]: Leaving directory `/auto/cmb-01/fs3/lxia/setup/bamUtil_1.0.7/bamUtil/src' make[1]: * [src] Error 2 make[1]: Leaving directory`/auto/cmb-01/fs3/lxia/setup/bamUtil_1.0.7/bamUtil' make: *\ [bamUtil/] Error 2

Looks like my stdlibc++ is old. But I cann't change it c'z I am not root. Could it be fixed from source code side to use more backward compatible expressions?

Thanks

mktrost commented 11 years ago

You are correct, the unordered_map requires a newer version of C++. The makefile attempts to detect your version and use a map if you don't have unordered_map, but this does not appear to work (I'll see if I can fix that for the future).

To manually force it to use a map instead of unordered_map, you can do one of the following: 1) Update bamUtil/Makefile.inc, line 7, change CXX11_AVAIL ?= 1 to CXX11_AVAIL = 0 2) Set CXX11_AVAIL to 0 on the command line: make CXX11_AVAIL=0 3) Set CXX11_AVAIL = 0 in your environment

Any of these should trigger the code to use a map instead of the unordered_map.

I have started a FAQ page on bamUtil as another reference point so hopefully if someone else runs into this problem it will be better documented as to how to fix it. http://genome.sph.umich.edu/wiki/BamUtil:_FAQ

Let me know if you have any problems with one of the above suggested solutions. Also, what gcc version are you using? (You can run, "gcc -dumpversion" to find out.)

chaelir commented 11 years ago

Thanks for the update. I was able to get through the install. Yet make test and make INSTALLDIR=xxx are not working for me. So I mannually copied 'bam' to my PATH. Hope these shouldn't be a problem.

One thing to note is I actually have tr1/unordered_map which I used quite often, but when I replace with this in your code, I get: In file included from Recab.h:38, from Dedup.h:26, from Dedup.cpp:25: HashErrorModel.h:64: error: ISO C++ forbids declaration of ‘unordered_map’ with no type HashErrorModel.h:64: error: typedef name may not be a nested-name-specifier HashErrorModel.h:64: error: expected ‘;’ before ‘<’ token HashErrorModel.h:69: error: ‘HashMatch’ does not name a type make[1]: * [../obj/Dedup.o] Error 1 make[1]: Leaving directory `/auto/cmb-01/fs3/lxia/setup/bamUtil/src' make: * [src] Error 2

I will just ignore the efficiency issue between map and unordered_map for now. But you may want to put a trigger some where the user can take advantage of tr1/unordered_map in their old machines.

THanks a lot!