www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - What is a good strategy for finding undefined symbols...

reply "WhatMeWorry" <kc_heaser yahoo.com> writes:
I've been trying to compile the DerelictGL and finally got it to 
compile cleanly. But now the linker is complaining.

I've been "searching" for hours for these definitions and I feel 
like I've just been going around in circles.

What is a novice to do?   Is this just something I am supposed to 
know before hand?


C:\D\dmd2\windows\bin\link.exe gl,,nul,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
gl.obj(gl)
  Error 42: Symbol Undefined __d_framehandler
gl.obj(gl)
  Error 42: Symbol Undefined __d_throwc
gl.obj(gl)
  Error 42: Symbol Undefined __tls_array
gl.obj(gl)
  Error 42: Symbol Undefined 
_D8derelict4util7wrapper9toDStringFPaZAa
gl.obj(gl)
  Error 42: Symbol Undefined _D9Exception7__ClassZ
gl.obj(gl)
  Error 42: Symbol Undefined _glGetString
gl.obj(gl)
  Error 42: Symbol Undefined 
_D8derelict4util7wrapper7findStrFAaAaZi
gl.obj(gl)
  Error 42: Symbol Undefined _wglGetCurrentContext
gl.obj(gl)
  Error 42: Symbol Undefined _D11TypeInfo_Aa6__initZ
gl.obj(gl)
  Error 42: Symbol Undefined 
_D8derelict4util9exception17DerelictException7__ClassZ
gl.obj(gl)
  Error 42: Symbol Undefined __d_arraycatnT
gl.obj(gl)
  Error 42: Symbol Undefined _D12TypeInfo_Aya6__initZ
gl.obj(gl)
May 11 2012
next sibling parent Sean Kelly <sean invisibleduck.org> writes:
On May 11, 2012, at 1:56 PM, WhatMeWorry wrote:

 I've been trying to compile the DerelictGL and finally got it to =

=20
 I've been "searching" for hours for these definitions and I feel like =

=20
 What is a novice to do?   Is this just something I am supposed to know =

=20
=20
 C:\D\dmd2\windows\bin\link.exe gl,,nul,user32+kernel32/noi;
 OPTLINK (R) for Win32  Release 8.00.12
 Copyright (C) Digital Mars 1989-2010  All rights reserved.
 http://www.digitalmars.com/ctg/optlink.html
 gl.obj(gl)
 Error 42: Symbol Undefined __d_framehandler
 gl.obj(gl)
 Error 42: Symbol Undefined __d_throwc

_d_anything will be defined in Druntime, which is bundled into the = Phobos library. Maybe your library path is wrong and DMD can't find = Phobos?
 gl.obj(gl)
 Error 42: Symbol Undefined __tls_array

I think the compiler generates this. It'd a Druntime thing also.
 gl.obj(gl)
 Error 42: Symbol Undefined _D8derelict4util7wrapper9toDStringFPaZAa

derelict.wrapper.toDString(blah) Feed mangled names into core.demangle to get a readable string.
 gl.obj(gl)
 Error 42: Symbol Undefined _D9Exception7__ClassZ
 gl.obj(gl)
 Error 42: Symbol Undefined _glGetString
 gl.obj(gl)
 Error 42: Symbol Undefined _D8derelict4util7wrapper7findStrFAaAaZi
 gl.obj(gl)
 Error 42: Symbol Undefined _wglGetCurrentContext

Not linking OpenGL maybe?
 gl.obj(gl)
 Error 42: Symbol Undefined _D11TypeInfo_Aa6__initZ
 gl.obj(gl)
 Error 42: Symbol Undefined =

 gl.obj(gl)
 Error 42: Symbol Undefined __d_arraycatnT
 gl.obj(gl)
 Error 42: Symbol Undefined _D12TypeInfo_Aya6__initZ
 gl.obj(gl)

Mostly Druntime again.=
May 11 2012
prev sibling next sibling parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 12.05.2012 0:56, WhatMeWorry wrote:
 I've been trying to compile the DerelictGL and finally got it to compile
 cleanly. But now the linker is complaining.

 I've been "searching" for hours for these definitions and I feel like
 I've just been going around in circles.

 What is a novice to do? Is this just something I am supposed to know
 before hand?

