Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread ZombineDev via Digitalmars-d-learn

On Monday, 28 December 2015 at 04:52:44 UTC, FrankLike wrote:
Now I build a project for ARM linux on ubuntu 15.04 ,but build 
error.
I download the 'wiringPi' from http://wiringPi.com,convert the 
*.h to *.d.then build the 'aa.so' file:

#! /bin/sh
dfiles="max31855.d max5322.d mcp23008.d mcp23016.d 
mcp23016reg.d mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d 
mcp23x0817.d mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d 
pcf8591.d sn3218.d softPwm.d softServo.d softTone.d sr595.d 
wiringPi.d wiringPiI2C.d wiringPiSPI.d wiringSerial.d 
wiringShift.d wpiExtensions.d"


ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o  
mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o 
mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThead.o sn3218.o 
softPwm.o softServo.o softTone.o sr595.o wiringPi.o 
wiringPiI2C.o wiringPiSPI.o wiringSerial.o wiringShift.o 
wpiExtensions.o"


 /opt/arm-unknown-linux-gnueabihf/bin/arm-linux-gnueabihf-gdc  
-o aa.so $ofiels $dfiles  -shared

---my.d
import wiringPi;
import std.stdio;

void main()
{
writeln("start");
wiringPiSetup();
pinMode(0,OUTPUT);
while(1)
{
digitalWrite(0,HIGH);
delay(500);
digitalWrite(0,LOW);
delay(500);
}
return;
}
-build the my execute file
/opt/arm-unknown-linux-gnueabihf/bin/arm-linux-gnueabihf-gdc  
-o my  my.d aa.so -I./wiringPi/WiringPi/


-now get the error:
my.d:1:8: error: module wiringPi is in file 'wiringPi.d' which 
cannot be read

 import wiringPi;
^
import path[0] = 
/opt/arm-unknown-linux-gnueabihf/lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/include/d
-I copy the *.d to 
/opt/arm-unknown-linux-gnueabihf/lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/include/d

