digitalmars.D.learn - Installing Modules
- TJB (7/7) Mar 28 2012 All,
- Jesse Phillips (21/28) Mar 28 2012 There are many ways to go about using modules, I will go over
- TJB (13/45) Mar 28 2012 Okay. I tried this. I think I am close. I followed the
- Jesse Phillips (6/18) Mar 28 2012 You don't import scid; as that is just a package, you need a
- TJB (15/37) Mar 28 2012 Thank you for your patience with me. I now have the following
- Johannes Pfau (14/25) Mar 29 2012 The command Jesse posted is missing a "-L-lscid" and you'll probably
- Jesse Phillips (4/8) Mar 29 2012 Ah, you are right, though I selected /usr/local/lib as it is
- TJB (4/12) Mar 29 2012 Brilliant. Works perfectly. Thanks for your help. You guys are
- TJB (7/22) Apr 13 2012 OK. I now can compile a simple program that imports a module
- Jesse Phillips (12/18) Apr 13 2012 I'm not familiar with this library, you'll have to take a look
All, I'm very new to D. I am wanting to install the SciD module (David Simcha's fork), but I don't know how to go about it. Can you guide me? Where does the code go? How do I import it? Thanks, TJB
Mar 28 2012
On Wednesday, 28 March 2012 at 23:55:38 UTC, TJB wrote:All, I'm very new to D. I am wanting to install the SciD module (David Simcha's fork), but I don't know how to go about it. Can you guide me? Where does the code go? How do I import it? Thanks, TJBThere are many ways to go about using modules, I will go over installing a module for Linux. Usually the simplest way to get started is to pass all files to the compiler (you use an import statement to import the modules). Build SciD as a library. $ dmd -lib -oflibscid.a all.d files.d for.d SciD.d Copy lib to /usr/local/lib Copy sciD source files in the same direcectory structure (propably starting with scid/) to /usr/local/src Installed. Create a main.d file somewhere: $ cat main.d import scid.something; void main() {} $ dmd -I/usr/local/src main.d Windows would be something different, however optlink doesn't have a standard set of locations to look for library files. you can also pass the library to dmd $ dmd -I/usr/local/src main.d libscid.a -- If it is in the same directory as main.d
Mar 28 2012
On Thursday, 29 March 2012 at 02:07:24 UTC, Jesse Phillips wrote:On Wednesday, 28 March 2012 at 23:55:38 UTC, TJB wrote:Okay. I tried this. I think I am close. I followed the instructions that you gave (thanks btw)! But, I get this error message: $ dmd -I/usr/local/src main.d main.d(1): Error: module scid is in file 'scid.d' which cannot be read import path[0] = /usr/local/src import path[1] = /Users/name/dmd2/src/phobos import path[2] = /Users/name/dmd2/src/druntime/import Thoughts? Thanks! TJBAll, I'm very new to D. I am wanting to install the SciD module (David Simcha's fork), but I don't know how to go about it. Can you guide me? Where does the code go? How do I import it? Thanks, TJBThere are many ways to go about using modules, I will go over installing a module for Linux. Usually the simplest way to get started is to pass all files to the compiler (you use an import statement to import the modules). Build SciD as a library. $ dmd -lib -oflibscid.a all.d files.d for.d SciD.d Copy lib to /usr/local/lib Copy sciD source files in the same direcectory structure (propably starting with scid/) to /usr/local/src Installed. Create a main.d file somewhere: $ cat main.d import scid.something; void main() {} $ dmd -I/usr/local/src main.d Windows would be something different, however optlink doesn't have a standard set of locations to look for library files. you can also pass the library to dmd $ dmd -I/usr/local/src main.d libscid.a -- If it is in the same directory as main.d
Mar 28 2012
On Thursday, 29 March 2012 at 03:02:27 UTC, TJB wrote:Okay. I tried this. I think I am close. I followed the instructions that you gave (thanks btw)! But, I get this error message: $ dmd -I/usr/local/src main.d main.d(1): Error: module scid is in file 'scid.d' which cannot be read import path[0] = /usr/local/src import path[1] = /Users/name/dmd2/src/phobos import path[2] = /Users/name/dmd2/src/druntime/import Thoughts? Thanks! TJBYou don't import scid; as that is just a package, you need a module such as: import scid.matrix; but it will truely depend on which modules you need for the code you are writing.
Mar 28 2012
On Thursday, 29 March 2012 at 04:01:49 UTC, Jesse Phillips wrote:On Thursday, 29 March 2012 at 03:02:27 UTC, TJB wrote:Thank you for your patience with me. I now have the following simple test code: import scid.matrix; void main() {} Then I run and get the following error: $ dmd -I/usr/local/src main.d Undefined symbols: "_D4scid6matrix12__ModuleInfoZ", referenced from: _D4main12__ModuleInfoZ in main.o ld: symbol(s) not found collect2: ld returned 1 exit status --- errorlevel 1 Thank you for your help! TJBOkay. I tried this. I think I am close. I followed the instructions that you gave (thanks btw)! But, I get this error message: $ dmd -I/usr/local/src main.d main.d(1): Error: module scid is in file 'scid.d' which cannot be read import path[0] = /usr/local/src import path[1] = /Users/name/dmd2/src/phobos import path[2] = /Users/name/dmd2/src/druntime/import Thoughts? Thanks! TJBYou don't import scid; as that is just a package, you need a module such as: import scid.matrix; but it will truely depend on which modules you need for the code you are writing.
Mar 28 2012
Am Thu, 29 Mar 2012 06:15:07 +0200 schrieb "TJB" <broughtj gmail.com>:Thank you for your patience with me. I now have the following simple test code: import scid.matrix; void main() {} Then I run and get the following error: $ dmd -I/usr/local/src main.dThe command Jesse posted is missing a "-L-lscid" and you'll probably also need "-L-L/usr/local/lib" So the complete command should be: dmd -I/usr/local/src -L-L/usr/local/lib -L-lscid main.d Here's a short explanation of those flags: the "-L" prefix tells dmd to ignore this argument and pass it to the linker(ld). So in our case, "-lscid" and "-L/usr/local/lib" are passed to the linker. "-l" means link in a library, here 'scid'. The linker appends the 'lib' prefix and 'a' suffix for you, so it searches for a 'libscid.a' file. "-L" (passed to the linker!) adds a directory to the library search path. These are the directories which are searched by the linker when looking for the 'libscid.a' file.
Mar 29 2012
On Thursday, 29 March 2012 at 08:55:41 UTC, Johannes Pfau wrote:The command Jesse posted is missing a "-L-lscid" and you'll probably also need "-L-L/usr/local/lib" So the complete command should be:Ah, you are right, though I selected /usr/local/lib as it is already part of LD's search path. but asking for the lib is still required (-L-lscid).
Mar 29 2012
On Thursday, 29 March 2012 at 15:15:35 UTC, Jesse Phillips wrote:On Thursday, 29 March 2012 at 08:55:41 UTC, Johannes Pfau wrote:Brilliant. Works perfectly. Thanks for your help. You guys are awesome! TJBThe command Jesse posted is missing a "-L-lscid" and you'll probably also need "-L-L/usr/local/lib" So the complete command should be:Ah, you are right, though I selected /usr/local/lib as it is already part of LD's search path. but asking for the lib is still required (-L-lscid).
Mar 29 2012
On Friday, 30 March 2012 at 00:20:16 UTC, TJB wrote:On Thursday, 29 March 2012 at 15:15:35 UTC, Jesse Phillips wrote:OK. I now can compile a simple program that imports a module from the SciD library. How do I do something a little more interesting like initialize a vector or matrix and do some linear algebra with it? Thanks so much for your help. This forum is awesome! TJBOn Thursday, 29 March 2012 at 08:55:41 UTC, Johannes Pfau wrote:Brilliant. Works perfectly. Thanks for your help. You guys are awesome! TJBThe command Jesse posted is missing a "-L-lscid" and you'll probably also need "-L-L/usr/local/lib" So the complete command should be:Ah, you are right, though I selected /usr/local/lib as it is already part of LD's search path. but asking for the lib is still required (-L-lscid).
Apr 13 2012
On Friday, 13 April 2012 at 23:06:38 UTC, TJB wrote:OK. I now can compile a simple program that imports a module from the SciD library. How do I do something a little more interesting like initialize a vector or matrix and do some linear algebra with it? Thanks so much for your help. This forum is awesome! TJBI'm not familiar with this library, you'll have to take a look through the documentation: https://github.com/kyllingstad/scid/wiki I see there is a matrix module http://www.kyllingen.net/code/scid/doc/scid_matrix.html import scid.matrix; void main() { auto m = matrix(5, 10); } Then go modify its values, and use some linalg functions with it: http://www.kyllingen.net/code/scid/doc/scid_linalg.html
Apr 13 2012