Compiling phantom.js to LLVM IR - c++

I downloaded the phantomjs source off of their github. I am trying to compile phantomjs into LLVM bytecode. However, when I run
> clang -S -emit-llvm main.cpp
It keeps saying:
In file included from main.cpp:31:
./utils.h:34:10: fatal error: 'QtGlobal' file not found
#include <QtGlobal>
^
1 error generated.
I'm on Ubuntu 14.04. Do I need to install Qt or something?
BTW, I'm not sure if StackOverflow is the best place to ask this, but I couldn't think of any other SE site that would be better.

Related

Cannot compile C++ files after CommandLineTools installed

Backstory: I started using my terminal for a lot of my school projects. I recently got familiar with it and wanted to "upgrade" by installing iTerm2 and homebrew; but before I installed the two, I was able to compile my C++ homework files "g++ filename.cpp" and run "./a.out" no problem. After installing iTerm2 and homebrew followed by xcode commandline tools I started running into this problem every time I try to compile my c++ files:
"ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libSystem.tbd' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)"
I created a simple "Hello World!" c++ and that won't even compile. I've tried everything even some posts on here. Hopefully someone has a different solution. Thank you in advance!
The code is super simple:
#include<iostream>
using namespace std;
int main() {
cout << "Hello World!" << endl;
return 0;
}
How I tried compiling it: "g++ main.cpp"
Which back then I get an a.out file but this time I get that error message shown in the picture.
I added more photos showing my g++ version and also the attempt of compiling it: "g++ -Wall -Wextra -g main.cpp -o prog.bin"
I'm also running macOS Catalina 10.15.6
Thank you in advance. I'm reading through the documentations provided rn.
g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
enter image description here
UPDATE:
I uninstalled and reinstalled Xcode CommandLineTools and homebrew; however, this time I did not update the CommandLineTools to beta 5 like I did before.
Now I'm able to compile and run my school assignments. Not an ideal solution but I'm back to working on my school assignments peacefully. Thank you all for the help!! I guess installing the beta CommandLineTools is not such a great idea.

NPM sqlite3 with sqlcipher support

I am trying to cross compile NPM Sqlite3 with sqlcipher support. I am using Ubuntu 16.04 to cross compile for linux armv7 based SOC(system on chip).
So I started with cross-compiling OpenSSL to build sqlcipher for arm. I successfully cross compiled sqlcipher to produce a static library (libsqlcipher.a).
Now I am trying to get the NodeJS side of the project. I need sqlite with sqlcipher support, compiled for arm. I am using SOC SDK to built till now.
I am using node v4.6.1 and npm v2.15.9 to cross compile. I made sure I have the same version installed on Ubuntu as the SOC.
The command I use to cross compile is as follows :
npm install sqlite3 --target_arch=arm --enable-static=yes --build-from-source --sqlite_libname=sqlcipher -fPIC --sqlite=home/onkar/Library/sqlcipher-master/.libs --verbose
I exported the location of the libsqlcipher.a to LDFLAGS. I get the following error when I try to cross compile. Can someone help me with this error?
/home/linuximage/sdk/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/5.2.1/real-ld: error: /home/Library/sqlcipher-master/.libs/libsqlcipher.a(sqlite3.o): requires unsupported dynamic reloc R_ARM_THM_MOVW_ABS_NC; recompile with -fPIC
collect2: error: ld returned 1 exit status
node_sqlite3.target.mk:129: recipe for target 'Release/obj.target/node_sqlite3.node' failed
make: *** [Release/obj.target/node_sqlite3.node] Error 1
Please let me know if you require any additional information, I would be more than happy to provide you with the same.
Thanks,
Onkar
In the first instance, you should check if the -fPIC (position independent code) flag was correctly applied when the libsqlcipher.a file was originally created.
In your output above, it looks like the linker is using the file at:
/home/Library/sqlcipher-master/.libs/libsqlcipher.a
Run the command
objdump -r /home/Library/sqlcipher-master/.libs/libsqlcipher.a | more
... and check for a line close to the start of the output beginning with the text
RELOCATION RECORDS FOR
If you see this line, then the library doesn't contain position independent code.

CoreAudio, AudioToolbox, AudioUnit etc. headers not found

I'm trying to build Ardour on OS X. I ran ./waf configure successfully, but trying to compile using ./waf results in numerous file-not-found when trying to #include files:
../libs/appleutility/CoreAudio/PublicUtility/CAStreamBasicDescription.h:51:11: fatal error:
'CoreAudio/CoreAudioTypes.h' file not found
#include <CoreAudio/CoreAudioTypes.h>
../libs/appleutility/CoreAudio/PublicUtility/CAAUParameter.h:50:10: fatal error:
'AudioToolbox/AudioUnitUtilities.h' file not found
#include <AudioToolbox/AudioUnitUtilities.h>
../libs/appleutility/CoreAudio/PublicUtility/AUParamInfo.h:49:10: fatal error:
'AudioUnit/AudioUnit.h' file not found
#include <AudioUnit/AudioUnit.h>
I asked about this on the #ardour-osx IRC channel some 40 hours ago but haven't received a response yet.
How to resolve this problem?
The CoreAudio headers seem to be located in
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/CoreAudio.framework/Versions/A/Headers/`
so I added
-F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks`
to the build script (wscript) but the results are the same.
Those headers are available as a download from Apple. This is explained in the Xcode 4.3 what's new documentation.
Choose this menu:
Xcode > Open Developer Tool > More Developer Tools...
and download "Audio Tools for Xcode".

mex error 206 Matlab

The cpp code I received for a project isn't working so I want to compile and see if it compiles. It didn't compile, but I tried compiling another cpp file that I know works just to see what would happen. In both cases I get the following error:
EDU>> mex max.cpp
xcodebuild: error: SDK "macosx10.7" cannot be located.
xcrun: error: unable to find utility "clang++", not a developer tool or in PATH
mex: compile of ' "max.cpp"' failed.
Any suggestions how I can either fix the cpp file or maybe I'm not running this correctly? Can't figure out where to go from here.
EDIT:
I figured it out. My mexopts.sh file was pointing to an old version of mac so I had to manually edit that file and change 10.7 to 10.9.
I figured it out. My mexopts.sh file was pointing to an old version of mac so I had to manually edit that file and change 10.7 to 10.9.

Clang errors after deletion in /usr/bin and copying back

Please don't ask me what on earth got into me deleting clang from the /usr/bin folder...I got weird error messages and couldn't find anything on the web...
However, I deleted clang, tried reinstalling Xcode + developer tools, but clang wasn't installed again. So I searched inside the Xcode folder and found it in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
So, I copied this (and clang++) back to my /usr/bin folder, but now I'm getting weird error messages again, e.g:
fatal error: 'stdarg.h' file not found
#include <stdarg.h>
^
1 error generated.
Any idea how I could fix this?
Try to link it instead of copying
ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang /usr/bin/clang