Re: OSX, Need help with Compiling and linking errors

2014-07-13 Thread Mike Parker via Digitalmars-d-learn

On 7/13/2014 2:28 PM, Israel Rodriguez wrote:


What about the dub libraries, what kind of errors do you get if you try
to use a library not compatible for your system, say OSX or Linux? Im
assuming the same linking errors but im not sure.


dub doesn't download library binaries, but the source. It compiles each 
dependency along with your project (generally only once, unless you 
--force a rebuild or -upgrade the libraries) using the same compiler 
that is used to compile your source. So if any given library is using 
something that is unavailable on your platform, you will see 
compile-time errors rather than linker errors.


---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com



OSX, Need help with Compiling and linking errors

2014-07-12 Thread Israel Rodriguez via Digitalmars-d-learn
Ive been reading the OSX notes for the DMD compiler but not 
everything is clear to me as i dont know how exactly the compiler 
looks for things.


i wanted to test it out first using this package from 
code.dlang.org

http://code.dlang.org/packages/colorize
I downloaded the zip, extracted it, and dub was able to spit out 
a static library with the .a extension.

What do i do with it now? Where do i place it?

I have imported the library like it says import colorize : 
colorize, fg;
After i call dmd in the terminal like $ dmd main.d, All i get 
are linker errors but no compile errors even if i reference the 
static library in the same drectory as my main.d source file like 
so, $ dmd main.d libcolorize.a


Then the package mentions adding colorize as a dependency to my 
projects json file so i used the -X switch to generate it but i 
dont know exactly where the dependencies section goes.


As for the linker errors, they mention mostly:

===

Undefined symbols for architecture x86_64:
 
_D4dlib4math6matrix16__T6MatrixTdVi4Z6Matrix11__xopEqualsFKxS4dlib4math6matrix16__T6MatrixTdVi4Z6MatrixKxS4dlib4math6matrix16__T6MatrixTdVi4Z6MatrixZb, 
referenced from:
  
_D52TypeInfo_S4dlib4math6matrix16__T6MatrixTdVi4Z6Matrix6__initZ 
in main.o

ld: symbol(s) not found for architecture x86_64

===


Does this mean this library is just not compatible with OSX?

Extra Notes:
I have Xcode Installed along with the command line tools so GCC 
is in there too.

OSX 10.9.4
X11 - XQuartz


Re: OSX, Need help with Compiling and linking errors

2014-07-12 Thread Israel Rodriguez via Digitalmars-d-learn

On Sunday, 13 July 2014 at 01:53:10 UTC, Mike Parker wrote:

On 7/13/2014 3:54 AM, Israel Rodriguez wrote:



The linker errors do not refer to libcolorize. Notice this: 
_D4dlib4math6matrix. That is a dlib.math.matrix module. Is 
that a source module in your project or something from another 
library? If the former, you need to be compiling it along with 
your main.d. If the latter, you need to be linking with that 
library. However, I recommend you avoid using dmd on the 
command line for now and just use dub to manage your project 
(see below).



This has nothing to do with the json generated by DMD. It's 
referring to a dub.json which is a project configuration file 
for dub. If you create a dub.json, then you can run dub or 
dub build in your project directory and it will automatically 
compile all of your source modules and make sure that all of 
your dependencies (such as libcolorize) are downloaded, 
compiled and link. It's a complete build and package management 
system. You don't need to download your dependencies manually 
or compile from the command line if you are using dub. You can 
read more about the dub.json format at [1].


[1] http://code.dlang.org/package-format



Awesome thanks. Sorry about that linker error, i copied and 
posted the wrong error from a previous compile trial. Anyways i 
managed to fix my problem and my static libraries now compile 
without errors.


I will play with dub a little bit more. Thanks. I just thought i 
would learn from the beginning compiling and linking manually 
within the terminal. I had no idea dub could do all that for me.


What about the dub libraries, what kind of errors do you get if 
you try to use a library not compatible for your system, say OSX 
or Linux? Im assuming the same linking errors but im not sure.