www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Linker issue?

reply "Josh" <moonburntm gmail.com> writes:
I've copied the source code from vibe.d's mongodb example into an 
Eclipse DDT project, and I can't seem to get it to compile, even 
though I *think* I've made the build options resemble what vibe 
uses to build.

build.rf:
-od"bin"
-of"bin\TestProg.exe"

-I"src"

-I"C:\D\vibe.d\source"
-I"C:\D\vibe.d\import"
-I"C:\D\vibe.d\lib\win-i386"

"src\Test.d"

C:\D\vibe.d\lib\win-i386\eay.lib
C:\D\vibe.d\lib\win-i386\event2.lib
C:\D\vibe.d\lib\win-i386\ssl.lib
ws2_32.lib

Building with Eclipse gives:
--------  Build Commands:  --------
-od"bin"
-of"bin\TestProg.exe"

-I"src"

-I"C:\D\vibe.d\source"
-I"C:\D\vibe.d\import"
-I"C:\D\vibe.d\lib\win-i386"

"src\Test.d"

C:\D\vibe.d\lib\win-i386\eay.lib
C:\D\vibe.d\lib\win-i386\event2.lib
C:\D\vibe.d\lib\win-i386\ssl.lib
ws2_32.lib


OPTLINK (R) for Win32  Release 8.00.13
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined _D4vibe4data4bson4Bson6__initZ
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
_D4vibe4data4bson4Bson6__ctorMFNcAyaE4vibe4data4bson4Bson4TypeZS4vibe4data4bson4Bson
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
_D4vibe2db5mongo5mongo14connectMongoDBFAyaZC4vibe2db5mongo6client11MongoClient
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined _D4vibe4data4json4Json8toStringMxFZAya
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
_D4vibe4data4bson4Bson6toJsonMxFZS4vibe4data4json4Json
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
_D4vibe2db5mongo6cursor11MongoCursor7opApplyMFDFKkKS4vibe4data4bson4BsonZiZi
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
_D4vibe2db5mongo6cursor11MongoCursor6__dtorMFZv
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
_D4vibe4data4bson4Bson6__ctorMFNcxHAyaS4vibe4data4bson4BsonZS4vibe4data4bson4Bson
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
_D4vibe2db5mongo8database13MongoDatabase7opIndexMFAyaZS4vibe2db5mongo10collection15MongoCollection
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined _D4vibe4core3log7__arrayZ
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
_D4vibe4core3log10ss_loggersOAC4vibe4core3log6Logger
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
_D4vibe4core3log6rawLogFNbAyaiE4vibe4core3log8LogLevelAyaZv
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined _D4vibe4core3log8__assertFiZv
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
_D4vibe4core14connectionpool8__assertFiZv
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
_D4vibe4core4task4Task5fiberMNgFNbNdZNgC4vibe4core4task9TaskFiber
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
_D4vibe2db5mongo6client11M€„ŽC€†�4lockConnectiñMFZS€…¶4core1ꀈšpool67__T16L€ƒ³ed€ŠµTC€Žé10€Š·15€†î€‰‘Z€’À
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
_D4vibe4data4bson4Bson6__ctorMFNcnZS4vibe4data4bson4Bson
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
_D4vibe2db5mongo6cursor11M€„ŽC€…�6__ctñMFNcC€�®lient€ˆ®€…�Ayai€�§10cñnectiñ5ReplyZS€¢÷
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined _D4vibe4core3log12__ModuleInfoZ
bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined _D4vibe2db5mongo5mongo12__ModuleInfoZ
--- errorlevel 20

dmd is 2.063 on Windows 7.

I know both Eclipse and dmd work, as I can compile other programs 
that just use Phobos. I'm sure it's something really obvious that 
I can't see, but I haven't had much luck with external libs. The 
same sort of thing happened when I used GtkD...

Any help is welcomed.

Thanks,

