Compile/Link 101

Craig Treleaven ctreleaven at cogeco.ca
Fri Oct 4 18:39:58 PDT 2013


Could someone please explain some very basic stuff about 
compiling/linking C and C++ code?  For a new version of Myth, the 
configure script succeeds with XCode 5 on Mtn Lion and _fails_ with 
XCode 4.3 on Lion.  The bit that I'm looking at just tests whether 
certain libraries (faac in this case) are installed and, if so, 
enables additional features in the package.  The 'config.ep' file 
(btw, is that a Unix/Linux standard thingy?) shows how it tried to do 
the test:

>BEGIN 
>/opt/local/var/macports/build/_Users_mytthtv_macports_mythtv-core.27_dev/mythtv-core.27/work/.tmp/mythtv_conf.xUGXlOJK.c
>     1	#include <stdint.h>
>     2	#include <faac.h>
>     3	long check_faacEncGetVersion(void) { return (long) faacEncGetVersion; }
>     4	int main(void) { return 0; }
>END 
>/opt/local/var/macports/build/_Users_mytthtv_macports_mythtv-core.27_dev/mythtv-core.27/work/.tmp/mythtv_conf.xUGXlOJK.c
>/usr/bin/clang -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 
>-D_LARGEFILE_SOURCE -D_DARWIN_C_SOURCE -DPIC -pipe -std=c99 
>-fomit-frame-pointer -fPIC -c -o 
>/opt/local/var/macports/build/_Users_mytthtv_macports_mythtv-core.27_dev/mythtv-core.27/work/.tmp/mythtv_conf.CaP65ZOS.o 
>/opt/local/var/macports/build/_Users_mytthtv_macports_mythtv-core.27_dev/mythtv-core.27/work/.tmp/mythtv_conf.xUGXlOJK.c
>/usr/bin/clang -Wl,-dynamic,-search_paths_first -o 
>/opt/local/var/macports/build/_Users_mytthtv_macports_mythtv-core.27_dev/mythtv-core.27/work/.tmp/mythtv_conf.7NGrnBrt 
>/opt/local/var/macports/build/_Users_mytthtv_macports_mythtv-core.27_dev/mythtv-core.27/work/.tmp/mythtv_conf.CaP65ZOS.o 
>-lfaac -lm -lbz2 -lz
>ld: library not found for -lfaac
>clang: error: linker command failed with exit code 1 (use -v to see 
>invocation)
>ERROR: libfaac not found

faac _is_ installed:
>MediaMini:~ mytthtv$ port installed |grep aac
>   faac @1.28_2 (active)

I actually don't know how the test _can succeed_ with XCode 5?  There 
is no '-L' flag to indicate that the library is under /opt/local/lib.

I must be missing something obvious.  Pointers to introductory 
material gratefully accepted.

Craig
-- 
--
Craig Treleaven, CA -- Clearview Consulting
(905) 829-2054  ctreleaven at cogeco.ca


More information about the macports-dev mailing list