strange -fPIC compilation error

2016-10-30 Thread Charles Hixson via Digitalmars-d-learn

 dmd --version
DMD64 D Compiler v2.071.2
Copyright (c) 1999-2015 by Digital Mars written by Walter Bright
on debian testing.

dub is installed via apt-get.

Should I revert to an earlier version?  Or what?

The program:


importstd.stdio;

voidmain()
{//int[]t1;

//t1~=1;
//t1~=2;
//writeln ("t1 = ", t1);
}

fails with the 442 lines of error:

/usr/bin/ld: test.o: relocation R_X86_64_32 against symbol 
`__dmd_personality_v0' can not be used when making a shared object; 
recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_224_3b4.o): relocation 
R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when 
making a shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_227_4a2.o): relocation 
R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when 
making a shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_229_5cc.o): relocation 
R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when 
making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_626_47b.o): 
relocation R_X86_64_32 against symbol `_D6object9Throwable7__ClassZ' can 
not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_628_776.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be 
used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(dwarfeh_62b_6b9.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be 
used when making a shared object; recompile with -fPIC

...

/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(aaA_51a_53e.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be 
used when making a shared object; recompile with -fPIC

/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
--- errorlevel 1



Re: strange -fPIC compilation error

2016-10-30 Thread Lodovico Giaretta via Digitalmars-d-learn

On Sunday, 30 October 2016 at 18:02:28 UTC, Charles Hixson wrote:

 dmd --version
DMD64 D Compiler v2.071.2
Copyright (c) 1999-2015 by Digital Mars written by Walter Bright
on debian testing.

dub is installed via apt-get.

Should I revert to an earlier version?  Or what?

The program:


importstd.stdio;

voidmain()
{//int[]t1;

//t1~=1;
//t1~=2;
//writeln ("t1 = ", t1);
}

fails with the 442 lines of error:

/usr/bin/ld: test.o: relocation R_X86_64_32 against symbol 
`__dmd_personality_v0' can not be used when making a shared 
object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_224_3b4.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' 
can not be used when making a shared object; recompile with 
-fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_227_4a2.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' 
can not be used when making a shared object; recompile with 
-fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_229_5cc.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' 
can not be used when making a shared object; recompile with 
-fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_626_47b.o): 
relocation R_X86_64_32 against symbol 
`_D6object9Throwable7__ClassZ' can not be used when making a 
shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_628_776.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' 
can not be used when making a shared object; recompile with 
-fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(dwarfeh_62b_6b9.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' 
can not be used when making a shared object; recompile with 
-fPIC

...

/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(aaA_51a_53e.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' 
can not be used when making a shared object; recompile with 
-fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on 
output

collect2: error: ld returned 1 exit status
--- errorlevel 1


Are you on Ubuntu 16.10, or some other system with an hardened 
toolchain? If that's the case, you should compile with `-fPIC 
-defaultlib=libphobos2.so`. You can put those options in your 
dmd.conf configuration file, so that you don't have to type them 
every time.


Re: strange -fPIC compilation error

2016-10-30 Thread Charles Hixson via Digitalmars-d-learn



On 10/30/2016 04:03 PM, Lodovico Giaretta via Digitalmars-d-learn wrote:

On Sunday, 30 October 2016 at 18:02:28 UTC, Charles Hixson wrote:

 dmd --version
DMD64 D Compiler v2.071.2
Copyright (c) 1999-2015 by Digital Mars written by Walter Bright
on debian testing.

dub is installed via apt-get.

Should I revert to an earlier version?  Or what?

The program:


importstd.stdio;

voidmain()
{//int[]t1;

//t1~=1;
//t1~=2;
//writeln ("t1 = ", t1);
}

fails with the 442 lines of error:

/usr/bin/ld: test.o: relocation R_X86_64_32 against symbol 
`__dmd_personality_v0' can not be used when making a shared object; 
recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_224_3b4.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not 
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_227_4a2.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not 
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_229_5cc.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not 
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_626_47b.o): relocation 
R_X86_64_32 against symbol `_D6object9Throwable7__ClassZ' can not be 
used when making a shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_628_776.o): relocation 
R_X86_64_32 against symbol `__dmd_personality_v0' can not be used 
when making a shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(dwarfeh_62b_6b9.o): relocation 
R_X86_64_32 against symbol `__dmd_personality_v0' can not be used 
when making a shared object; recompile with -fPIC

...

/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(aaA_51a_53e.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not 
be used when making a shared object; recompile with -fPIC

/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
--- errorlevel 1


Are you on Ubuntu 16.10, or some other system with an hardened 
toolchain? If that's the case, you should compile with `-fPIC 
-defaultlib=libphobos2.so`. You can put those options in your dmd.conf 
configuration file, so that you don't have to type them every time.


Well, I'm using debian, but I've never had to do anything of that nature 
before.  OTOH, it's been a couple of months if this is a new change.


Re: strange -fPIC compilation error

2016-10-30 Thread Charles Hixson via Digitalmars-d-learn
Just as a test I tried it with ldc, and, as expected, there wasn't any 
problem.



On 10/30/2016 11:02 AM, Charles Hixson via Digitalmars-d-learn wrote:

 dmd --version
DMD64 D Compiler v2.071.2
Copyright (c) 1999-2015 by Digital Mars written by Walter Bright
on debian testing.

dub is installed via apt-get.

Should I revert to an earlier version?  Or what?

The program:


importstd.stdio;

voidmain()
{//int[]t1;

//t1~=1;
//t1~=2;
//writeln ("t1 = ", t1);
}

fails with the 442 lines of error:

/usr/bin/ld: test.o: relocation R_X86_64_32 against symbol 
`__dmd_personality_v0' can not be used when making a shared object; 
recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_224_3b4.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not 
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_227_4a2.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not 
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_229_5cc.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not 
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_626_47b.o): 
relocation R_X86_64_32 against symbol `_D6object9Throwable7__ClassZ' 
can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_628_776.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not 
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(dwarfeh_62b_6b9.o): relocation 
R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when 
making a shared object; recompile with -fPIC

...

/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(aaA_51a_53e.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not 
be used when making a shared object; recompile with -fPIC

/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
--- errorlevel 1






Re: strange -fPIC compilation error

2016-10-30 Thread Charles Hixson via Digitalmars-d-learn
So now I removed the repository version of dmd and dub, downloaded DMD64 
D Compiler v2.072.0-b2, used dkpg to install it, and appear to get the 
same errors.


(Well, actually I removed the commenting out of the code, but it 
compiles and runs properly with ldc2.)



On 10/30/2016 11:02 AM, Charles Hixson via Digitalmars-d-learn wrote:

 dmd --version
DMD64 D Compiler v2.071.2
Copyright (c) 1999-2015 by Digital Mars written by Walter Bright
on debian testing.

dub is installed via apt-get.

Should I revert to an earlier version?  Or what?

The program:


importstd.stdio;

voidmain()
{//int[]t1;

//t1~=1;
//t1~=2;
//writeln ("t1 = ", t1);
}

fails with the 442 lines of error:

/usr/bin/ld: test.o: relocation R_X86_64_32 against symbol 
`__dmd_personality_v0' can not be used when making a shared object; 
recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_224_3b4.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not 
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_227_4a2.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not 
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(exception_229_5cc.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not 
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_626_47b.o): 
relocation R_X86_64_32 against symbol `_D6object9Throwable7__ClassZ' 
can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_628_776.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not 
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libphobos2.a(dwarfeh_62b_6b9.o): relocation 
R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when 
making a shared object; recompile with -fPIC

...

/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(aaA_51a_53e.o): 
relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not 
be used when making a shared object; recompile with -fPIC

/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
--- errorlevel 1






Re: strange -fPIC compilation error

2016-10-30 Thread Lodovico Giaretta via Digitalmars-d-learn

On Monday, 31 October 2016 at 00:08:59 UTC, Charles Hixson wrote:
So now I removed the repository version of dmd and dub, 
downloaded DMD64 D Compiler v2.072.0-b2, used dkpg to install 
it, and appear to get the same errors.


(Well, actually I removed the commenting out of the code, but 
it compiles and runs properly with ldc2.)


I don't think it's a problem of DMD. This is due to your gcc 
installation being hardened, that is, configured to produce PIE 
by default. To produce PIE, the linker needs to be fed PIC, which 
DMD does not produce by default. The -fPIC flags makes DMD 
produce PIC out of your sources. The problem is, libphobos2.a 
(the static version of Phobos) is not compiled with -fPIC, so 
even if your code is PIC, gcc will complain. The workaround is to 
use -defaultlib=libphobos2.so to dynamically link with the shared 
version of Phobos. Being it a shared object, it does not give any 
problem with PIE.


Looking on internet, I didn't find any clue about Debian shipping 
an hardened gcc, but this is the only cause I can think of for 
the behaviour you are experiencing.


Re: strange -fPIC compilation error

2016-10-30 Thread Charles Hixson via Digitalmars-d-learn



On 10/30/2016 05:14 PM, Lodovico Giaretta via Digitalmars-d-learn wrote:

On Monday, 31 October 2016 at 00:08:59 UTC, Charles Hixson wrote:
So now I removed the repository version of dmd and dub, downloaded 
DMD64 D Compiler v2.072.0-b2, used dkpg to install it, and appear to 
get the same errors.


(Well, actually I removed the commenting out of the code, but it 
compiles and runs properly with ldc2.)


I don't think it's a problem of DMD. This is due to your gcc 
installation being hardened, that is, configured to produce PIE by 
default. To produce PIE, the linker needs to be fed PIC, which DMD 
does not produce by default. The -fPIC flags makes DMD produce PIC out 
of your sources. The problem is, libphobos2.a (the static version of 
Phobos) is not compiled with -fPIC, so even if your code is PIC, gcc 
will complain. The workaround is to use -defaultlib=libphobos2.so to 
dynamically link with the shared version of Phobos. Being it a shared 
object, it does not give any problem with PIE.


Looking on internet, I didn't find any clue about Debian shipping an 
hardened gcc, but this is the only cause I can think of for the 
behaviour you are experiencing.



Well, that certainly changed the error messages.  With
dmd -defaultlib=/usr/lib/x86_64-linux-gnu/libphobos2.so test.d
I get:
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1121): Error: found 
'nothrow' when expecting '{'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1123): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1124): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1125): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1126): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1127): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1128): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1129): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1133): Error: asm 
statements must end in ';'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1136): Error: found 
'private' instead of statement
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1146): Error: no 
identifier for declarator add
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1149): Error: no 
identifier for declarator usDone
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1149): Error: 
Declaration expected, not ':'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1157): Error: 
Declaration expected, not '('
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1159): Error: 
Declaration expected, not 'foreach'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1159): Error: 
Declaration expected, not '0'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1164): Error: no 
identifier for declarator __fhnd_info[fd]
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1164): Error: 
Declaration expected, not '='
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1165): Error: 
Declaration expected, not 'return'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1167): Error: 
unrecognized declaration
/usr/include/dmd/phobos/std/typecons.d(1124): Error: semicolon expected 
following function declaration




Re: strange -fPIC compilation error

2016-10-30 Thread Daniel Kozak via Digitalmars-d-learn

Dne 31.10.2016 v 02:30 Charles Hixson via Digitalmars-d-learn napsal(a):



Well, that certainly changed the error messages.  With
dmd -defaultlib=/usr/lib/x86_64-linux-gnu/libphobos2.so test.d
I get:
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1121): Error: found 
'nothrow' when expecting '{'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1123): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1124): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1125): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1126): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1127): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1128): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1129): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1133): Error: asm 
statements must end in ';'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1136): Error: found 
'private' instead of statement
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1146): Error: no 
identifier for declarator add
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1149): Error: no 
identifier for declarator usDone
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1149): Error: 
Declaration expected, not ':'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1157): Error: 
Declaration expected, not '('
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1159): Error: 
Declaration expected, not 'foreach'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1159): Error: 
Declaration expected, not '0'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1164): Error: no 
identifier for declarator __fhnd_info[fd]
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1164): Error: 
Declaration expected, not '='
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1165): Error: 
Declaration expected, not 'return'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1167): Error: 
unrecognized declaration
/usr/include/dmd/phobos/std/typecons.d(1124): Error: semicolon 
expected following function declaration


This seems to be problem with your installation, you probably have 
diferen version of dmd compiler and phobos library. So you should 
uninstall all your dmd packages and make sure there is no 
/usr/include/dmd left in your system. And instal dmd only from one 
source (d-apt idealy).


Re: strange -fPIC compilation error

2016-10-31 Thread Sebastien Alaiwan via Digitalmars-d-learn

Hello,
From GCC 6.2, -fpie is becoming the default setting at compile 
and at link time.
As dmd uses GCC to link, now the code needs to be compiled with a 
special option.
Which means you need, at the moment, to add the following options 
to your dmd.conf:

 -defaultlib=libphobos2.so -fPIC
(the change from GCC is related to security and address space 
randomization).


Re: strange -fPIC compilation error

2016-10-31 Thread Charles Hixson via Digitalmars-d-learn

On 10/30/2016 11:34 PM, Daniel Kozak via Digitalmars-d-learn wrote:

Dne 31.10.2016 v 02:30 Charles Hixson via Digitalmars-d-learn napsal(a):



Well, that certainly changed the error messages.  With
dmd -defaultlib=/usr/lib/x86_64-linux-gnu/libphobos2.so test.d
I get:
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1121): Error: 
found 'nothrow' when expecting '{'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1123): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1124): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1125): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1126): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1127): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1128): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1129): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1133): Error: asm 
statements must end in ';'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1136): Error: 
found 'private' instead of statement
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1146): Error: no 
identifier for declarator add
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1149): Error: no 
identifier for declarator usDone
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1149): Error: 
Declaration expected, not ':'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1157): Error: 
Declaration expected, not '('
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1159): Error: 
Declaration expected, not 'foreach'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1159): Error: 
Declaration expected, not '0'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1164): Error: no 
identifier for declarator __fhnd_info[fd]
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1164): Error: 
Declaration expected, not '='
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1165): Error: 
Declaration expected, not 'return'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1167): Error: 
unrecognized declaration
/usr/include/dmd/phobos/std/typecons.d(1124): Error: semicolon 
expected following function declaration


This seems to be problem with your installation, you probably have 
diferen version of dmd compiler and phobos library. So you should 
uninstall all your dmd packages and make sure there is no 
/usr/include/dmd left in your system. And instal dmd only from one 
source (d-apt idealy).


I've done that 2 or 3 times.  If that's the problem, then there are 
different versions stored in the repository.  Since I'm on debian 
testing I'd been assuming that there'd been some system change since I'd 
last used the compiler, and the debs weren't yet up to date. The only 
updates to my system prior to the compiler breaking HAD been via 
apt-get.  Since then I've used dpkg remove and install a couple of times 
to try other versions of dmd with no benefit.

Currently dmd-bin version 2.071.2-0
  libphobos2.071.2-0
  libphobos2.071.2-0
so they're LISTED as being the same version.  And dmd.conf was installed 
by the deb, and is (eliminating the comments):

[Environment32]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import 
-L-L/usr/lib/i386-linux-gnu -L--export-dynamic


[Environment64]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import 
-L-L/usr/lib/x86_64-linux-gnu -L--export-dynamic


But somewhere during the process (which included the nightly system 
update) the error messages changed, and now:

dmd test.d
yields:
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1121): Error: found 
'nothrow' when expecting '{'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1123): Error: 
mismatched number of curly brackets

...
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1167): Error: 
unrecognized declaration
/usr/include/dmd/phobos/std/typecons.d(1124): Error: semicolon expected 
following function declaration




Re: strange -fPIC compilation error

2016-10-31 Thread Charles Hixson via Digitalmars-d-learn


On 10/31/2016 09:26 AM, Charles Hixson via Digitalmars-d-learn wrote:

On 10/30/2016 11:34 PM, Daniel Kozak via Digitalmars-d-learn wrote:

Dne 31.10.2016 v 02:30 Charles Hixson via Digitalmars-d-learn napsal(a):



Well, that certainly changed the error messages.  With
dmd -defaultlib=/usr/lib/x86_64-linux-gnu/libphobos2.so test.d
I get:
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1121): Error: 
found 'nothrow' when expecting '{'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1123): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1124): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1125): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1126): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1127): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1128): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1129): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1133): Error: asm 
statements must end in ';'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1136): Error: 
found 'private' instead of statement
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1146): Error: no 
identifier for declarator add
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1149): Error: no 
identifier for declarator usDone
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1149): Error: 
Declaration expected, not ':'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1157): Error: 
Declaration expected, not '('
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1159): Error: 
Declaration expected, not 'foreach'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1159): Error: 
Declaration expected, not '0'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1164): Error: no 
identifier for declarator __fhnd_info[fd]
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1164): Error: 
Declaration expected, not '='
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1165): Error: 
Declaration expected, not 'return'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1167): Error: 
unrecognized declaration
/usr/include/dmd/phobos/std/typecons.d(1124): Error: semicolon 
expected following function declaration


This seems to be problem with your installation, you probably have 
diferen version of dmd compiler and phobos library. So you should 
uninstall all your dmd packages and make sure there is no 
/usr/include/dmd left in your system. And instal dmd only from one 
source (d-apt idealy).


I've done that 2 or 3 times.  If that's the problem, then there are 
different versions stored in the repository.  Since I'm on debian 
testing I'd been assuming that there'd been some system change since 
I'd last used the compiler, and the debs weren't yet up to date. The 
only updates to my system prior to the compiler breaking HAD been via 
apt-get.  Since then I've used dpkg remove and install a couple of 
times to try other versions of dmd with no benefit.

Currently dmd-bin version 2.071.2-0
  libphobos2.071.2-0
  libphobos2.071.2-0
so they're LISTED as being the same version.  And dmd.conf was 
installed by the deb, and is (eliminating the comments):

[Environment32]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import 
-L-L/usr/lib/i386-linux-gnu -L--export-dynamic


[Environment64]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import 
-L-L/usr/lib/x86_64-linux-gnu -L--export-dynamic


But somewhere during the process (which included the nightly system 
update) the error messages changed, and now:

dmd test.d
yields:
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1121): Error: found 
'nothrow' when expecting '{'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1123): Error: 
mismatched number of curly brackets

...
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1167): Error: 
unrecognized declaration
/usr/include/dmd/phobos/std/typecons.d(1124): Error: semicolon 
expected following function declaration

FWIW starting at /usr/include/dmd/druntime/import/core/stdc/stdio.d(1121)::
asm nothrow @nogc
{
mov EDX, num;
lock;
inc _iSemLockCtrs[EDX * 2];
so nothrow isn't being seen as appropriate at the beginning of an asm 
block.  After that I think it gets confused as 1123 doesn't HAVE a brace 
(i.e. curly bracket) in it.




Re: strange -fPIC compilation error

2016-10-31 Thread Daniel Kozak via Digitalmars-d-learn

Dne 31.10.2016 v 18:06 Charles Hixson via Digitalmars-d-learn napsal(a):


On 10/31/2016 09:26 AM, Charles Hixson via Digitalmars-d-learn wrote:

On 10/30/2016 11:34 PM, Daniel Kozak via Digitalmars-d-learn wrote:
Dne 31.10.2016 v 02:30 Charles Hixson via Digitalmars-d-learn 
napsal(a):




Well, that certainly changed the error messages.  With
dmd -defaultlib=/usr/lib/x86_64-linux-gnu/libphobos2.so test.d
I get:
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1121): Error: 
found 'nothrow' when expecting '{'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1123): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1124): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1125): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1126): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1127): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1128): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1129): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1133): Error: 
asm statements must end in ';'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1136): Error: 
found 'private' instead of statement
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1146): Error: no 
identifier for declarator add
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1149): Error: no 
identifier for declarator usDone
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1149): Error: 
Declaration expected, not ':'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1157): Error: 
Declaration expected, not '('
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1159): Error: 
Declaration expected, not 'foreach'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1159): Error: 
Declaration expected, not '0'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1164): Error: no 
identifier for declarator __fhnd_info[fd]
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1164): Error: 
Declaration expected, not '='
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1165): Error: 
Declaration expected, not 'return'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1167): Error: 
unrecognized declaration
/usr/include/dmd/phobos/std/typecons.d(1124): Error: semicolon 
expected following function declaration


This seems to be problem with your installation, you probably have 
diferen version of dmd compiler and phobos library. So you should 
uninstall all your dmd packages and make sure there is no 
/usr/include/dmd left in your system. And instal dmd only from one 
source (d-apt idealy).


I've done that 2 or 3 times.  If that's the problem, then there are 
different versions stored in the repository.  Since I'm on debian 
testing I'd been assuming that there'd been some system change since 
I'd last used the compiler, and the debs weren't yet up to date. The 
only updates to my system prior to the compiler breaking HAD been via 
apt-get.  Since then I've used dpkg remove and install a couple of 
times to try other versions of dmd with no benefit.

Currently dmd-bin version 2.071.2-0
  libphobos2.071.2-0
  libphobos2.071.2-0
so they're LISTED as being the same version.  And dmd.conf was 
installed by the deb, and is (eliminating the comments):

[Environment32]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import 
-L-L/usr/lib/i386-linux-gnu -L--export-dynamic


[Environment64]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import 
-L-L/usr/lib/x86_64-linux-gnu -L--export-dynamic


But somewhere during the process (which included the nightly system 
update) the error messages changed, and now:

dmd test.d
yields:
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1121): Error: 
found 'nothrow' when expecting '{'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1123): Error: 
mismatched number of curly brackets

...
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1167): Error: 
unrecognized declaration
/usr/include/dmd/phobos/std/typecons.d(1124): Error: semicolon 
expected following function declaration
FWIW starting at 
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1121)::

asm nothrow @nogc
{
mov EDX, num;
lock;
inc _iSemLockCtrs[EDX * 2];
so nothrow isn't being seen as appropriate at the beginning of an asm 
block.  After that I think it gets confused as 1123 doesn't HAVE a 
brace (i.e. curly bracket) in it.



when you type dmd --version what it prints?


Re: strange -fPIC compilation error

2016-10-31 Thread Charles Hixson via Digitalmars-d-learn



On 10/31/2016 11:23 AM, Daniel Kozak via Digitalmars-d-learn wrote:

Dne 31.10.2016 v 18:06 Charles Hixson via Digitalmars-d-learn napsal(a):


On 10/31/2016 09:26 AM, Charles Hixson via Digitalmars-d-learn wrote:

On 10/30/2016 11:34 PM, Daniel Kozak via Digitalmars-d-learn wrote:
Dne 31.10.2016 v 02:30 Charles Hixson via Digitalmars-d-learn 
napsal(a):




Well, that certainly changed the error messages.  With
dmd -defaultlib=/usr/lib/x86_64-linux-gnu/libphobos2.so test.d
I get:
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1121): Error: 
found 'nothrow' when expecting '{'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1123): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1124): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1125): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1126): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1127): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1128): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1129): Error: 
mismatched number of curly brackets
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1133): Error: 
asm statements must end in ';'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1136): Error: 
found 'private' instead of statement
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1146): Error: 
no identifier for declarator add
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1149): Error: 
no identifier for declarator usDone
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1149): Error: 
Declaration expected, not ':'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1157): Error: 
Declaration expected, not '('
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1159): Error: 
Declaration expected, not 'foreach'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1159): Error: 
Declaration expected, not '0'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1164): Error: 
no identifier for declarator __fhnd_info[fd]
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1164): Error: 
Declaration expected, not '='
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1165): Error: 
Declaration expected, not 'return'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1167): Error: 
unrecognized declaration
/usr/include/dmd/phobos/std/typecons.d(1124): Error: semicolon 
expected following function declaration


This seems to be problem with your installation, you probably have 
diferen version of dmd compiler and phobos library. So you should 
uninstall all your dmd packages and make sure there is no 
/usr/include/dmd left in your system. And instal dmd only from one 
source (d-apt idealy).


I've done that 2 or 3 times.  If that's the problem, then there are 
different versions stored in the repository.  Since I'm on debian 
testing I'd been assuming that there'd been some system change since 
I'd last used the compiler, and the debs weren't yet up to date. The 
only updates to my system prior to the compiler breaking HAD been 
via apt-get.  Since then I've used dpkg remove and install a couple 
of times to try other versions of dmd with no benefit.

Currently dmd-bin version 2.071.2-0
  libphobos2.071.2-0
  libphobos2.071.2-0
so they're LISTED as being the same version.  And dmd.conf was 
installed by the deb, and is (eliminating the comments):

[Environment32]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import 
-L-L/usr/lib/i386-linux-gnu -L--export-dynamic


[Environment64]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import 
-L-L/usr/lib/x86_64-linux-gnu -L--export-dynamic


But somewhere during the process (which included the nightly system 
update) the error messages changed, and now:

dmd test.d
yields:
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1121): Error: 
found 'nothrow' when expecting '{'
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1123): Error: 
mismatched number of curly brackets

...
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1167): Error: 
unrecognized declaration
/usr/include/dmd/phobos/std/typecons.d(1124): Error: semicolon 
expected following function declaration
FWIW starting at 
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1121)::

asm nothrow @nogc
{
mov EDX, num;
lock;
inc _iSemLockCtrs[EDX * 2];
so nothrow isn't being seen as appropriate at the beginning of an asm 
block.  After that I think it gets confused as 1123 doesn't HAVE a 
brace (i.e. curly bracket) in it.



when you type dmd --version what it prints?


THAT WAS THE CLUE!
(that which follows is how I proceeded to the answer after that clue.)
 dmd -version
Error: unrecognized switch '-version'
and
dmd --version
Error: un

Re: strange -fPIC compilation error

2016-10-31 Thread Daniel Kozak via Digitalmars-d-learn

Dne 31.10.2016 v 20:20 Charles Hixson via Digitalmars-d-learn napsal(a):


...

but
dmd -defaultlib=libphobos2.so -fPIC test.d
works.  It shouldn't be required (as in the default /etc/dmd.conf 
should handle it correctly, but I can deal with it now.


It should work, it is possible that you have some another dmd.conf 
somewhere?




Re: strange -fPIC compilation error

2016-10-31 Thread Charles Hixson via Digitalmars-d-learn

On 10/31/2016 12:31 PM, Daniel Kozak via Digitalmars-d-learn wrote:

Dne 31.10.2016 v 20:20 Charles Hixson via Digitalmars-d-learn napsal(a):


...

but
dmd -defaultlib=libphobos2.so -fPIC test.d
works.  It shouldn't be required (as in the default /etc/dmd.conf 
should handle it correctly, but I can deal with it now.


It should work, it is possible that you have some another dmd.conf 
somewhere?



I did have a couple lying around, but they worked fine in the past, and 
renaming them didn't fix, or even just change, anything.  I've still got 
some others on my backup partition, but I can't imagine that they would 
be in use.


One of them was there because I had a few macros that were specified in 
an external ddoc file that was used by one project, e.g.


Re: strange -fPIC compilation error

2016-11-01 Thread Mike Parker via Digitalmars-d-learn

On Monday, 31 October 2016 at 19:20:21 UTC, Charles Hixson wrote:


but
dmd -defaultlib=libphobos2.so -fPIC test.d
works.  It shouldn't be required (as in the default 
/etc/dmd.conf should handle it correctly, but I can deal with 
it now.


The need to manually add this to dmd.conf is a very recent 
development and only on specific systems. I expect at some point 
they will either become the default or, better, the installer 
scripts will have to detect if they are necessary.


Re: strange -fPIC compilation error

2016-11-01 Thread Nordlöw via Digitalmars-d-learn

On Tuesday, 1 November 2016 at 07:15:19 UTC, Mike Parker wrote:

but
dmd -defaultlib=libphobos2.so -fPIC test.d
works.  It shouldn't be required (as in the default 
/etc/dmd.conf should handle it correctly, but I can deal with 
it now.


Can this be fed as parameters to the DMD call (programmatically) 
instead of manual editing of dmd.conf?


Re: strange -fPIC compilation error

2016-11-01 Thread Charles Hixson via Digitalmars-d-learn

On 11/01/2016 12:52 AM, Nordlöw via Digitalmars-d-learn wrote:

On Tuesday, 1 November 2016 at 07:15:19 UTC, Mike Parker wrote:

but
dmd -defaultlib=libphobos2.so -fPIC test.d
works.  It shouldn't be required (as in the default /etc/dmd.conf 
should handle it correctly, but I can deal with it now.


Can this be fed as parameters to the DMD call (programmatically) 
instead of manual editing of dmd.conf?



I did feed it into the dmd call programmatically.  Thus:
 dmd -defaultlib=libphobos2.so -fPIC test.d

I'm reluctant to edit the dmd.conf file as I don't really understand the 
syntax...and I have to be root to do the editing.


Re: strange -fPIC compilation error

2016-11-01 Thread bachmeier via Digitalmars-d-learn

On Tuesday, 1 November 2016 at 17:23:54 UTC, Charles Hixson wrote:

On 11/01/2016 12:52 AM, Nordlöw via Digitalmars-d-learn wrote:

On Tuesday, 1 November 2016 at 07:15:19 UTC, Mike Parker wrote:

but
dmd -defaultlib=libphobos2.so -fPIC test.d
works.  It shouldn't be required (as in the default 
/etc/dmd.conf should handle it correctly, but I can deal 
with it now.


Can this be fed as parameters to the DMD call 
(programmatically) instead of manual editing of dmd.conf?



I did feed it into the dmd call programmatically.  Thus:
 dmd -defaultlib=libphobos2.so -fPIC test.d

I'm reluctant to edit the dmd.conf file as I don't really 
understand the syntax...and I have to be root to do the editing.


https://dlang.org/dmd-linux.html#dmd-conf

You can copy dmd.conf to the current working directory and try 
out changes there. That will only affect the current program. 
Then you can move it to your home directory.


Re: strange -fPIC compilation error

2016-11-01 Thread TheGag96 via Digitalmars-d-learn
On Monday, 31 October 2016 at 07:16:50 UTC, Sebastien Alaiwan 
wrote:

Hello,
From GCC 6.2, -fpie is becoming the default setting at compile 
and at link time.
As dmd uses GCC to link, now the code needs to be compiled with 
a special option.
Which means you need, at the moment, to add the following 
options to your dmd.conf:

 -defaultlib=libphobos2.so -fPIC
(the change from GCC is related to security and address space 
randomization).


So does this mean it's now impossible to compile statically until 
this gets fixed?


Re: strange -fPIC compilation error

2016-11-01 Thread Charles Hixson via Digitalmars-d-learn

On 11/01/2016 10:34 AM, bachmeier via Digitalmars-d-learn wrote:

On Tuesday, 1 November 2016 at 17:23:54 UTC, Charles Hixson wrote:

On 11/01/2016 12:52 AM, Nordlöw via Digitalmars-d-learn wrote:

On Tuesday, 1 November 2016 at 07:15:19 UTC, Mike Parker wrote:

but
dmd -defaultlib=libphobos2.so -fPIC test.d
works.  It shouldn't be required (as in the default /etc/dmd.conf 
should handle it correctly, but I can deal with it now.


Can this be fed as parameters to the DMD call (programmatically) 
instead of manual editing of dmd.conf?



I did feed it into the dmd call programmatically.  Thus:
 dmd -defaultlib=libphobos2.so -fPIC test.d

I'm reluctant to edit the dmd.conf file as I don't really understand 
the syntax...and I have to be root to do the editing.


https://dlang.org/dmd-linux.html#dmd-conf

You can copy dmd.conf to the current working directory and try out 
changes there. That will only affect the current program. Then you can 
move it to your home directory.


I'll probably do that eventually...but for now I'm just pasting a 
comment at the start of each file that tells how to compile it, e.g.:

//ldc2 -Dddocs -c msg.d<<--no documentation generated
//dmd -Dddocs -c msg.d
//rdmd -main -Dddocs -unittest -defaultlib=libphobos2.so -fPIC msg.d



Re: strange -fPIC compilation error

2016-11-01 Thread Lodovico Giaretta via Digitalmars-d-learn

On Tuesday, 1 November 2016 at 18:13:32 UTC, TheGag96 wrote:
On Monday, 31 October 2016 at 07:16:50 UTC, Sebastien Alaiwan 
wrote:

Hello,
From GCC 6.2, -fpie is becoming the default setting at compile 
and at link time.
As dmd uses GCC to link, now the code needs to be compiled 
with a special option.
Which means you need, at the moment, to add the following 
options to your dmd.conf:

 -defaultlib=libphobos2.so -fPIC
(the change from GCC is related to security and address space 
randomization).


So does this mean it's now impossible to compile statically 
until this gets fixed?


It's impossible with the default `libphobos2.a`. I didn't try, 
but I'm quite confident that if you clone the Phobos repository 
and rebuild the library yourself with -fPIC, you can then link it 
statically to PIE executables.