digitalmars.D.learn - gdc compiler/linker error
- Jonathan Crapuchettes (31/31) Apr 17 2008 I am getting a linker error when I try to compile my code as follows:
- Jason House (5/40) Apr 17 2008 If you pick up a d demangler and run it on the output, it'll make it eas...
- Tower Ty (8/51) Apr 17 2008 If hes using tango then there isn't one I don't think
- Markus Dittrich (4/13) Apr 17 2008 Have you tried putting MySQLConnection.o before Util.o when linking?
- Jonathan Crapuchettes (3/20) Apr 18 2008 Yes, but sadly I got the same result.
- Neil Vice (11/43) Apr 18 2008 I don't see why a single compiler would generate two different mangled n...
- Jonathan Crapuchettes (6/59) Apr 18 2008 Thank you for your thoughts, but as you can see from the gdmd output, al...
I am getting a linker error when I try to compile my code as follows: jonathan 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
Apr 17 2008
Jonathan Crapuchettes wrote:I am getting a linker error when I try to compile my code as follows: jonathan 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, JCIf you pick up a d demangler and run it on the output, it'll make it easier for others to interpret. It may even have the unexpected side effect of making the error obvious.
Apr 17 2008
Jason House Wrote:Jonathan Crapuchettes wrote:If hes using tango then there isn't one I don't think Phobos has one for use in Linux This question is in the ".D" forum also and I passed on it in case I lower your chances of an answer, however I'd suggest that somewhere in reference to `_D3ccb15MySQLConnection15mysqlConnection7__ClassZ' and `_D3ccb15MySQLConnection15mysqlConnection5_ctorMFAaAaAaAaZC3ccb15MySQLConnection15mysqlConnection' is a clue . I would be looking for "MySQLConnection.mysqlConnection" typed somewhere instead of "MySQLConnection.MysqlConnection" You are right about the m I think Anyway some much smarter people on here will hopefuly read the output and be able to interpret it clearly for youI am getting a linker error when I try to compile my code as follows: jonathan 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, JCIf you pick up a d demangler and run it on the output, it'll make it easier for others to interpret. It may even have the unexpected side effect of making the error obvious.
Apr 17 2008
Jonathan Crapuchettes Wrote:I am getting a linker error when I try to compile my code as follows: /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 toHave you tried putting MySQLConnection.o before Util.o when linking? cheers, Markus
Apr 17 2008
Yes, but sadly I got the same result. JC Markus Dittrich wrote:Jonathan Crapuchettes Wrote:I am getting a linker error when I try to compile my code as follows: /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 toHave you tried putting MySQLConnection.o before Util.o when linking? cheers, Markus
Apr 18 2008
"Jonathan Crapuchettes" <jcrapuchettes gmail.com> wrote in message news:fu8iu2$98s$1 digitalmars.com...I am getting a linker error when I try to compile my code as follows: jonathan 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, JCI 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
Apr 18 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 gmail.com> wrote in message news:fu8iu2$98s$1 digitalmars.com...I am getting a linker error when I try to compile my code as follows: jonathan 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, JCI 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
Apr 18 2008