www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - setup problem wih dub

reply "Jason den Dulk" <public2 jasondendulk.com> writes:
Hi.

Package in question: fpdf
Dub version I'm using: 0.9.22
DMD version: 2.066.1 (64 bit)
Platform: Fedora 19 (64-bit).

I created the fpdf package, and it is dependant on the 
imageformats package, but it won't compile. When I place a copy 
of imageformats.d into the project source directory, it compiles 
fine. However when I rely on dub dependancy, the linker complains 
that it cannot find the functions in imageformats. Following is a 
copy of the dub package. Any insight would be appreciated.
Thanks in advance.

{
   "name": "fpdf",
   "description": "Minimalist class for generating PDF documents.",
   "authors": [ "Jason den Dulk" ],
   "license": "BSL-1.0",
   "platforms": ["posix"],
   "targetType": "sourceLibrary",
   "dependencies": { "imageformats" : ">=3.0.3" },
   "importPaths": [ "src" ],

   "configurations":
   [
     {
       "name": "sample",
       "targetType": "executable",
       "platforms": ["posix"],
       "mainSourceFile": "src/sample.d"
     }
   ]
}
Jan 07 2015
parent Rikki Cattermole <alphaglosined gmail.com> writes:
On 8/01/2015 4:48 p.m., Jason den Dulk wrote:
 Hi.

 Package in question: fpdf
 Dub version I'm using: 0.9.22
 DMD version: 2.066.1 (64 bit)
 Platform: Fedora 19 (64-bit).

 I created the fpdf package, and it is dependant on the imageformats
 package, but it won't compile. When I place a copy of imageformats.d
 into the project source directory, it compiles fine. However when I rely
 on dub dependancy, the linker complains that it cannot find the
 functions in imageformats. Following is a copy of the dub package. Any
 insight would be appreciated.
 Thanks in advance.

 {
    "name": "fpdf",
    "description": "Minimalist class for generating PDF documents.",
    "authors": [ "Jason den Dulk" ],
    "license": "BSL-1.0",
    "platforms": ["posix"],
    "targetType": "sourceLibrary",
    "dependencies": { "imageformats" : ">=3.0.3" },
    "importPaths": [ "src" ],

    "configurations":
    [
      {
        "name": "sample",
        "targetType": "executable",
        "platforms": ["posix"],
        "mainSourceFile": "src/sample.d"
      }
    ]
 }
1) Ignoring it only works for 64bit 2) "targetType": "sourceLibrary" Is only for when you don't want the source to be built as a .lib/.so file but provided to packages as source files when used as a dependency 3) imageformats package is used as a sourceLibrary. And never provides any source files to compile with. This is a rather big no no. As dub does not know what to compile with your code.
Jan 07 2015