it's ok ,but where is the file for config?
-get another error:
/tmp/cc7M1B9I.o: In function `_Dmain':
my.d:(.text+0x60): undefined reference to `wiringPiSetup'
my.d:(.text+0x6c): undefined reference to `pinMode'
my.d:(.text+0x84): undefined reference to `digitalWrite'
my.d:(.text+0x8c): undefined reference to `delay'
my.d:(.text+0x98): undefined reference to `digitalWrite'
my.d:(.text+0xa0): undefined reference to `delay'
collect2: error: ld returned 1 exit status
-end

I'm not known the GDC config file ,and maybe I use the error 
build .

Who can help me?
 thank you.


About the first error ("...module wiringPi is in file 
'wiringPi.d' which cannot be read...") - are you sure that the 
dfiles are in "./wiringPi/WiringPi/"? The compiler reports that 
it can't find them there.
You can try copying the WiringPi dfiles in the same folder as 
"my.d".


About the second error - you need to verify that aa.so actually 
has those symbols that the linker reports as "undefined 
reference". You can do this with readlelf or nm. For more info 
see 
here:http://stackoverflow.com/questions/1237575/how-do-i-find-out-what-all-symbols-are-exported-from-a-shared-object


Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn

On Monday, 28 December 2015 at 13:17:04 UTC, FrankLike wrote:
About the first error ("...module wiringPi is in file 
'wiringPi.d' which cannot be read...") - are you sure that the 
dfiles are in "./wiringPi/WiringPi/"? The compiler reports 
that it can't find them there.
You can try copying the WiringPi dfiles in the same folder as 
"my.d".


About the second error - you need to verify that aa.so 
actually has those symbols that the linker reports as 
"undefined reference". You can do this with readlelf or nm. 
For more info see 
here:http://stackoverflow.com/questions/1237575/how-do-i-find-out-what-all-symbols-are-exported-from-a-shared-object


 Thank you,but can you tell me that what is right way to use GDC
 on linux,such as d refer a c lib.
for eacample:
a.d refer  x.h x.c
 how  do you build it by GDC?
 what's your steps?
 How to config the GDC for the third part c libaries and d 
files,such as PATH.


 Thank you,waiting for your answer.




Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn

 I've gotten the answer: use the difference 'gcc' for c code.
---For x86_64:
#! /bin/sh
dfiles="max31855.d max5322.d mcp23008.d mcp23016.d mcp23016reg.d 
mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d mcp23x0817.d 
mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d pcf8591.d 
sn3218.d softPwm.d softServo.d softTone.d sr595.d wiringPi.d 
wiringPiI2C.d wiringPiSPI.d wiringSerial.d wiringShift.d 
wpiExtensions.d"


ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o  
mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o 
mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThread.o sn3218.o 
softPwm.o softServo.o softTone.o sr595.o wiringPi.o wiringPiI2C.o 
wiringPiSPI.o wiringSerial.o wiringShift.o wpiExtensions.o"



gcc -c *.c -m64
/opt/x86_64-pc-linux-gnu/bin/x86_64-linux-gnu-gdc -o my my.d   
$ofiles -I$dfiles


For ARM:

#! /bin/sh
cfiles="wiringPi.c max31855.c max5322.c mcp23008.c mcp23016.c  
mcp23017.c mcp23s08.c mcp23s17.c mcp3002.c mcp3004.c mcp3422.c 
mcp4802.c pcf8574.c pcf8591.c sn3218.c softPwm.c softServo.c 
softTone.c sr595.c  wiringPiI2C.c wiringPiSPI.c wiringSerial.c 
wiringShift.c wpiExtensions.c"


dfiles="max31855.d max5322.d mcp23008.d mcp23016.d mcp23016reg.d 
mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d mcp23x0817.d 
mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d pcf8591.d 
sn3218.d softPwm.d softServo.d softTone.d sr595.d wiringPi.d 
wiringPiI2C.d wiringPiSPI.d wiringSerial.d wiringShift.d 
wpiExtensions.d"


ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o  
mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o 
mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThread.o sn3218.o 
softPwm.o softServo.o softTone.o sr595.o wiringPi.o wiringPiI2C.o 
wiringPiSPI.o wiringSerial.o wiringShift.o wpiExtensions.o"


/opt/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gcc -marm  -c 
$cfiles
/opt/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gdc  -o my 
my.d   $ofiles -I$dfiles


Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn
About the first error ("...module wiringPi is in file 
'wiringPi.d' which cannot be read...") - are you sure that the 
dfiles are in "./wiringPi/WiringPi/"? The compiler reports that 
it can't find them there.
You can try copying the WiringPi dfiles in the same folder as 
"my.d".


About the second error - you need to verify that aa.so actually 
has those symbols that the linker reports as "undefined 
reference". You can do this with readlelf or nm. For more info 
see 
here:http://stackoverflow.com/questions/1237575/how-do-i-find-out-what-all-symbols-are-exported-from-a-shared-object


Thank you,but can you tell me that what is right way to use GDC 
on linux,such as d refer a c lib.

for eacample:
a.d refer  x.h x.c
how  do you build it by GDC?
what's your steps?
How to config the GDC for the thirty c lib and d files.

Thank you,waiting for your answer.


Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn

On Monday, 28 December 2015 at 15:23:19 UTC, FrankLike wrote:
 New Answer: I've gotten the answer: use the difference 'gcc' for 
c code.

 ---For x86_64:
 #! /bin/sh
 dfiles="max31855.d max5322.d mcp23008.d mcp23016.d
 mcp23016reg.d mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d
 mcp23x0817.d mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d
 pcf8591.d sn3218.d softPwm.d softServo.d softTone.d sr595.d
 wiringPi.d wiringPiI2C.d wiringPiSPI.d wiringSerial.d
 wiringShift.d wpiExtensions.d"

 ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o
 mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o
 mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThread.o sn3218.o
 softPwm.o softServo.o softTone.o sr595.o wiringPi.o
 wiringPiI2C.o wiringPiSPI.o wiringSerial.o wiringShift.o
 wpiExtensions.o"


 gcc -c *.c -m64
 /opt/x86_64-pc-linux-gnu/bin/x86_64-linux-gnu-gdc -o my my.d
 $ofiles -I$dfiles

 For ARM(add -I.):

 #! /bin/sh
 cfiles="wiringPi.c max31855.c max5322.c mcp23008.c mcp23016.c
 mcp23017.c mcp23s08.c mcp23s17.c mcp3002.c mcp3004.c mcp3422.c
 mcp4802.c pcf8574.c pcf8591.c sn3218.c softPwm.c softServo.c
 softTone.c sr595.c  wiringPiI2C.c wiringPiSPI.c wiringSerial.c
 wiringShift.c wpiExtensions.c"

 dfiles="max31855.d max5322.d mcp23008.d mcp23016.d
 mcp23016reg.d mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d
 mcp23x0817.d mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d
 pcf8591.d sn3218.d softPwm.d softServo.d softTone.d sr595.d
 wiringPi.d wiringPiI2C.d wiringPiSPI.d wiringSerial.d
 wiringShift.d wpiExtensions.d"

 ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o
 mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o
 mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThread.o sn3218.o
 softPwm.o softServo.o softTone.o sr595.o wiringPi.o
 wiringPiI2C.o wiringPiSPI.o wiringSerial.o wiringShift.o
 wpiExtensions.o"

 
/opt/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gcc -marm  -c $cfiles -I.
 
/opt/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gdc  -o my my.d   $ofiles -I$dfiles