Closed DrWhax closed 3 years ago
I got a fix with llvm-g++!
gebruiker@GebruiksMacBook pin % llvm-g++ -v
Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
In Makefile I have this:
TOOL_CXXFLAGS += -std=c++11 -Wno-format -Wno-error
Which results in:
gebruiker@GebruiksMacBook pin % make
mkdir -p obj-intel64
/Applications/Xcode.app/Contents/Developer/usr/bin/make objects
make[1]: Nothing to be done for `objects'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make libs
make[1]: Nothing to be done for `libs'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make dlls
make[1]: Nothing to be done for `dlls'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make apps
make[1]: Nothing to be done for `apps'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make tools
/usr/bin/g++ -Wall -Werror -Wno-unknown-pragmas -D__PIN__=1 -DPIN_CRT=1 -fno-stack-protector -fno-exceptions -funwind-tables -fno-rtti -Wtypedef-redefinition -DTARGET_IA32E -DHOST_IA32E -fPIC -DTARGET_MAC -D__DARWIN_ONLY_UNIX_CONFORMANCE=1 -D__DARWIN_UNIX03=0 -I/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/source/include/pin -I/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/source/include/pin/gen -isystem /Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/stlport/include -isystem /Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/libstdc++/include -isystem /Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/crt/include -isystem /Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/crt/include/arch-x86_64 -isystem /Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/crt/include/kernel/uapi -isystem /Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/crt/include/kernel/uapi/asm-x86 -I/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/components/include -I/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/xed-intel64/include/xed -I/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/source/tools/Utils -I/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/source/tools/InstLib -O3 -fomit-frame-pointer -fno-strict-aliasing -std=c++11 -Wno-format -Wno-error -c -o obj-intel64/CodeCoverage.o CodeCoverage.cpp
CodeCoverage.cpp:1:17: warning: using directive refers to implicitly-defined namespace 'std'
using namespace std;
^
1 warning generated.
/usr/bin/g++ -Wall -Werror -Wno-unknown-pragmas -D__PIN__=1 -DPIN_CRT=1 -fno-stack-protector -fno-exceptions -funwind-tables -fno-rtti -Wtypedef-redefinition -DTARGET_IA32E -DHOST_IA32E -fPIC -DTARGET_MAC -D__DARWIN_ONLY_UNIX_CONFORMANCE=1 -D__DARWIN_UNIX03=0 -I/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/source/include/pin -I/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/source/include/pin/gen -isystem /Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/stlport/include -isystem /Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/libstdc++/include -isystem /Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/crt/include -isystem /Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/crt/include/arch-x86_64 -isystem /Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/crt/include/kernel/uapi -isystem /Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/crt/include/kernel/uapi/asm-x86 -I/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/components/include -I/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/xed-intel64/include/xed -I/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/source/tools/Utils -I/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/source/tools/InstLib -O3 -fomit-frame-pointer -fno-strict-aliasing -std=c++11 -Wno-format -Wno-error -c -o obj-intel64/ImageManager.o ImageManager.cpp
ImageManager.cpp:1:17: warning: using directive refers to implicitly-defined namespace 'std'
using namespace std;
^
1 warning generated.
/usr/bin/g++ -shared /Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/intel64/runtime/pincrt/crtbeginS.o -w -Wl,-exported_symbols_list,/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/source/include/pin/pintool.exp -o obj-intel64/CodeCoverage.dylib obj-intel64/CodeCoverage.o obj-intel64/ImageManager.o -L/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/intel64/runtime/pincrt -L/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/intel64/lib -L/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/intel64/lib-ext -L/Users/gebruiker/Downloads/pin-3.13-98189-g60a6ef199-clang-mac/extras/xed-intel64/lib -lpin -lxed -lpin3dwarf -nostdlib -lstlport-dynamic -lm-dynamic -lc-dynamic -lunwind-dynamic
gebruiker@GebruiksMacBook pin % ls -alrt obj-intel64
total 3056
drwxr-xr-x 12 gebruiker staff 384 Dec 18 15:03 ..
-rw-r--r-- 1 gebruiker staff 37336 Dec 18 15:03 CodeCoverage.o
-rw-r--r-- 1 gebruiker staff 10764 Dec 18 15:03 ImageManager.o
-rwxr-xr-x 1 gebruiker staff 1509632 Dec 18 15:03 CodeCoverage.dylib
drwxr-xr-x 5 gebruiker staff 160 Dec 18 15:03 .
Hey! Thanks for looking into this.
For whatever reason, the pintool has been relatively high maintenance. I feel like the build for it breaks at least once a year. Sometimes it is changes to pin's tool building process, otherwise it is platform specific compiler issues.
I actually think the pintool / build file needs to be updated for Windows too, since they changed how the CRT gets compiled in on the latest versions of pin (3.15+?) 🙄. Sigh...
I'll leave this issue open for now as reference for others, and try to circle back and correct some of the outstanding pin build issues in the coming months. Otherwise if you would like to submit a PR, please make it to the dev branch.
Thanks again :-)
No problem!
Got even further, seems "using namespace std;" is no longer needed and with that, -Wno-error is also no longer needed and compiles without any errors using llvm out of the box.
On Linux, I also compiled without "using namespace std;". This compile also could do without: "-Wno-aligned-new".
Still have to test on Windows 10, but I assume this could fix some of the issues right now on builds that aren't Windows. Yay!
Will circle back once I tested it out on Win10.
Resolved by PR #94, thanks!
I've been trying to compile the CodeCoverage file under MacOS catalina, but i've run into some errors.
Of which for now, I've not not overcome, otherwise I would have sent a patch.
It seems
-Wno-aligned-new
isn't a flag supported by clang/llvm.So I tried with gcc-10 from brew:
Seems I cannot get it to build under any circumstance.
This happens under both Pin 3.13 and 3.17.
Any advice would be much appreciated as this tool looks very awesome! :)