gdc compiler/linker error

Jonathan Crapuchettes jcrapuchettes at gmail.com
Fri Apr 18 09:06:34 PDT 2008


Thank you for your thoughts, but as you can see from the gdmd output, all object 
files were created at the same time by the same compiler. I am starting to 
wonder if it isn't a bug in gdc.
Thanks again,
JC

Neil Vice wrote:
> "Jonathan Crapuchettes" <jcrapuchettes at gmail.com> wrote in message 
> news:fu8iu2$98s$1 at digitalmars.com...
>> I am getting a linker error when I try to compile my code as follows:
>>
>> jonathan at blackbeard:~/workspace/ccb/matrix$ gdmd test.d Matrix.d Vector.d 
>> Util.d 
>> ../MySQLConnection.d -unittest -I../.. -L/usr/lib/atlas/libptcblas.a -L/usr/lib/atlas/liblapack.a 
>>  -L/usr/lib/atlas/libatlas.a -L/usr/lib/atlas/libcblas.a -L/usr/lib/atlas/libblas.a 
>>  -L/usr/lib/libmysqlclient.so -vdmd
>> /usr/bin/gdc -funittest -I ../.. -c test.d -o test.o
>> /usr/bin/gdc -funittest -I ../.. -c Matrix.d -o Matrix.o
>> /usr/bin/gdc -funittest -I ../.. -c Vector.d -o Vector.o
>> /usr/bin/gdc -funittest -I ../.. -c Util.d -o Util.o
>> /usr/bin/gdc -funittest -I ../.. -c ../MySQLConnection.d -o 
>> MySQLConnection.o
>> /usr/bin/gdc -funittest -I ../.. test.o Matrix.o Vector.o Util.o 
>> MySQLConnection.o -Wl,/usr/lib/atlas/libptcblas.a -Wl,/usr/lib/atlas/liblapack.a 
>>  -Wl,/usr/lib/atlas/libatlas.a -Wl,/usr/lib/atlas/libcblas.a -Wl,/usr/lib/atlas/libblas.a 
>>  -Wl,/usr/lib/libmysqlclient.so -o test
>> Util.o: In function `_D3ccb6matrix4Util11__unittest0FZv':
>> Util.d:(.text+0x2ec4): undefined reference to 
>> `_D3ccb15MySQLConnection15mysqlConnection7__ClassZ'
>> Util.d:(.text+0x2f22): undefined reference to 
>> `_D3ccb15MySQLConnection15mysqlConnection5_ctorMFAaAaAaAaZC3ccb15MySQLConnection15mysqlConnection'
>> collect2: ld returned 1 exit status
>>
>> I am trying to use gdc for its 64-bit compilation, but this is a problem. 
>> I checked the compiled code inside MySQLConnection.o with objdump and 
>> found that _D3ccb15MySQLConnection15MysqlConnection7__ClassZ exists. The 
>> only different between this label and the one that is causing the error is 
>> the m in the last term. The name of the class is MysqlConnection.
>>
>> I am using gdc (GCC) 4.1.3 20070831 (prerelease gdc 0.25, using dmd 1.021) 
>> (Ubuntu 0.25-4.1.2-16ubuntu1).
>>
>> What can I do to get this is compile and link?
>>
>> Thank you taking to read this,
>> JC
> 
> I don't see why a single compiler would generate two different mangled names 
> for the same identifier. As such, I wonder where the two object files 
> involved were obtained from? Could they have been built with different 
> compiler versions somehow? Did you obtain one of them as a binary? If so, 
> perhaps the case in the associated extern declaration is incorrect...
> 
> I also know that DMD acts differently if you compile a series of files in 
> the one command or compile each seperately and the link. Don't think this 
> would apply to GDC but another thought...
> 
> Good luck
> 
> 


More information about the Digitalmars-d-learn mailing list