Looks like you are trying to link. Libraries are not linked they are just compiled. Then object files are put together into library file. Link produces *executable* (yeah I recall that was hard to get at first).
 C:\D\dmd2\windows\bin\link.exe gl,,nul,user32+kernel32/noi;
 OPTLINK (R) for Win32 Release 8.00.12
 Copyright (C) Digital Mars 1989-2010 All rights reserved.
 http://www.digitalmars.com/ctg/optlink.html
 gl.obj(gl)
 Error 42: Symbol Undefined __d_framehandler
 gl.obj(gl)
 Error 42: Symbol Undefined __d_throwc
 gl.obj(gl)
 Error 42: Symbol Undefined __tls_array
 gl.obj(gl)
 Error 42: Symbol Undefined _D8derelict4util7wrapper9toDStringFPaZAa
 gl.obj(gl)
 Error 42: Symbol Undefined _D9Exception7__ClassZ
 gl.obj(gl)
 Error 42: Symbol Undefined _glGetString
 gl.obj(gl)
 Error 42: Symbol Undefined _D8derelict4util7wrapper7findStrFAaAaZi
 gl.obj(gl)
 Error 42: Symbol Undefined _wglGetCurrentContext
 gl.obj(gl)
 Error 42: Symbol Undefined _D11TypeInfo_Aa6__initZ
 gl.obj(gl)
 Error 42: Symbol Undefined
 _D8derelict4util9exception17DerelictException7__ClassZ
 gl.obj(gl)
 Error 42: Symbol Undefined __d_arraycatnT
 gl.obj(gl)
 Error 42: Symbol Undefined _D12TypeInfo_Aya6__initZ
 gl.obj(gl)

-- Dmitry Olshansky
May 11 2012
parent reply Mike Parker <aldacron gmail.com> writes:
On 5/13/2012 2:22 AM, WhatMeWorry wrote:
 Looks like you are trying to link. Libraries are not linked they are
 just compiled. Then object files are put together into library file.
 Link produces *executable* (yeah I recall that was hard to get at first).


Wait, isn't that the whole point of libraries, that they are pre-compiled? Linking just resolves their addresses? Anyway, I set the LIB environment variable to point to where my druntime and phobos libraries (with absolute paths even) like so: set LIB=C:\D\dmd2\src\druntime\lib;C:\D\dmd2\src\phobos but when I redo the link step,I am still seening the undefined symbols like in my original posting. I love programming, but I hate building. Is this what Andrei means by code for "being" as opposed to code for "doing:.

Linking happens when you build an executable. If you are building just the libraries, there is no linking done at all. To compile DerelictGL, you do not need to link anything. It appears you are compiling Derelict 2, in which case the supplied makefiles should do everything necessary to build the libraries: make -fwin32.mak Are you having difficulties with that?
May 12 2012
parent Mike Parker <aldacron gmail.com> writes:
On 5/16/2012 10:15 AM, WhatMeWorry wrote:

 I'm just going start from scratch. However, this might be a real
 beginner question, but when I go to the
 ttp://svn.dsource.org/projects/derelict/branches/Derelict2 link, I see

 Revision 630: /branches/Derelict2
 ..
 DerelictAL/
 DerelictAllegro/
 DerelictFMOD/
 DerelictFT/
 DerelictGL/
 DerelictIL/
 DerelictODE/
 DerelictOgg/
 DerelictPA/
 DerelictSDL/
 DerelictSFML/
 DerelictUtil/
 dgl.d
 doc/
 dsss.conf
 import/
 inc/
 lib/
 linux.mak
 mac.mak
 project/
 win32.mak

 --------------------------------------------------------------------------------

 Powered by Subversion version 1.4.5 (r25188).

 So now what? I've never used version control software before. Do I need
 to download a subversion client?

That particular URL isn't really meant for browsing. It is meant to be used by a Subversion client to checkout the source. However, if you don't want to do that at this point, then you can go to the source browser[1] and download a zip file. [1] http://www.dsource.org/projects/derelict/browser/branches/Derelict2 This is the web interface to the repository. There, at the bottom of the page, you'll see a link "Zip Archive". Clicking that will auto-generate a zip file that will then download. Once you extract that, you'll wind up with the source tree in a directory with a long name. I suggest you rename it to 'derelict'. Next, you need to make sure DMD is on your path. Then you can open up a command prompt and follow the directions in the Derelict docs for compilation. If you need help beyond that point, please ask over in the Derelict forum and I'll see what I can do to assist.
 Thanks for all the help. Derelict is a great project.

May 16 2012
prev sibling next sibling parent "WhatMeWorry" <kc_heaser yahoo.com> writes:
 Looks like you are trying to link. Libraries are not linked 
 they are just compiled. Then object files are put together into 
 library file.
 Link produces *executable* (yeah I recall that was hard to get 
 at first).