Josh
Jun 17 2013
parent reply "Aleksandar Ruzicic" <aleksandar ruzicic.info> writes:
On Monday, 17 June 2013 at 13:15:35 UTC, Josh wrote:
 I've copied the source code from vibe.d's mongodb example into 
 an Eclipse DDT project, and I can't seem to get it to compile, 
 even though I *think* I've made the build options resemble what 
 vibe uses to build.

 build.rf:
 -od"bin"
 -of"bin\TestProg.exe"

 -I"src"

 -I"C:\D\vibe.d\source"
 -I"C:\D\vibe.d\import"
 -I"C:\D\vibe.d\lib\win-i386"

 "src\Test.d"

 C:\D\vibe.d\lib\win-i386\eay.lib
 C:\D\vibe.d\lib\win-i386\event2.lib
 C:\D\vibe.d\lib\win-i386\ssl.lib
 ws2_32.lib

 Building with Eclipse gives:
 --------  Build Commands:  --------
 -od"bin"
 -of"bin\TestProg.exe"

 -I"src"

 -I"C:\D\vibe.d\source"
 -I"C:\D\vibe.d\import"
 -I"C:\D\vibe.d\lib\win-i386"

 "src\Test.d"

 C:\D\vibe.d\lib\win-i386\eay.lib
 C:\D\vibe.d\lib\win-i386\event2.lib
 C:\D\vibe.d\lib\win-i386\ssl.lib
 ws2_32.lib


 OPTLINK (R) for Win32  Release 8.00.13
 Copyright (C) Digital Mars 1989-2010  All rights reserved.
 http://www.digitalmars.com/ctg/optlink.html
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined _D4vibe4data4bson4Bson6__initZ
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe4data4bson4Bson6__ctorMFNcAyaE4vibe4data4bson4Bson4TypeZS4vibe4data4bson4Bson
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe2db5mongo5mongo14connectMongoDBFAyaZC4vibe2db5mongo6client11MongoClient
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe4data4json4Json8toStringMxFZAya
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe4data4bson4Bson6toJsonMxFZS4vibe4data4json4Json
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe2db5mongo6cursor11MongoCursor7opApplyMFDFKkKS4vibe4data4bson4BsonZiZi
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe2db5mongo6cursor11MongoCursor6__dtorMFZv
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe4data4bson4Bson6__ctorMFNcxHAyaS4vibe4data4bson4BsonZS4vibe4data4bson4Bson
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe2db5mongo8database13MongoDatabase7opIndexMFAyaZS4vibe2db5mongo10collection15MongoCollection
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined _D4vibe4core3log7__arrayZ
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe4core3log10ss_loggersOAC4vibe4core3log6Logger
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe4core3log6rawLogFNbAyaiE4vibe4core3log8LogLevelAyaZv
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined _D4vibe4core3log8__assertFiZv
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe4core14connectionpool8__assertFiZv
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe4core4task4Task5fiberMNgFNbNdZNgC4vibe4core4task9TaskFiber
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe2db5mongo6client11M€„ŽC€†�4lockConnectiñMFZS€…¶4core1ꀈšpool67__T16L€ƒ³ed€ŠµTC€Žé10€Š·15€†î€‰‘Z€’À
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe4data4bson4Bson6__ctorMFNcnZS4vibe4data4bson4Bson
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe2db5mongo6cursor11M€„ŽC€…�6__ctñMFNcC€�®lient€ˆ®€…�Ayai€�§10cñnectiñ5ReplyZS€¢÷
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined _D4vibe4core3log12__ModuleInfoZ
 bin\TestProg.obj(TestProg)
  Error 42: Symbol Undefined 
 _D4vibe2db5mongo5mongo12__ModuleInfoZ
 --- errorlevel 20

 dmd is 2.063 on Windows 7.

 I know both Eclipse and dmd work, as I can compile other 
 programs that just use Phobos. I'm sure it's something really 
 obvious that I can't see, but I haven't had much luck with 
 external libs. The same sort of thing happened when I used 
 GtkD...

 Any help is welcomed.

 Thanks,

 Josh
