mozack / abra

Assembly Based ReAligner
MIT License
72 stars 12 forks source link

xlC compatibility - C++ STL referenced in .c files #32

Closed jlost closed 7 years ago

jlost commented 8 years ago

Hi, I was compiling ABRA for use on an IBM POWER8 system (ppc64le) with the xlC compiler and noticed it will fail compile, unable to find iostream:

[u0017592@sys-83519 abra]$ sudo make standalone JAVA_HOME=$JAVA_HOME
xlc++ -Isrc/main/c -I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91-2.6.2.1.ael7b_1.ppc64le/include -I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91-2.6.2.1.ael7b_1.ppc64le/include/linux src/main/c/assembler.c -o abra
src/main/c/assembler.c:5:10: fatal error: 'iostream' file not found
#include <iostream>
         ^
1 error generated.
Error while processing src/main/c/assembler.c.
make: *** [standalone] Error 1

I poked around a bit and discovered that this is because xlC doesn't import the C++ STL by default for .c files. Since the .c files are using the C++ STL, wouldn't it make more sense to rename the .c files to .cpp and retest it on both compilers to make sure no functionality changed (although none should) and update the Makefile? This would fix ABRA for the xlC compiler.

Would you be willing to accept a pull request that does this?

mozack commented 8 years ago

Yes, that sounds fine.

jlost commented 7 years ago

33

jlost commented 7 years ago

Is the PR acceptable?

mozack commented 7 years ago

LGTM and thanks.