Unable to compile LLVM 5.0.0 with MSVC 14.0 - c++11

I am trying to compile LLVM 5.0.0 from source on Windows 10 with Visual Studio 14.0 (2015).
I used the following cmake flags:
CMAKEOPTIONS += -D PYTHON_EXECUTABLE:PATH=$(PYTHON_PATH)/bin/python
CMAKEOPTIONS += -D LLVM_ENABLE_TERMINFO=0
CMAKEOPTIONS += -D LLVM_ENABLE_EH=1
CMAKEOPTIONS += -D LLVM_ENABLE_RTTI=1
CMAKEOPTIONS += -D LLVM_ENABLE_ASSERTIONS:BOOL=ON -D LLVM_ABI_BREAKING_CHECKS:STRING="FORCE_OFF"
The compilation fails with:
Severity Code Description Project File Line Suppression State Error
C2039
'iterator_facade_base,0,1>
,std::forward_iterator_tag,llvm::PHINode const ,__int64,llvm::PHINode const *,llvm::PHINode const &>': is not a member of
'llvm::BasicBlock::phi_iterator_impl' (compiling source
file
S:\authama\3p-tmw\3p\derived\win64\LLVM5\llvm-debug\lib\Target\AMDGPU\Utils\AMDGPUBaseInfo.cpp)
LLVMAMDGPUUtils
s:\authama\3p-tmw\3p\derived\win64\llvm5\llvm-debug\include\llvm\ir\basicblock.h
294
Which points to:
290 bool operator==(const phi_iterator_impl &Arg) const { return PN == Arg.PN; }
291
292 PHINodeT &operator*() const { return *PN; }
293
294 using phi_iterator_impl::iterator_facade_base::operator++;
295 phi_iterator_impl &operator++() {
296 assert(PN && "Cannot increment the end iterator!");
297 PN = dyn_cast<PHINodeT>(std::next(BBIteratorT(PN)));
298 return *this;
299 }
The source compiles with GCC 4.9/Debian8, so I am guessing I missed something to do with setting up the compiler correctly.
Any suggestions for me to try?

As I was once told by one of the VCPP developers, "please upgrade to 2017; 2015 is an ancient bug farm." Less than useful in many instances, but if you're using the community version of 2015 (or are in a position to upgrade pro/enterprise 2015 to 2017), try upgrading to 2017 and see if that fixes it.
I had a similar problem with 2015 that turned out to be an actual compiler bug and that appears to be the issue here as well.

Related

Is VisualStudio MacOS using a different F# compiler than dotnet / Rider?

I'm trying to compile FsPickler on Mac.
The command line compilation works very well:
dotnet build -c Release
but when compiling the same project in Visual Studio (version 8.8), I start to get some compilation errors which have to do with the parsing of the files, which is really odd.
like this kind of errors:
the code it can't compile is this:
let currentLoadContext = lazy(
match Type.GetType "System.Runtime.Loader.AssemblyLoadContext" with
| null -> None
| ty ->
match ty.GetProperty "Assemblies" with
| null -> None // property not available in netcoreapp < 3.0
| assembliesProperty ->
let loadContextM = ty.GetMethod("GetLoadContext", BindingFlags.Public ||| BindingFlags.Static, null, [|typeof<Assembly>|], null)
let loadFromNameM = ty.GetMethod("LoadFromAssemblyName", BindingFlags.Public ||| BindingFlags.Instance, null, [|typeof<AssemblyName>|], null)
let asm = Assembly.GetExecutingAssembly()
let currentLoadContext = loadContextM.Invoke(null, [|asm|])
let getContextAssemblies () = assembliesProperty.GetValue(currentLoadContext) :?> seq<Assembly> |> Seq.toArray
let loadFromAssemblyName (an : AssemblyName) = loadFromNameM.Invoke(currentLoadContext, [|an|]) :?> Assembly
Some {| LoadContext = currentLoadContext ; GetCurrentAssemblies = getContextAssemblies ; LoadFromAssemblyName = loadFromAssemblyName |})
but it's not really relevant to the problem.
When I look at the details, I see that:
Target CoreCompile:
/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/fsharp/fsc.exe -o:obj/Debug/netstandard2.0/FsPickler.dll
and I'm now questioning: why do I even have Mono installed and what does Mono have to do with compiling the .net code with Visual Studio?
If I compile the same project with Rider, it works, with the command line, it works but with Visual Studio I get the errors above and a compiler coming from a Mono folder.
Can anyone shed some light as to why Mono is involved and if there are two versions of the compiler?

