www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Fail to build LDC2 on Windows 7 X64

reply "Zhouxuan" <pycerl qq.com> writes:
I tried building LDC2 on windows according to 
http://wiki.dlang.org/Building_and_hacking_LDC_on_Windows_using_MSVC, 
but failed while building phobos-ldc.vcxproj.

The error is:
...
...
Generating std/file.obj
  Unknown frame setup opcode!
  UNREACHABLE executed at 
D:\ldcenv\llvm\lib\Target\X86\X86MCInstLower.cpp:707!
  Stack dump:
0.        Running pass 'X86 Assembly / Object Emitter' on 
function ' _D3std4file6getcwdFZAya'
Sep 07 2013
next sibling parent reply "Zhouxuan" <pycerl qq.com> writes:
A minor issue about those instructions in the url is, both "git 
checkout -b ldc" in section "Build LDC2" failed as ldc branch 
already exists, just removing -b option works for me.

Another instruction confuse me is that, 
-DLLVM_TARGETS_TO_BUILD="X86" option to cmake while generating 
Win64 project files, is X86 instead of X64 here correct?
Sep 08 2013
parent reply "Kai Nacke" <kai redstar.de> writes:
Hi Zhouxuan!

 A minor issue about those instructions in the url is, both "git 
 checkout -b ldc" in section "Build LDC2" failed as ldc branch 
 already exists, just removing -b option works for me.
Indeed, this section can be simplified. I am going to update the instructions.
 Another instruction confuse me is that, 
 -DLLVM_TARGETS_TO_BUILD="X86" option to cmake while generating 
 Win64 project files, is X86 instead of X64 here correct?
Yes, X86 is right. It includes the 32bit and 64bit targets for Intel/AMD. There is also PowerPC for 32bit and 64bit PowerPC targets. But is no general rule: target ARM is for ARMv7 (32bit) and target AArch64 is for ARMv8 (64bit). Regards Kai
Sep 08 2013
parent "Kai Nacke" <kai redstar.de> writes:
 Indeed, this section can be simplified. I am going to update 
 the instructions.
Instructions are updated now. Kai
Sep 08 2013
prev sibling parent reply "Kai Nacke" <kai redstar.de> writes:
On Sunday, 8 September 2013 at 06:51:18 UTC, Zhouxuan wrote:
 I tried building LDC2 on windows according to 
 http://wiki.dlang.org/Building_and_hacking_LDC_on_Windows_using_MSVC, 
 but failed while building phobos-ldc.vcxproj.

 The error is:
 ...
 ...
 Generating std/file.obj
  Unknown frame setup opcode!
  UNREACHABLE executed at 
 D:\ldcenv\llvm\lib\Target\X86\X86MCInstLower.cpp:707!
  Stack dump:
 0.        Running pass 'X86 Assembly / Object Emitter' on 
 function ' _D3std4file6getcwdFZAya'
Hi Zhouxuan, I noticed that, too. It comes from my patch for EH handling. Something has changed in LLVM and I did not correct the patch yet. (I correct it as soon as I understand the LLVM changes causing the failure.) It works if you do not apply the patch. But then you get no exception handling... Regards Kai
Sep 08 2013
parent reply "Zhouxuan" <pycerl qq.com> writes:
On Sunday, 8 September 2013 at 10:21:39 UTC, Kai Nacke wrote:
 On Sunday, 8 September 2013 at 06:51:18 UTC, Zhouxuan wrote:
 I tried building LDC2 on windows according to 
 http://wiki.dlang.org/Building_and_hacking_LDC_on_Windows_using_MSVC, 
 but failed while building phobos-ldc.vcxproj.

 The error is:
 ...
 ...
 Generating std/file.obj
 Unknown frame setup opcode!
 UNREACHABLE executed at 
 D:\ldcenv\llvm\lib\Target\X86\X86MCInstLower.cpp:707!
 Stack dump:
 0.        Running pass 'X86 Assembly / Object Emitter' on 
 function ' _D3std4file6getcwdFZAya'
