74 lines
2.3 KiB
Plaintext
74 lines
2.3 KiB
Plaintext
|
** (UN)FREQUENTLY ASKED QUESTIONS **
|
||
|
|
||
|
1. Why do you have to specify PREFIX= even when building
|
||
|
when overriding the default ?
|
||
|
|
||
|
2. When overriding the default prefix, how do you compile
|
||
|
and link my program ?
|
||
|
|
||
|
--
|
||
|
1. Why do you have to specify PREFIX= even when building,
|
||
|
when overriding the default ?
|
||
|
|
||
|
Because it allows easier linking. The way the Linux
|
||
|
link loader works, if the library name has a slash in it,
|
||
|
then it resolves it that way. If it doesn't it goes through
|
||
|
a series of steps which tries to find it. However, without
|
||
|
updating a certain file it won't find it under '/usr/local'
|
||
|
(and similar with '/tmp'). Therefore, as long as you have
|
||
|
the same PREFIX= (or don't specify it at all), all you need
|
||
|
to do to link to the shared version is link to it (and any
|
||
|
other dependencies; -lpthread comes to mind here). For
|
||
|
example the link options might be :
|
||
|
-langelscript_s -lpthread
|
||
|
|
||
|
--
|
||
|
2. When overriding the default prefix, how do you compile
|
||
|
and link my program ?
|
||
|
|
||
|
An example scenario is the following :
|
||
|
You installed into /opt which means the following
|
||
|
files should exist :
|
||
|
|
||
|
/opt/include/angelscript.h
|
||
|
/opt/lib/libangelscript.so (which is a symbolic link to
|
||
|
the current version installed)
|
||
|
/opt/lib/libangelscript.a (the static library).
|
||
|
|
||
|
If you #include angelscript.h you might normally
|
||
|
have :
|
||
|
|
||
|
#include <angelscript.h>
|
||
|
|
||
|
However, when that file is not in the standard directories
|
||
|
the compiler searches, you have to either use :
|
||
|
|
||
|
#include "/opt/include/angelscript.h"
|
||
|
(method one)
|
||
|
or alternatively keep the include (using the angle brackets)
|
||
|
but pass the include path (or paths actually but in this case
|
||
|
path) to the compiler so it knows to search an additional
|
||
|
location. If you're using g++ then the following option
|
||
|
will work (it also works for gcc but I am assuming you
|
||
|
are using C++) :
|
||
|
|
||
|
-I/opt/include
|
||
|
|
||
|
You must however still link. You therefore must pass another
|
||
|
option to the compiler (which will pass it to the linker)
|
||
|
and the option os -L which is used like so (to follow the
|
||
|
scenario) :
|
||
|
|
||
|
-L/opt/lib
|
||
|
|
||
|
The rest is the same.
|
||
|
|
||
|
CONTACT INFO:
|
||
|
If you have any questions or concerns, by all
|
||
|
means have Andreas contact me (at this time I
|
||
|
don't have an email I feel okay sharing - if it
|
||
|
seems this is of use to others I will likely
|
||
|
create an email on my server for this very
|
||
|
purpose). For now Andreas can forward the
|
||
|
message to me.
|