I have been editing my Makefile since the original post, so the linker is no longer getting ‘-lm -lcsa’. The final lines now look like this:
/bin/sh ./libtool --tag=CC --mode=link /opt/local/bin/gcc -O2 -m64 -fPIC -g -Wall -L/opt/local/lib -o csabathy src/csabathy-csa.o src/csabathy-svd.o src/csabathy-minell.o libcsa.la -lm -L/opt/local/lib libtool: link: /opt/local/bin/gcc -O2 -m64 -fPIC -g -Wall -o .libs/csabathy src/csabathy-csa.o src/csabathy-svd.o src/csabathy-minell.o -L/opt/local/lib ./.libs/libcsa.dylib -lm Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status make: *** [csabathy] Error 1 My Makefile.am contains this currently: ACLOCAL_AMFLAGS = -I m4 --install lib_LTLIBRARIES = libcsa.la libcsa_la_SOURCES = src/csa.c \ src/svd.c \ src/minell.c libcsa_la_LIBADD = -lm include_HEADERS = src/csa.h src/svd.h src/minell.h src/nan.h bin_PROGRAMS = csabathy csabathy_SOURCES = src/csa.c \ src/csa.h \ src/svd.c \ src/svd.h \ src/minell.c \ src/minell.h \ src/nan.h csabathy_CFLAGS = $(AM_CFLAGS) csabathy_LDADD = libcsa.la -lm csabathy_DEPENDENCIES = src/csa.lo \ src/svd.lo \ src/minell.lo EXTRA_DIST = /src/m4/NOTES Thanks for the help. > On Jun 30, 2016, at 11:57 PM, Václav Haisman <vhais...@gmail.com> wrote: > > On 30 June 2016 at 03:03, JASON TILLEY <jdtil...@aol.com> wrote: >> I am trying to create a Makefile.am for a package on github in order to make >> it more friendly to packaging (https://github.com/sakov/csa-c). I am having >> linking problems on my Mac. I’m sure its my complete lack of understanding >> of Automake. My make command executes the following: >> >> depbase=`echo src/csa.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ >> /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. >> -I./src -g -O2 -MT src/csa.lo -MD -MP -MF $depbase.Tpo -c -o src/csa.lo >> src/csa.c &&\ >> mv -f $depbase.Tpo $depbase.Plo >> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I./src -g -O2 -MT src/csa.lo -MD >> -MP -MF src/.deps/csa.Tpo -c src/csa.c -fno-common -DPIC -o src/.libs/csa.o >> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I./src -g -O2 -MT src/csa.lo -MD >> -MP -MF src/.deps/csa.Tpo -c src/csa.c -o src/csa.o >/dev/null 2>&1 >> depbase=`echo src/svd.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ >> /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. >> -I./src -g -O2 -MT src/svd.lo -MD -MP -MF $depbase.Tpo -c -o src/svd.lo >> src/svd.c &&\ >> mv -f $depbase.Tpo $depbase.Plo >> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I./src -g -O2 -MT src/svd.lo -MD >> -MP -MF src/.deps/svd.Tpo -c src/svd.c -fno-common -DPIC -o src/.libs/svd.o >> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I./src -g -O2 -MT src/svd.lo -MD >> -MP -MF src/.deps/svd.Tpo -c src/svd.c -o src/svd.o >/dev/null 2>&1 >> depbase=`echo src/minell.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ >> /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. >> -I./src -g -O2 -MT src/minell.lo -MD -MP -MF $depbase.Tpo -c -o >> src/minell.lo src/minell.c &&\ >> mv -f $depbase.Tpo $depbase.Plo >> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I./src -g -O2 -MT src/minell.lo >> -MD -MP -MF src/.deps/minell.Tpo -c src/minell.c -fno-common -DPIC -o >> src/.libs/minell.o >> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I./src -g -O2 -MT src/minell.lo >> -MD -MP -MF src/.deps/minell.Tpo -c src/minell.c -o src/minell.o >/dev/null >> 2>&1 >> /bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -o libcsa.la -rpath >> /usr/local/lib src/csa.lo src/svd.lo src/minell.lo >> libtool: link: gcc -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -o >> .libs/libcsa.0.dylib src/.libs/csa.o src/.libs/svd.o src/.libs/minell.o >> -g -O2 -install_name /usr/local/lib/libcsa.0.dylib -compatibility_version >> 1 -current_version 1.0 -Wl,-single_module >> libtool: link: (cd ".libs" && rm -f "libcsa.dylib" && ln -s "libcsa.0.dylib" >> "libcsa.dylib") >> libtool: link: ar cru .libs/libcsa.a src/csa.o src/svd.o src/minell.o >> libtool: link: ranlib .libs/libcsa.a >> libtool: link: ( cd ".libs" && rm -f "libcsa.la" && ln -s "../libcsa.la" >> "libcsa.la" ) >> gcc -DHAVE_CONFIG_H -I. -I./src -g -O2 -MT src/csabathy-csa.o -MD -MP >> -MF src/.deps/csabathy-csa.Tpo -c -o src/csabathy-csa.o `test -f 'src/csa.c' >> || echo './'`src/csa.c >> mv -f src/.deps/csabathy-csa.Tpo src/.deps/csabathy-csa.Po >> gcc -DHAVE_CONFIG_H -I. -I./src -g -O2 -MT src/csabathy-svd.o -MD -MP >> -MF src/.deps/csabathy-svd.Tpo -c -o src/csabathy-svd.o `test -f 'src/svd.c' >> || echo './'`src/svd.c >> mv -f src/.deps/csabathy-svd.Tpo src/.deps/csabathy-svd.Po >> gcc -DHAVE_CONFIG_H -I. -I./src -g -O2 -MT src/csabathy-minell.o -MD -MP >> -MF src/.deps/csabathy-minell.Tpo -c -o src/csabathy-minell.o `test -f >> 'src/minell.c' || echo './'`src/minell.c >> mv -f src/.deps/csabathy-minell.Tpo src/.deps/csabathy-minell.Po >> /bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 '-lm -lcsa' -o >> csabathy src/csabathy-csa.o src/csabathy-svd.o src/csabathy-minell.o >> libcsa.la >> libtool: link: gcc -g -O2 -o .libs/csabathy src/csabathy-csa.o >> src/csabathy-svd.o src/csabathy-minell.o -lm >> /Users/username/Downloads/csa-c-master/.libs/libcsa.dylib >> ./.libs/libcsa.dylib >> Undefined symbols for architecture x86_64: >> "_main", referenced from: >> implicit entry/start for main executable >> ld: symbol(s) not found for architecture x86_64 >> collect2: error: ld returned 1 exit status >> make: *** [csabathy] Error 1 >> >> Does anyone know what this error means? Thanks. > > Where is the Makefile.am? We need to see that to be able to diagnose your > issue. > > At least the '-lm -lcsa' argument on the linking command looks fishy. > > -- > VH