Hi Zhouxuan, I noticed that, too. It comes from my patch for EH handling. Something has changed in LLVM and I did not correct the patch yet. (I correct it as soon as I understand the LLVM changes causing the failure.) It works if you do not apply the patch. But then you get no exception handling... Regards Kai
Awesome, lookinng forward an update!
Sep 08 2013
parent reply "Kai Nacke" <kai redstar.de> writes:
On Sunday, 8 September 2013 at 10:59:38 UTC, Zhouxuan wrote:
 On Sunday, 8 September 2013 at 10:21:39 UTC, Kai Nacke wrote:
 On Sunday, 8 September 2013 at 06:51:18 UTC, Zhouxuan wrote:
 I tried building LDC2 on windows according to 
 http://wiki.dlang.org/Building_and_hacking_LDC_on_Windows_using_MSVC, 
 but failed while building phobos-ldc.vcxproj.

 The error is:
 ...
 ...
 Generating std/file.obj
 Unknown frame setup opcode!
 UNREACHABLE executed at 
 D:\ldcenv\llvm\lib\Target\X86\X86MCInstLower.cpp:707!
 Stack dump:
 0.        Running pass 'X86 Assembly / Object Emitter' on 
 function ' _D3std4file6getcwdFZAya'
Hi Zhouxuan, I noticed that, too. It comes from my patch for EH handling. Something has changed in LLVM and I did not correct the patch yet. (I correct it as soon as I understand the LLVM changes causing the failure.) It works if you do not apply the patch. But then you get no exception handling... Regards Kai
Awesome, lookinng forward an update!
The root cause of this problem is PR16779 (http://llvm.org/bugs/show_bug.cgi?id=16779). I try to fis this. Kai
Sep 16 2013
parent reply "tae hoo" <liteon777 hanmail.net> writes:
Hey Kai

I noticed that, too.
Would you send me the llvm SRC files which can be used with
a win64eh_all_20131021.diff file.

Thanks you.


On Monday, 16 September 2013 at 17:55:08 UTC, Kai Nacke wrote:
 On Sunday, 8 September 2013 at 10:59:38 UTC, Zhouxuan wrote:
 On Sunday, 8 September 2013 at 10:21:39 UTC, Kai Nacke wrote:
 On Sunday, 8 September 2013 at 06:51:18 UTC, Zhouxuan wrote:
 I tried building LDC2 on windows according to 
 http://wiki.dlang.org/Building_and_hacking_LDC_on_Windows_using_MSVC, 
 but failed while building phobos-ldc.vcxproj.

 The error is:
 ...
 ...
 Generating std/file.obj
 Unknown frame setup opcode!
 UNREACHABLE executed at 
 D:\ldcenv\llvm\lib\Target\X86\X86MCInstLower.cpp:707!
 Stack dump:
 0.        Running pass 'X86 Assembly / Object Emitter' on 
 function ' _D3std4file6getcwdFZAya'
Hi Zhouxuan, I noticed that, too. It comes from my patch for EH handling. Something has changed in LLVM and I did not correct the patch yet. (I correct it as soon as I understand the LLVM changes causing the failure.) It works if you do not apply the patch. But then you get no exception handling... Regards Kai
Awesome, lookinng forward an update!
The root cause of this problem is PR16779 (http://llvm.org/bugs/show_bug.cgi?id=16779). I try to fis this. Kai
Nov 11 2013
next sibling parent "tae hoo" <liteon777 hanmail.net> writes:
sorry, I'm poor at english. ^^;;;
my e-mail address : liteon777 daum.net



On Tuesday, 12 November 2013 at 06:07:16 UTC, tae hoo wrote:
 Hey Kai

 I noticed that, too.
 Would you send me the llvm SRC files which can be used with
 a win64eh_all_20131021.diff file.

 Thanks you.


 On Monday, 16 September 2013 at 17:55:08 UTC, Kai Nacke wrote:
 On Sunday, 8 September 2013 at 10:59:38 UTC, Zhouxuan wrote:
 On Sunday, 8 September 2013 at 10:21:39 UTC, Kai Nacke wrote:
 On Sunday, 8 September 2013 at 06:51:18 UTC, Zhouxuan wrote:
 I tried building LDC2 on windows according to 
 http://wiki.dlang.org/Building_and_hacking_LDC_on_Windows_using_MSVC, 
 but failed while building phobos-ldc.vcxproj.

 The error is:
 ...
 ...
 Generating std/file.obj
 Unknown frame setup opcode!
 UNREACHABLE executed at 
 D:\ldcenv\llvm\lib\Target\X86\X86MCInstLower.cpp:707!
 Stack dump:
 0.        Running pass 'X86 Assembly / Object Emitter' on 
 function ' _D3std4file6getcwdFZAya'
Hi Zhouxuan, I noticed that, too. It comes from my patch for EH handling. Something has changed in LLVM and I did not correct the patch yet. (I correct it as soon as I understand the LLVM changes causing the failure.) It works if you do not apply the patch. But then you get no exception handling... Regards Kai
Awesome, lookinng forward an update!
The root cause of this problem is PR16779 (http://llvm.org/bugs/show_bug.cgi?id=16779). I try to fis this. Kai
Nov 11 2013
prev sibling parent reply "Kai Nacke" <kai redstar.de> writes:
On Tuesday, 12 November 2013 at 06:07:16 UTC, tae hoo wrote:
 Hey Kai

 I noticed that, too.
 Would you send me the llvm SRC files which can be used with
 a win64eh_all_20131021.diff file.

 Thanks you.
Hi tae, I have updated the patch in the wiki. Just use the new version. Regards, Kai
Nov 12 2013
parent reply "tae hoo" <liteon777 hanmail.net> writes:
thanks Kai

I have used your new patch (win64eh_all_20131112.diff).
but the same problem generated.

Unknown frame setup opcode!
UNREACHABLE executed at 
C:\LDC\llvm\lib\Target\X86\X86MCInstLower.cpp:855!

I compiled with a Visual Studio 2012.
I think that the cause of this problem is related with a X64 
Prolog and
Epliog RSP register realignment.

Visual Studio 2012 does over allocates and realigns RSP

How to resolve it?
Would you upate the patch ^^;;;


Regards, Kai






On Tuesday, 12 November 2013 at 10:50:35 UTC, Kai Nacke wrote:
 On Tuesday, 12 November 2013 at 06:07:16 UTC, tae hoo wrote:
 Hey Kai

 I noticed that, too.
 Would you send me the llvm SRC files which can be used with
 a win64eh_all_20131021.diff file.

 Thanks you.
Hi tae, I have updated the patch in the wiki. Just use the new version. Regards, Kai
Nov 12 2013
parent reply "Kai Nacke" <kai redstar.de> writes:
Hi tae,

On Tuesday, 12 November 2013 at 16:24:26 UTC, tae hoo wrote:
 I have used your new patch (win64eh_all_20131112.diff).
 but the same problem generated.

 Unknown frame setup opcode!
 UNREACHABLE executed at 
 C:\LDC\llvm\lib\Target\X86\X86MCInstLower.cpp:855!

 I compiled with a Visual Studio 2012.
 I think that the cause of this problem is related with a X64 
 Prolog and
 Epliog RSP register realignment.

 Visual Studio 2012 does over allocates and realigns RSP

 How to resolve it?
That is PR16779 (http://llvm.org/bugs/show_bug.cgi?id=16779). To fix it, you have to change the generation of prolog and epliog code (located in file lib/Target/X86/X86FrameLowering.cpp).
 Would you upate the patch ^^;;;
I tried to solve the mentioned PR but so far I have no solution for it. Sorry. Currently, I am working on the next release (merge of 2.064), therefore there is no time to fix this. Volunteers are welcome. :-) Regards, Kai
Nov 12 2013
parent reply "tae hoo" <liteon777 hanmail.net> writes:
<test.d>
module test;
void poo()
{
     wchar[4096] buffW;
}

ldc2 --output-o -c -IC:/LDC/ldc/runtime/druntime/src 
-IC:/LDC/ldc/runtime/druntime/src/gc test.d -oftest.obj -w -d -O0 
-release -IC:/LDC/ldc/runtime/phobos

if you compile the above test.d, same error message generated
 Unknown frame setup opcode!
 UNREACHABLE executed at 
 C:\LDC\llvm\lib\Target\X86\X86MCInstLower.cpp:855!
But, if reduce the stack variable size to below 2000, error message not generated. <test.d> module test; void poo() { wchar[2000] buffW; } It seems to be a BUG of ldc2 compiler not stack alingment problem. On Tuesday, 12 November 2013 at 17:14:59 UTC, Kai Nacke wrote:
 Hi tae,

 On Tuesday, 12 November 2013 at 16:24:26 UTC, tae hoo wrote:
 I have used your new patch (win64eh_all_20131112.diff).
 but the same problem generated.

 Unknown frame setup opcode!
 UNREACHABLE executed at 
 C:\LDC\llvm\lib\Target\X86\X86MCInstLower.cpp:855!

 I compiled with a Visual Studio 2012.
 I think that the cause of this problem is related with a X64 
 Prolog and
 Epliog RSP register realignment.

 Visual Studio 2012 does over allocates and realigns RSP

 How to resolve it?
That is PR16779 (http://llvm.org/bugs/show_bug.cgi?id=16779). To fix it, you have to change the generation of prolog and epliog code (located in file lib/Target/X86/X86FrameLowering.cpp).
 Would you upate the patch ^^;;;
I tried to solve the mentioned PR but so far I have no solution for it. Sorry. Currently, I am working on the next release (merge of 2.064), therefore there is no time to fix this. Volunteers are welcome. :-) Regards, Kai
Nov 12 2013
parent reply "Kai Nacke" <kai redstar.de> writes:
Hi tae!

On Wednesday, 13 November 2013 at 03:42:27 UTC, tae hoo wrote:
 <test.d>
 module test;
 void poo()
 {
     wchar[4096] buffW;
 }

 ldc2 --output-o -c -IC:/LDC/ldc/runtime/druntime/src 
 -IC:/LDC/ldc/runtime/druntime/src/gc test.d -oftest.obj -w -d 
 -O0 -release -IC:/LDC/ldc/runtime/phobos

 if you compile the above test.d, same error message generated
 Unknown frame setup opcode!
 UNREACHABLE executed at 
 C:\LDC\llvm\lib\Target\X86\X86MCInstLower.cpp:855!
But, if reduce the stack variable size to below 2000, error message not generated. <test.d> module test; void poo() { wchar[2000] buffW; }
Yes, you are right. It is a bug! The sub instruction after a call to __chkstk was not regarded as valid. I already updated the patch. Please retry. And thanks for the report. :-)
 It seems to be a BUG of ldc2 compiler not stack alingment 
 problem.
A wouldn't call a problem caused by a LLVM patch a bug of ldc2, even if the author of the patch happens to be a maintainer of the ldc project. ;-) Regards, Kai
Nov 13 2013
parent reply "Kai Nacke" <kai redstar.de> writes:
Hi tae!

On Wednesday, 13 November 2013 at 19:34:32 UTC, Kai Nacke wrote:
 And thanks for the report. :-)
Your report was really inspiring. I found yet another bug and fixed it. New version of the patch (for the first time with a test case!) is already linked to the wiki page. Regards, Kai
Nov 14 2013
parent reply "tae hoo" <liteon777 daum.net> writes:
Hi Kai !

I patched llvm and succefully build druntime & phobos lib without
visual studio 2012 link warning messages. (...set1.. set2..
set3... etc)

but at final link time, the following errors generated.

D:\LDC\LDC64\lib>ldc2 test.d
phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
symbol _D3std4math
4exp2FNaNbNeeZe referenced in function _D3std4math3sinFNaNbNfcZc
phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
symbol _D3std4math
5expm1FNaNbNeeZe referenced in function _D3std4math3sinFNaNbNfcZc
phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
symbol _D3std4math
5atan2FNaNbNeeeZe referenced in function
_D3std4math4acosFNaNbNfeZe
phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
symbol _D3std4math
5truncFNbNeeZe referenced in function _D3std4math4modfFNbNeeKeZe
phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
symbol _D3std4math
20FloatingPointControl15setControlStateFNbNetZv referenced in
function _D3std4ma
th5roundFNbNeeZe
phobos-ldc.lib(thread.obj) : error LNK2019: unresolved external
symbol _D4core6t
hread14getStackBottomFZPv referenced in function thread_entryPoint
phobos-ldc.lib(thread.obj) : error LNK2019: unresolved external
symbol fiber_swi
tchContext referenced in function fiber_entryPoint
phobos-ldc.lib(threadaux.obj) : error LNK2019: unresolved
external symbol _D4cor
e3sys7windows9threadaux10thread_aux6getTEBFNbZPPv referenced in
function _D4core
3sys7windows9threadaux10thread_aux18impersonate_threadFkMDFZvZv
test.exe : fatal error LNK1120: 8 unresolved externals
Error: C:\Program Files (x86)\Microsoft Visual Studio
11.0\VC\BIN\x86_amd64\link
.exe failed with status: 1120

it seems to be someting wrong at druntime & phobos library build
CMake file
which related with compilation.

How to resolve it?






On Friday, 15 November 2013 at 06:39:53 UTC, Kai Nacke wrote:
 Hi tae!

 On Wednesday, 13 November 2013 at 19:34:32 UTC, Kai Nacke wrote:
 And thanks for the report. :-)