This is what DUB executes (when you build a project depending on vibe.d) via dub build --rdmd (I've replaced absolute path to the project with <path> and added newlines for clarity): rdmd --build-only --compiler=dmd -w -g -debug -version=LIBEV4 -version=VibeLibeventDriver -version=Have_vibe_d -I<path>\source -I<path>\.dub\packages\vibe-d\import -I<path>\.dub\packages\vibe-d\source -J<path>\views <path>\.dub\packages\vibe-d\lib\win-i386\eay.lib <path>\.dub\packages\vibe-d\lib\win-i386\ssl.lib <path>\.dub\packages\vibe-d\lib\win-i386\event2.lib wsock32.lib ws2_32.lib -ofgamesrv.exe source\app.d So it seems you're missing wsock32.lib, but I'm a bit puzzled with linker errors, as those missing symbols are not inside wsock32.lib.. Sorry I couldn't be of more help (I'm new to vibe also, but luckily haven't hit any major build issues like you did).
Jun 17 2013
parent reply "Josh" <moonburntm gmail.com> writes:
On Monday, 17 June 2013 at 19:33:55 UTC, Aleksandar Ruzicic wrote:
 rdmd --build-only --compiler=dmd -w -g -debug
 -version=LIBEV4
 -version=VibeLibeventDriver
 -version=Have_vibe_d
 -I<path>\source
 -I<path>\.dub\packages\vibe-d\import
 -I<path>\.dub\packages\vibe-d\source
 -J<path>\views
 <path>\.dub\packages\vibe-d\lib\win-i386\eay.lib
 <path>\.dub\packages\vibe-d\lib\win-i386\ssl.lib
 <path>\.dub\packages\vibe-d\lib\win-i386\event2.lib
 wsock32.lib
 ws2_32.lib
 -ofgamesrv.exe
 source\app.d

 So it seems you're missing wsock32.lib, but I'm a bit puzzled 
 with linker errors, as those missing symbols are not inside 
 wsock32.lib..
I've added in wsock32.lib, the -J, and the 3 versions, and it gives the same output. I should mention that I can compile the examples fine with both vibe and dub by themselves, but apparently not inside Eclipse. Thanks for your help though Aleksandar. Josh
Jun 17 2013
parent reply "Aleksandar Ruzicic" <aleksandar ruzicic.info> writes:
On Tuesday, 18 June 2013 at 02:02:52 UTC, Josh wrote:
 I've added in wsock32.lib, the -J, and the 3 versions, and it 
 gives the same output. I should mention that I can compile the 
 examples fine with both vibe and dub by themselves, but 
 apparently not inside Eclipse.

 Thanks for your help though Aleksandar.

 Josh
I think that problem is that you're putting libs after your source file. I have now rearranged input files (as that is the only difference between your's and dub's build command that I can see) so it looks now like this: rdmd --build-only --compiler=dmd -w -g -debug -version=LIBEV4 -version=VibeLibeventDriver -version=Have_vibe_d -I<path>\source -I<path>\.dub\packages\vibe-d\import -I<path>\.dub\packages\vibe-d\source -J<path>\views source\app.d <path>\.dub\packages\vibe-d\lib\win-i386\eay.lib <path>\.dub\packages\vibe-d\lib\win-i386\ssl.lib <path>\.dub\packages\vibe-d\lib\win-i386\event2.lib wsock32.lib ws2_32.lib -ofgamesrv.exe (I've moved source\app.d before .libs) And Optlink responded with few pages of symbol undefined errors! :) So, try putting your source file at the end of command line.
Jun 17 2013
parent "Josh" <moonburntm gmail.com> writes:
On Tuesday, 18 June 2013 at 05:46:17 UTC, Aleksandar Ruzicic 
wrote:
 On Tuesday, 18 June 2013 at 02:02:52 UTC, Josh wrote:
 I've added in wsock32.lib, the -J, and the 3 versions, and it 
 gives the same output. I should mention that I can compile the 
 examples fine with both vibe and dub by themselves, but 
 apparently not inside Eclipse.

 Thanks for your help though Aleksandar.

 Josh