Wait, isn't that the whole point of libraries, that they are pre-compiled? Linking just resolves their addresses? Anyway, I set the LIB environment variable to point to where my druntime and phobos libraries (with absolute paths even) like so: set LIB=C:\D\dmd2\src\druntime\lib;C:\D\dmd2\src\phobos but when I redo the link step,I am still seening the undefined symbols like in my original posting. I love programming, but I hate building. Is this what Andrei means by code for "being" as opposed to code for "doing:.
May 12 2012
prev sibling next sibling parent Andrew Wiley <wiley.andrew.j gmail.com> writes:
--f46d04016b03775b3204bfda3b44
Content-Type: text/plain; charset=ISO-8859-1

On Sat, May 12, 2012 at 12:22 PM, WhatMeWorry <kc_heaser yahoo.com> wrote:

  Looks like you are trying to link. Libraries are not linked they are just
 compiled. Then object files are put together into library file.
 Link produces *executable* (yeah I recall that was hard to get at first).



Linking just resolves their addresses?

Yes and no. You have to link *dynamic* libraries to resolve addresses, but you're dealing with a static library. "Static library" is to some extent a misnomer because you don't link them at all; they're basically a bunch of object files thrown into an archive file. Addresses get resolved when you link an executable and all those object files get included from inside the archive.
 Anyway, I set the LIB environment variable to point to where my druntime
 and phobos libraries (with absolute paths even) like so:

 set LIB=C:\D\dmd2\src\druntime\**lib;C:\D\dmd2\src\phobos

 but when I redo the link step,I am still seening the undefined symbols
 like in my original posting.

 I love programming, but I hate building. Is this what Andrei means by code
 for "being" as opposed to code for "doing:.

