lib files and MacOS

Archives Forums/MacOS X Discussion/lib files and MacOS

gman(Posted 2006) [#1]
im trying to link into a libIrrlicht.a file for MacOS. i placed the file in the lib folder under BMAX same as i do for windows. when i try to build though, i get a "ld:can't open: -lIrrlicht (No such file or directory, errno = 2)" error. i have also tried placing the .a file in the root of the mod that uses it and also in the root of the BMX sample app im trying to build both with no luck. is there something else i need to do in order for -l to work in MacOS?

thank you.


gman(Posted 2006) [#2]
i found some references online to where other libs put their .a files. referenced was /usr/local/lib. i checked for that dir but did not find it but i did find /usr/local. tried to create /usr/local/lib but it wouldnt let me even though the login i was under was an admin account. so then i noticed the /usr/lib folder which appeared to have a crapload of .a files in it. i tried copying the .a there but still, permission denied. so heres where im at:

a) where am i supposed to put the .a file so BlitzMax can find it?

b) if the location needs some special rights, how do i enable myself to copy the file there?

thank you.


Brucey(Posted 2006) [#3]
You should just be able to import the .a file using a standard Import statement in Max.
Import "libIrrlicht.a"

...assuming the .a is in the same directory as the .bmx file.

Unless I'm very much mistaken, the .a file should be compiled into the resulting executable.


gman(Posted 2006) [#4]
thx for the reply Brucey. given that i should have it in a location that it will be found. heres a question... the .a file was built in xcode 2.2 and OS10.4. would this make it incompatible with xcode 1.5 and 10.3?


gman(Posted 2006) [#5]
does anyone know how to set the PATH environment variable in OSX?


Brucey(Posted 2006) [#6]
I don't imagine there would be a problem using a .a file like that. The only issues that are likely to crop up are if the file links to other libraries that have changed between 10.3 and 10.4.
Best bet is just to give it a go and see :-)

As for setting paths... you can do something like this on a command line :
(if you are using a Bash shell)
export PATH=$PATH:/my/path/addition/here
or, (if you are using the tcsh shell)
set path = ( $path /my/path/addition/here )

If you want to make the path changes more permanent, there are other places where you can add this line.
This page describes it quite well : http://www.peachpit.com/articles/article.asp?p=31442&seqNum=4&rl=1


....she sells sea shells on the sea shore....
....You'll see c shells, bourne shells, korn shells and more....


salric(Posted 2006) [#7]
GMan,

Regarding your 'access denied' problems. If you open Terminal (under Applications/Utilities) you can execute commands with root priveleges via the SUDO command.

i.e. sudo mkdir /usr/local/lib will execute the mkdir command (make directory) with root access. You will be asked for your administrator password each time you use the sudo command.

In summary, any command that needs root access; precede it with sudo & you'll be fine. A little tip - if you ever find during your messing around that you move files to your trash that you can't delete (you can't empty trash) you can force trash to empty with sudo rm -rf /.Trashes/

Keep up the good work Gman; I don't need to say I'm anxious to see you get this working!


gman(Posted 2006) [#8]
thx for all the help guys. Brucey actually hit the nail on the head but i was near-sited and missed it. for some reason, on my Mac, the import statements that work for win and linux dont work.
Import "-lIrrlicht" ' doesnt work

vs
Import "libIrrlicht.a" ' works

and it found it.

@salric - thx for the info. sudo did work for me and i was able to work with those directories. the compiler still did not find the .a file there though after copying the file into those locations.

i now have another problem (see new post). doesnt seem to end :)