0

Makefile contains .la extension file that create libclamav.

libclamav_la_LIBADD = @LIBLTDL@ $(IFACELIBADD) $(LLVMLIBADD) libclamav_internal_utils.la @LIBCLAMAV_LIBS@ @THREAD_LIBS@ @LIBM@

libclamav_la_DEPENDENCIES = @LTDLDEPS@ $(IFACEDEP) $(LLVMDEP) libclamav_internal_utils.la

libclamav_la_CFLAGS = -I../my_include/src/wrapper -DSEARCH_LIBDIR=\"$(libdir)\"

libclamav_la_LDFLAGS = -L/usr/lib32 -lOpenCL @TH_SAFE@ -version-info @LIBCLAMAV_VERSION@ -no-undefined

My point to link shared library to Makefile by add -L/my_shared_library_path/mylib.so to libclamav_la_LIBADD by example.

libclamav_la_LDFLAGS = -L/my_shared_library_path/ -lmylib @TH_SAFE@ -version-info @LIBCLAMAV_VERSION@ -no-undefined

Makefile cannot like member function name by through an errors.

../libclamav/.libs/libclamav.so: undefined reference to 'member_function_in_mylib.so'

R.Chatsiri
  • 107
  • 2
  • 11
  • Can you perform the link successfully on the command line (i.e. without a makefile), using those flags? – Beta Jun 25 '13 at 12:13

1 Answers1

1

The text quoted in your question clearly belongs in a Makefile.am (or Makefile.in) from an autoconf'd packed relying on pkg-config. If that is text that you have in a Makefile, then you have many more issues to deal with. Since @LIBCLAMAV_LIBS@ already appears in libclamav_la_LIBADD, you need to configure pkg-config to emit the proper flags to locate your library at configure time.

It is never appropriate to put machine specific code in a Makefile.am (or Makefile.in). Since my_shared_libary_path is specific to your box, the appropriate way to get the related flags into the build is via pkg-config or by adding to CPPFLAGS and LDFLAGS during configure. (Note: -I flags in an autoconf derived packed go in CPPFLAGS rather than CFLAGS)

If you did run configure, just try:

configure ... LDFLAGS=-L/my/shared/library/path CPPFLAGS=-I/my_include/src/wraper
William Pursell
  • 204,365
  • 48
  • 270
  • 300