more complex system than it is with VM languages (and interpreted languages don't need a toolchain at all). Unfortunately, I use GDC on Windows and Linux, so I can't tell you exactly the command to create a static library with DMD, but I can tell you that you don't need to invoke optlink. --f46d04016b03775b3204bfda3b44 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On Sat, May 12, 2012 at 12:22 PM, WhatMeWorry <s= pan dir=3D"ltr">&lt;<a href=3D"mailto:kc_heaser yahoo.com" target=3D"_blank= ">kc_heaser yahoo.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_q= uote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1e= x"> <div class=3D"im"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .= 8ex;border-left:1px #ccc solid;padding-left:1ex"> Looks like you are trying to link. Libraries are not linked they are just c= ompiled. Then object files are put together into library file.<br> Link produces *executable* (yeah I recall that was hard to get at first).<b= r> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> <br> </blockquote></blockquote> <br></div> Wait, isn&#39;t that the whole point of libraries, that they are pre-compil= ed? Linking just resolves their addresses?<br></blockquote><div><br></div><= div>Yes and no. You have to link *dynamic* libraries to resolve addresses, = but you&#39;re dealing with a static library. &quot;Static library&quot; is= to some extent a misnomer because you don&#39;t link them at all; they&#39= ;re basically a bunch of object files thrown into an archive file. Addresse= s get resolved when you link an executable and all those object files get i= ncluded from inside the archive.</div> <div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex= ;border-left:1px #ccc solid;padding-left:1ex"> <br> Anyway, I set the LIB environment variable to point to where my druntime an= d phobos libraries (with absolute paths even) like so:<br> <br> set LIB=3DC:\D\dmd2\src\druntime\<u></u>lib;C:\D\dmd2\src\phobos<br> <br> but when I redo the link step,I am still seening the undefined symbols like= in my original posting.<br> <br> I love programming, but I hate building. Is this what Andrei means by code = for &quot;being&quot; as opposed to code for &quot;doing:.<br> <br></blockquote><div><br></div><div>One of the downsides of native compila= tion is that the toolchain is a much more complex system than it is with VM= languages (and interpreted languages don&#39;t need a toolchain at all).</= div> <div><br></div><div>Unfortunately, I use GDC on Windows and Linux, so I can= &#39;t tell you exactly the command to create a static library with DMD, bu= t I can tell you that you don&#39;t need to invoke optlink.</div></div> <br> --f46d04016b03775b3204bfda3b44--
May 12 2012
prev sibling next sibling parent "WhatMeWorry" <kc_heaser yahoo.com> writes:

Linking happens when you build an executable. If you are building just the libraries, there is no linking done at all. To compile DerelictGL, you do not need to link anything. It appears you are compiling Derelict 2, in which case the supplied makefiles should do everything necessary to build the libraries: make -fwin32.mak Are you having difficulties with that?

Well, the derelict page at: http://www.dsource.org/projects/derelict doesn't even mention a make file. It talks about "dmd -run build.me" But I got all sorts of compiler errors with buildme.d And this page mentions Bud, Rebuild, and DSSS. Makes my head spin. I'm going to trying downloading derelict again and trying your make command suggestion. wish there was a "walk through" for beginners. Thanks. (I see there is a derelict forum so I'll go there as well)
May 14 2012
prev sibling next sibling parent "Michael Parker" <aldacron gmail.com> writes:
On 5/15/2012 4:23 AM, WhatMeWorry wrote:

Linking happens when you build an executable. If you are building just the libraries, there is no linking done at all. To compile DerelictGL, you do not need to link anything. It appears you are compiling Derelict 2, in which case the supplied makefiles should do everything necessary to build the libraries: make -fwin32.mak Are you having difficulties with that?

Well, the derelict page at: http://www.dsource.org/projects/derelict doesn't even mention a make file. It talks about "dmd -run build.me"

If you look at the Derelict 2 section near the top of that page, you'll see the very last sentence says: "The rest of the information on this page relates to Derelict1." That means everything about buildme.d, DSSS, bud and so on are all for Derelict 1, not Derelict 2. I suppose this is my fault for assuming people would read the whole page and for not having updated the Wiki since then to remove the Derelict 1 stuff. Also, in that very same Derelict 2 section, is the following: Work has begun on the documentation, which you can view online at: http://svn.dsource.org/projects/derelict/branches/Derelict2/doc/index.html On that front documentation page, there is a section called "General Facts you Need to Know". The very first item in that list is "How to build Derelict", where 'build' is a link to the page that explains how to compile the libraries. The next item in the list tells you how to make use of Derelict in your programs. You also get that very same documentation when you checkout or download the Derelict 2 branch from SVN. It lives in the 'doc' subdirectory. Of course, I'm assuming you're using Derelict 2 since you say you did get it to compile. Derelict 1 won't compile at all with D2, it's D1 only. Derelict 2 is at http://svn.dsource.org/projects/derelict/branches/Derelict2 If that's what you're using, then everything I said here applies. If you're using the trunk, which is Derelict 1, stop and use the Derelict 2 branch.
May 14 2012
prev sibling parent "WhatMeWorry" <kc_heaser yahoo.com> writes:
On Tuesday, 15 May 2012 at 05:35:35 UTC, Michael Parker wrote:
 On 5/15/2012 4:23 AM, WhatMeWorry wrote:

Linking happens when you build an executable. If you are building just the libraries, there is no linking done at all. To compile DerelictGL, you do not need to link anything. It appears you are compiling Derelict 2, in which case the supplied makefiles should do everything necessary to build the libraries: make -fwin32.mak Are you having difficulties with that?

Well, the derelict page at: http://www.dsource.org/projects/derelict doesn't even mention a make file. It talks about "dmd -run build.me"

If you look at the Derelict 2 section near the top of that page, you'll see the very last sentence says: "The rest of the information on this page relates to Derelict1." That means everything about buildme.d, DSSS, bud and so on are all for Derelict 1, not Derelict 2. I suppose this is my fault for assuming people would read the whole page and for not having updated the Wiki since then to remove the Derelict 1 stuff. Also, in that very same Derelict 2 section, is the following: Work has begun on the documentation, which you can view online at: http://svn.dsource.org/projects/derelict/branches/Derelict2/doc/index.html On that front documentation page, there is a section called "General Facts you Need to Know". The very first item in that list is "How to build Derelict", where 'build' is a link to the page that explains how to compile the libraries. The next item in the list tells you how to make use of Derelict in your programs. You also get that very same documentation when you checkout or download the Derelict 2 branch from SVN. It lives in the 'doc' subdirectory. Of course, I'm assuming you're using Derelict 2 since you say you did get it to compile. Derelict 1 won't compile at all with D2, it's D1 only. Derelict 2 is at http://svn.dsource.org/projects/derelict/branches/Derelict2 If that's what you're using, then everything I said here applies. If you're using the trunk, which is Derelict 1, stop and use the Derelict 2 branch.

I'm just going start from scratch. However, this might be a real beginner question, but when I go to the ttp://svn.dsource.org/projects/derelict/branches/Derelict2 link, I see Revision 630: /branches/Derelict2 .. DerelictAL/ DerelictAllegro/ DerelictFMOD/ DerelictFT/ DerelictGL/ DerelictIL/ DerelictODE/ DerelictOgg/ DerelictPA/ DerelictSDL/ DerelictSFML/ DerelictUtil/ dgl.d doc/ dsss.conf import/ inc/ lib/ linux.mak mac.mak project/ win32.mak -------------------------------------------------------------------------------- Powered by Subversion version 1.4.5 (r25188). So now what? I've never used version control software before. Do I need to download a subversion client? Thanks for all the help. Derelict is a great project.
May 15 2012