I think that problem is that you're putting libs after your source file. I have now rearranged input files (as that is the only difference between your's and dub's build command that I can see) so it looks now like this: rdmd --build-only --compiler=dmd -w -g -debug -version=LIBEV4 -version=VibeLibeventDriver -version=Have_vibe_d -I<path>\source -I<path>\.dub\packages\vibe-d\import -I<path>\.dub\packages\vibe-d\source -J<path>\views source\app.d <path>\.dub\packages\vibe-d\lib\win-i386\eay.lib <path>\.dub\packages\vibe-d\lib\win-i386\ssl.lib <path>\.dub\packages\vibe-d\lib\win-i386\event2.lib wsock32.lib ws2_32.lib -ofgamesrv.exe (I've moved source\app.d before .libs) And Optlink responded with few pages of symbol undefined errors! :) So, try putting your source file at the end of command line.
-------- Build Commands: -------- -od"bin" -of"bin\TestProg.exe" -version=LIBEV4 -version=VibeLibeventDriver -version=Have_vibe_d -I"src" -I"C:\D\vibe.d\source" -I"C:\D\vibe.d\import" -I"C:\D\vibe.d\lib\win-i386" -J"src" C:\D\vibe.d\lib\win-i386\eay.lib C:\D\vibe.d\lib\win-i386\event2.lib C:\D\vibe.d\lib\win-i386\ssl.lib ws2_32.lib wsock32.lib "src\Test.d" OPTLINK (R) for Win32 Release 8.00.13 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe4data4bson4Bson6__initZ bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe2db5mongo6cursor11MongoCursor7opApplyMFDFKkKS4vibe4data4bson4BsonZiZi bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe4data4json4Json8toStringMxFZAya bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe4data4bson4Bson6toJsonMxFZS4vibe4data4json4Json bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe2db5mongo6cursor11MongoCursor6__dtorMFZv bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe4data4bson4Bson6__ctorMFNcxHAyaS4vibe4data4bson4BsonZS4vibe4data4bson4Bson bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe2db5mongo8database13MongoDatabase7opIndexMFAyaZS4vibe2db5mongo10collection15MongoCollection bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe4data4bson4Bson6__ctorMFNcAyaE4vibe4data4bson4Bson4TypeZS4vibe4data4bson4Bson bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe2db5mongo5mongo14connectMongoDBFAyaZC4vibe2db5mongo6client11MongoClient bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe4core3log7__arrayZ bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe4core3log10ss_loggersOAC4vibe4core3log6Logger bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe4core3log6rawLogFNbAyaiE4vibe4core3log8LogLevelAyaZv bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe4core3log8__assertFiZv bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe4core14connectionpool8__assertFiZv bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe4core4task4Task5fiberMNgFNbNdZNgC4vibe4core4task9TaskFiber bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe2db5mongo6client11M€„ŽC€†�4lockConnectiñMFZS€…¶4core1ꀈšpool67__T16L€ƒ³ed€ŠµTC€Žé10€Š·15€†î€‰‘Z€’À bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe4data4bson4Bson6__ctorMFNcnZS4vibe4data4bson4Bson bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe2db5mongo6cursor11M€„ŽC€…�6__ctñMFNcC€�®lient€ˆ®€…�Ayai€�§10cñnectiñ5ReplyZS€¢÷ bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe2db5mongo5mongo12__ModuleInfoZ bin\TestProg.obj(TestProg) Error 42: Symbol Undefined _D4vibe4core3log12__ModuleInfoZ --- errorlevel 20 It would appear to be exactly the same :/ Josh
Jun 19 2013