Thread: Makefile help...I think

  1. #1
    Registered User
    Join Date
    Jul 2011
    Location
    Champaign, Illinois, United States
    Posts
    27

    Makefile help...I think

    Although the problem I am getting is a result of running snort I do not think my problem is snort specific so I am going to go ahead an ask it. First of for a reference point, when executing snort here is what happens:
    Code:
     Loading dynamic preprocessor library /opt/local/lib/snort_dynamicpreprocessor/libsf_smtp_preproc.so... ERROR: Failed to load /opt/local/lib/snort_dynamicpreprocessor/libsf_smtp_preproc.so: dlopen(/opt/local/lib/snort_dynamicpreprocessor/libsf_smtp_preproc.so, 6): Symbol not found: _asn_DEF_Certificate
      Referenced from: /opt/local/lib/snort_dynamicpreprocessor/libsf_smtp_preproc.so
      Expected in: dynamic lookup
    I think what is happening here is that I added a non-standard library, or at least I want to. But the default makefile does not know this so the new header and source files never actually get compiled and linked with the default files. So my question is, since I am makefile retarded, how can I add these new dependencies to the original makefile? There is a different makefile in each directory inside the snort directory, and since I am working with just the ssl preprocessor there are actually two makefiles in the ssl preprocessor directory. One called Makefile and another called Makefile.am. So I am trying to add a library and I am including using #include statements. Anyone have any ideas on how to help me out or steer me in the right direction? I can post any additional information if anyone wants to take a look. Thanks in advance!

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Makefile.am is what automake uses to make the Makefile, which is what make uses when compiling your files.

    So the question is: Does /opt/local/lib/snort_dynamicpreprocessor/libsf_smtp_preproc.so exist on your system? If not, where were you planning to get the function asn_DEF_Certificate from?

  3. #3
    Registered User
    Join Date
    Jul 2011
    Location
    Champaign, Illinois, United States
    Posts
    27
    /opt/local/lib/snort_dynamicpreprocessor/libsf_smtp_preproc.so does exist on my machine. The asn_DEF_Certificate function is a function that should be created using the asn1c compiler. I already compiled the asn1 file into the source and header files using the asn1c compiler. Now I am trying to implement the functions created in those files. I am using this as a guide Using the Open Source ASN.1 Compiler so I included my asn1 files but adding #include <Certificate.h> but to me it seems like these new files aren't being linked properly. Is this making any sense?

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    I'm guessing you mean "use" when you say "implement". The question is still: where is the asn_DEF_Certificate function actually written? Is it supposed to be in this .so, or is it supposed to be elsewhere?

  5. #5
    Registered User
    Join Date
    Jul 2011
    Location
    Champaign, Illinois, United States
    Posts
    27
    Yes, I do mean "use" instead of "implement" sorry for the clerical error. asn_DEF_Certificate is defined in the Certificate.c file. Here is the definition:
    Code:
    asn_TYPE_descriptor_t asn_DEF_Certificate = {
    	"Certificate",
    	"Certificate",
    	SEQUENCE_free,
    	SEQUENCE_print,
    	SEQUENCE_constraint,
    	SEQUENCE_decode_ber,
    	SEQUENCE_encode_der,
    	SEQUENCE_decode_xer,
    	SEQUENCE_encode_xer,
    	0, 0,	/* No PER support, use "-gen-PER" to enable */
    	0,	/* Use generic outmost tag fetcher */
    	asn_DEF_Certificate_tags_1,
    	sizeof(asn_DEF_Certificate_tags_1)
    		/sizeof(asn_DEF_Certificate_tags_1[0]), /* 1 */
    	asn_DEF_Certificate_tags_1,	/* Same as above */
    	sizeof(asn_DEF_Certificate_tags_1)
    		/sizeof(asn_DEF_Certificate_tags_1[0]), /* 1 */
    	0,	/* No PER visible constraints */
    	asn_MBR_Certificate_1,
    	3,	/* Elements count */
    	&asn_SPC_Certificate_specs_1	/* Additional specs */
    };

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Ah, variable not function. In any event you need to make sure your Certificate.c file is compiled with everything else. Look through your Makefile.am, you should have a line that ends in _SOURCES and a bunch of .c files on the line; add Certificate.c to that line.

    (EDIT: I suppose I should mention that of course you then need to regenerate your makefile....)
    Last edited by tabstop; 08-08-2011 at 01:04 PM.

  7. #7
    Registered User
    Join Date
    Jul 2011
    Location
    Champaign, Illinois, United States
    Posts
    27
    How can I regenerate the makefile?

  8. #8
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    The same way you made the makefile in the first place. Probably something like "automake" and then "configure".

    (EDIT: I've been assuming that you've actually been using a makefile, by typing "make" when you want to compile your source. Is that even true?)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Not sure how to put this into a Makefile
    By redruby147 in forum C Programming
    Replies: 4
    Last Post: 07-07-2009, 12:45 PM
  2. Need help with makefile
    By New_Programmer in forum C++ Programming
    Replies: 5
    Last Post: 03-31-2009, 04:55 PM
  3. makefile help
    By disruptivetech in forum C++ Programming
    Replies: 10
    Last Post: 04-26-2008, 02:14 PM
  4. makefile
    By shuo in forum C++ Programming
    Replies: 1
    Last Post: 11-18-2007, 01:41 AM
  5. difference makefile makefile.am makefile.in
    By Bargi in forum Linux Programming
    Replies: 7
    Last Post: 10-28-2007, 02:08 PM