What is the meaning of this code line?? and What is the solution for the error?? I have this issue in Sniper Simulator version 7.2

What is the meaning of this code line?? and What is the solution for the error?? I have this issue in Sniper Simulator version 7.2 with Pin 3.5 on Linux Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 GNU/Linux. My gcc version is 8.3.0
Besides This is not my codes...
The code is:
IALARM* ALARM_MANAGER::GenAddress(){
string hex = "0x";
BOOL ctxt = _control_chain->NeedContext();
if (_alarm_value.compare(0, 2, hex) == 0){
//this is a raw address
return new ALARM_ADDRESS(_alarm_value,_tid,_count,ctxt,this);
}
if (_alarm_value.find("+",0) == string::npos){
//this is a symbol
return new ALARM_SYMBOL(_alarm_value,_tid,_count,ctxt,this);
}
else{
vector<string> tokens;
PARSER::SplitArgs("+",_alarm_value,tokens);
return new ALARM_IMAGE(tokens[0],tokens[1],_tid,_count,ctxt,this);
}
The error is:
alarm_manager.cpp:137:67: error: ‘new’ of type ‘CONTROLLER::ALARM_SYMBOL’ with extended alignment 64 [-Werror=aligned-new=]
return new ALARM_SYMBOL(_alarm_value,_tid,_count,ctxt,this);
^
alarm_manager.cpp:157:64: note: uses ‘void* operator new(size_t)’, which does not have an alignment parameter
alarm_manager.cpp:157:64: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
As Kamil said it gets solved by adding -faligned-new to the relative makefile.
use ‘-faligned-new’ to enable C++17 over-aligned new support

TypeScript compiler error: Expected ';' or ']'

This is a node project in VS 2013 with TypeScript tools and Web Essential installed (but no Resharper). I'm in process converting my javascript to typescript, and it seems to go well. However, I got a lot of errors in the Error List like
Error 1 Expected ';' C:\Azure\public\js\prototypes.ts 6 11
Error 2 Expected ',' or ']' C:\Azure\public\js\prototypes.ts 7 13
Error 3 Expected ';' C:\Azure\public\js\prototypes.ts 7 22
Error 4 Expected ',' C:\Azure\public\js\prototypes.ts 13 30
Error 5 Expected '{' C:\Azure\public\js\prototypes.ts 13 40
Error 6 Expected ';' C:\Azure\public\js\prototypes.ts 13 49
Here is the first few lines of prototypes.js:
/// <reference path="../../typings/moment/moment.d.ts" />
'use strict';
//-------------------------------------------------
// Math
//-------------------------------------------------
interface Math {
lg(value: number): number;
roundUp(value: number, digits: number): number;
roundDown(value: number, digits: number): number;
}
if (!Math.lg) {
Math.lg = function (value: number) : number {
return Math.log(value) / Math.LN10;
};
}
if (!Math.roundUp) {
Math.roundUp = function (value, digits) {
var factor = Math.pow(10, Math.floor(Math.lg(Math.abs(value))) - digits || 0);
return Math.ceil(value / factor) * factor;
};
}
if (!Math.roundDown) {
Math.roundDown = function (value, digits) {
var factor = Math.pow(10, Math.floor(Math.lg(Math.abs(value))) - digits || 1);
return Math.floor(value / factor) * factor;
};
}
Strange thing is that, even with those errors in the Error list, build succeeded and the app seems to be running fine. I also tried to uninstall WebEssential and TypeScript tools and then reinstall them, but no difference.
What is it complaining about?
UPDATE:
When I saw 1.5Beta, I immediately installed it. To my disappointment, I got more errors. Then, I decided to rollback to 1.4. But even worse...now when I open the same project it complains
Your project file uses a different version of the TypeScript
compiler and tools than is currently installed on this machine. No
compiler was found at C:\Program Files (x86)\Microsoft
SDKs\TypeScript\1.4\1.4\tsc.exe. You may be able to fix this problem
by changing the <TypeScriptToolsVersion> element in your project
file.
I don't know why the path has an extra \1.4 now. Also, I can't find <TypeScriptToolsVersion> element in my project file. I searched everywhere (including registry), and couldn't find anywhere having a path like \1.4\1.4. It's becoming my TypeScript nightmare now.
even with those errors in the Error list, build succeeded and the app seems to be running fine.
TypeScript will not block a .js emit/build in the presence of type errors. This is to make it easier for you to migrate js code to ts.
That said, the code you posted also works fine:

error c2228 left of '.ptr' must have class/struct/union

I have compilation error in MSVC express 2013, when including "filesystem.h" on any .cpp file.
"error c2228 left of '.ptr' must have class/struct/union ".
It points to error in filesystem.h file, which is part of "\microsoft visual studio 12.0\vc\include"
template<class _Path> inline
bool remove(const _Path& _Pval)
{ // remove _Pval
-->> return (_Unlink(_Pval._Ptr()) == 0);
}
Thank you for any suggestion.
After repairing the installation of visual studio, the problem disappeared.

how to fix wrong stack alignment with Eigen library under Workbench3.0 (vxworks 6.6 IDE)

I am using Eigen(3.2.0) Library under Workbench3.0 (vxworks 6.6). The compiler in this distribution is GCC version 4.1.2.
Language : c++; Operating System: winXP
the problem code is as followed:
Eigen::Matrix3d mOrigin;
/* initial mOrigin */
...
Eigen::Quaterniond qOrigin(mOrigin);
I debuged the program and found that when it runs :
Eigen::Quaterniond qOrigin(mOrigin);
it comes out the assertion and prints:
assertion failed: (reinterpret_cast(array) & 0xf) == 0 && "this assertion is explained here: " "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" " **** READ THIS WEB PAGE !!
! ****" in function Eigen::internal::plain_array::plain_array() [with T = double, int Size = 4, int MatrixOrArrayOptions = 0] at C:/WindRiver-GPPVE-3.6-IA-Eval/vxworks-6.6/target/h/Eigen/src/Core/DenseStorage.h:78
it said, fixed-size vectorizable Eigen objects must absolutely be created at 16-byte-aligned locations, otherwise SIMD instructions adressing them will crash. And that is why the assertion arises.
I think the problem is:
Compiler making a wrong assumption on stack alignment
http://eigen.tuxfamily.org/dox-devel/group__TopicWrongStackAlignment.html
it said, It appears that this was a GCC bug that has been fixed in GCC 4.5. If you hit this issue, please upgrade to GCC 4.5 and report to us, so we can update this page.
However, GCC is the intergation compiler of Workbench and I don't know how to upgrade it.
And I think I have tested the Local Solution and Global Solution, but they don't work.
Local Solution:
add "__attribute__((force_align_arg_pointer))"
class Interpolation : public InterpMath/*,public Colleague*/
{
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
...
__attribute__((force_align_arg_pointer)) ErrorID LineInterp(
const Position_MCS_rad &targetPoint,
const Position_MCS_rad &originPoint,
const Position_ACS_rad &originACS,
double Ts, double maxVel, double maxAcc,
double maxDecel, double maxJerk,
N_AxisSeqPtr &nAglSeqPtr, GrpTcpSeq *pGrpTcp = NULL)
{
Eigen::Matrix3d mOrigin;
/* initial mOrigin */
...
Eigen::Quaterniond qOrigin(mOrigin);
}
}
warning: 'force_align_arg_pointer' attribute directive ignored
Global Solution:
add compile option -mstackrealign
ccpentium -g -mtune=pentium4 -march=pentium4 -ansi -Wall -MD -MP -Xlinker -mstackrealign -IC:/WindRiver-GPPVE-3.6-IA-Eval/vxworks-6.6/target/h -IC:/WindRiver-GPPVE-3.6-IA-Eval/vxworks-6.6/target/h/wrn/coreip -IC:/WindRiver-GPPVE-3.6-IA-Eval/workspace/RobotInterface_2_2/h -DCPU=PENTIUM4 -DTOOL_FAMILY=gnu -DTOOL=gnu -D_WRS_KERNEL -o
So how can I upgrade the intergration compiler to gcc 4.5 or newer, or whether there is other solution to fix this problem ?
Thanks for reading and help.

Resources