Your report was really inspiring. I found yet another bug and fixed it. New version of the patch (for the first time with a test case!) is already linked to the wiki page. Regards, Kai
Nov 17 2013
parent reply "Kai Nacke" <kai redstar.de> writes:
Hi tae!

On Sunday, 17 November 2013 at 14:20:23 UTC, tae hoo wrote:
 Hi Kai !

 I patched llvm and succefully build druntime & phobos lib 
 without
 visual studio 2012 link warning messages. (...set1.. set2..
 set3... etc)
How do you avoid the link warnings? I opened bug PR17967 (http://llvm.org/bugs/show_bug.cgi?id=17967) because the temporary labels are public!
 but at final link time, the following errors generated.

 D:\LDC\LDC64\lib>ldc2 test.d
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 4exp2FNaNbNeeZe referenced in function _D3std4math3sinFNaNbNfcZc
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 5expm1FNaNbNeeZe referenced in function 
 _D3std4math3sinFNaNbNfcZc
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 5atan2FNaNbNeeeZe referenced in function
 _D3std4math4acosFNaNbNfeZe
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 5truncFNbNeeZe referenced in function _D3std4math4modfFNbNeeKeZe
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 20FloatingPointControl15setControlStateFNbNetZv referenced in
 function _D3std4ma
 th5roundFNbNeeZe
 phobos-ldc.lib(thread.obj) : error LNK2019: unresolved external
 symbol _D4core6t
 hread14getStackBottomFZPv referenced in function 
 thread_entryPoint
 phobos-ldc.lib(thread.obj) : error LNK2019: unresolved external
 symbol fiber_swi
 tchContext referenced in function fiber_entryPoint
 phobos-ldc.lib(threadaux.obj) : error LNK2019: unresolved
 external symbol _D4cor
 e3sys7windows9threadaux10thread_aux6getTEBFNbZPPv referenced in
 function _D4core
 3sys7windows9threadaux10thread_aux18impersonate_threadFkMDFZvZv
 test.exe : fatal error LNK1120: 8 unresolved externals
 Error: C:\Program Files (x86)\Microsoft Visual Studio
 11.0\VC\BIN\x86_amd64\link
 .exe failed with status: 1120

 it seems to be someting wrong at druntime & phobos library build
 CMake file
 which related with compilation.

 How to resolve it?
No idea yet. I have to check it. Regards, Kai
Nov 17 2013
parent reply "tae hoo" <liteon777 hanmail.net> writes:
Hi Kai !

LLVM does generates incompatible with MS tool(case jmp table 
lable , seh lable
etc)

the problem is 'set directive'

do patch llvm, HasSetDirective from true to false.

<llvm/lib/MC/MCAsmInfo.cpp>

   GPRel64Directive = 0;
   GPRel32Directive = 0;
   GlobalDirective = "\t.globl\t";
   HasSetDirective = false;//true;      <---- this, line number 74,
   HasAggressiveSymbolFolding = true;
   COMMDirectiveAlignmentIsInBytes = true;
   LCOMMDirectiveAlignmentType = LCOMM::NoAlignment;



I used <git clone http://llvm.org/git/llvm.git llvm> version.

but final link error genarated.

which version is required for avoiding this phobos link problem?





 How do you avoid the link warnings? I opened bug PR17967  
 (http://llvm.org/bugs/show_bug.cgi?id=17967) because the 
 temporary labels are public!

 but at final link time, the following errors generated.

 D:\LDC\LDC64\lib>ldc2 test.d
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 4exp2FNaNbNeeZe referenced in function 
 _D3std4math3sinFNaNbNfcZc
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 5expm1FNaNbNeeZe referenced in function 
 _D3std4math3sinFNaNbNfcZc
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 5atan2FNaNbNeeeZe referenced in function
 _D3std4math4acosFNaNbNfeZe
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 5truncFNbNeeZe referenced in function 
 _D3std4math4modfFNbNeeKeZe
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 20FloatingPointControl15setControlStateFNbNetZv referenced in
 function _D3std4ma
 th5roundFNbNeeZe
 phobos-ldc.lib(thread.obj) : error LNK2019: unresolved external
 symbol _D4core6t
 hread14getStackBottomFZPv referenced in function 
 thread_entryPoint
 phobos-ldc.lib(thread.obj) : error LNK2019: unresolved external
 symbol fiber_swi
 tchContext referenced in function fiber_entryPoint
 phobos-ldc.lib(threadaux.obj) : error LNK2019: unresolved
 external symbol _D4cor
 e3sys7windows9threadaux10thread_aux6getTEBFNbZPPv referenced in
 function _D4core
 3sys7windows9threadaux10thread_aux18impersonate_threadFkMDFZvZv
 test.exe : fatal error LNK1120: 8 unresolved externals
 Error: C:\Program Files (x86)\Microsoft Visual Studio
 11.0\VC\BIN\x86_amd64\link
 .exe failed with status: 1120

 it seems to be someting wrong at druntime & phobos library 
 build
 CMake file
 which related with compilation.

 How to resolve it?
No idea yet. I have to check it. Regards, Kai
Nov 17 2013
next sibling parent reply "tae hoo" <liteon777 hanmail.net> writes:
Hi Kai !

Sorry, I am poor at english ^^;;;

LVM does generates incompatible with MS tool(case jmp table
lable , seh lable
etc)

the problem is 'set directive'

do patch llvm, HasSetDirective from true to false.

<llvm/lib/MC/MCAsmInfo.cpp>

   GPRel64Directive = 0;
   GPRel32Directive = 0;
   GlobalDirective = "\t.globl\t";
   HasSetDirective = false;//true;      <---- this, line number 74,
   HasAggressiveSymbolFolding = true;
   COMMDirectiveAlignmentIsInBytes = true;
   LCOMMDirectiveAlignmentType = LCOMM::NoAlignment;


I used <git clone --recursive 
https://github.com/ldc-developers/ldc.git> version.

but final link error genarated.

which version is required to avoide this phobos link problem?





 How do you avoid the link warnings? I opened bug PR17967  
 (http://llvm.org/bugs/show_bug.cgi?id=17967) because the 
 temporary labels are public!

 but at final link time, the following errors generated.

 D:\LDC\LDC64\lib>ldc2 test.d
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 4exp2FNaNbNeeZe referenced in function 
 _D3std4math3sinFNaNbNfcZc
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 5expm1FNaNbNeeZe referenced in function 
 _D3std4math3sinFNaNbNfcZc
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 5atan2FNaNbNeeeZe referenced in function
 _D3std4math4acosFNaNbNfeZe
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 5truncFNbNeeZe referenced in function 
 _D3std4math4modfFNbNeeKeZe
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 20FloatingPointControl15setControlStateFNbNetZv referenced in
 function _D3std4ma
 th5roundFNbNeeZe
 phobos-ldc.lib(thread.obj) : error LNK2019: unresolved 
 external
 symbol _D4core6t
 hread14getStackBottomFZPv referenced in function 
 thread_entryPoint
 phobos-ldc.lib(thread.obj) : error LNK2019: unresolved 
 external
 symbol fiber_swi
 tchContext referenced in function fiber_entryPoint
 phobos-ldc.lib(threadaux.obj) : error LNK2019: unresolved
 external symbol _D4cor
 e3sys7windows9threadaux10thread_aux6getTEBFNbZPPv referenced 
 in
 function _D4core
 3sys7windows9threadaux10thread_aux18impersonate_threadFkMDFZvZv
 test.exe : fatal error LNK1120: 8 unresolved externals
 Error: C:\Program Files (x86)\Microsoft Visual Studio
 11.0\VC\BIN\x86_amd64\link
 .exe failed with status: 1120

 it seems to be someting wrong at druntime & phobos library 
 build
 CMake file
 which related with compilation.

 How to resolve it?
No idea yet. I have to check it. Regards, Kai
Nov 17 2013
parent "Kai Nacke" <kai redstar.de> writes:
Hi tae!

On Sunday, 17 November 2013 at 19:17:02 UTC, tae hoo wrote:
 Hi Kai !

 Sorry, I am poor at english ^^;;;
No problem at all. I am also no native speaker.
 LVM does generates incompatible with MS tool(case jmp table
 lable , seh lable
 etc)

 the problem is 'set directive'

 do patch llvm, HasSetDirective from true to false.

 <llvm/lib/MC/MCAsmInfo.cpp>

   GPRel64Directive = 0;
   GPRel32Directive = 0;
   GlobalDirective = "\t.globl\t";
   HasSetDirective = false;//true;      <---- this, line number 
 74,
   HasAggressiveSymbolFolding = true;
   COMMDirectiveAlignmentIsInBytes = true;
   LCOMMDirectiveAlignmentType = LCOMM::NoAlignment;
Great information. :-) I think it is a bit to generic. I set HasSetDirective = false; in class X86MCAsmInfoMicrosoft and it works, too. I added this piece of information to the PR.
 I used <git clone --recursive 
 https://github.com/ldc-developers/ldc.git> version.

 but final link error genarated.

 which version is required to avoide this phobos link problem?
I am still investigating. There might simply something missing - I was/am busy with a lot of other issues, too. Regards, Kai
Nov 17 2013
prev sibling parent reply "Kai Nacke" <kai redstar.de> writes:
Hi tae!

On Sunday, 17 November 2013 at 18:03:51 UTC, tae hoo wrote:
 the problem is 'set directive'
This error is fixed in LLVM head now. Regards, Kai
Nov 19 2013
parent reply "tae hoo" <liteon777 daum.net> writes:
Ok. :)

Hi Kai!

Did you resolved the final link error?


D:\LDC\LDC64\lib>ldc2 test.d
phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
symbol _D3std4math
4exp2FNaNbNeeZe referenced in function _D3std4math3sinFNaNbNfcZc
phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
symbol _D3std4math
5expm1FNaNbNeeZe referenced in function _D3std4math3sinFNaNbNfcZc
phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
symbol _D3std4math
5atan2FNaNbNeeeZe referenced in function
_D3std4math4acosFNaNbNfeZe
......


It is not a simple problem.

for example, _D3std4math4exp2FNaNbNeeZe(mangled name of 'exp2') is
already defined in same module math.obj.




On Tuesday, 19 November 2013 at 11:55:10 UTC, Kai Nacke wrote:
 Hi tae!

 On Sunday, 17 November 2013 at 18:03:51 UTC, tae hoo wrote:
 the problem is 'set directive'
This error is fixed in LLVM head now. Regards, Kai
Nov 19 2013
parent "Kai Nacke" <kai redstar.de> writes:
Hi tae!

On Tuesday, 19 November 2013 at 16:27:31 UTC, tae hoo wrote:
 Ok. :)

 Hi Kai!

 Did you resolved the final link error?
No, I had no time yet...
 D:\LDC\LDC64\lib>ldc2 test.d
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 4exp2FNaNbNeeZe referenced in function _D3std4math3sinFNaNbNfcZc
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 5expm1FNaNbNeeZe referenced in function 
 _D3std4math3sinFNaNbNfcZc
 phobos-ldc.lib(math.obj) : error LNK2019: unresolved external
 symbol _D3std4math
 5atan2FNaNbNeeeZe referenced in function
 _D3std4math4acosFNaNbNfeZe
 ......


 It is not a simple problem.

 for example, _D3std4math4exp2FNaNbNeeZe(mangled name of 'exp2') 
 is
 already defined in same module math.obj.
The link error is a bit strange because the implementation of std.math.sin() does not use std.math.exp2(). Regards, Kai
Nov 21 2013