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

ZombineDev via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 28 04:08:45 PST 2015


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


More information about the Digitalmars-d-learn mailing list