Thread: error in makefile when compile C program

  1. #1
    Registered User
    Join Date
    Apr 2017
    Posts
    51

    error in makefile when compile C program

    I have a makefile
    Code:
    MQLIB =   -L${MQM_HOME}/ -lmqmcs -lmqmzse
    MYLIB = -L${ONLINE_HOME}/src/ -lmqm
    #ORALIB = -L${ORACLE_HOME}/lib32/ -lclntsh
    ORALIB = -L${ORACLE_HOME}/lib/ -lclntsh
    
    ALLLIB     =     $(MQLIB) \
                     $(ORALIB) \
                     $(MYLIB) \
                    -lsocket -lnsl -ldl
    CFLAGS     =    -g \
                    $(ALLINCL)
    When I try to compile program, it say:

    Code:
    Linking /applications/dte/bin/fin2ici
            /usr/vacpp/bin/cc -DMQ_SEND  /applications/dte/src/dte_mq.o  /applications/dte/src/fin2ici.o  -o  /applications/dte/bin/fin2ici -L/usr/mqm/ -lmqmcs -lmqmzse  -L/data/oracle/product/11.2.0.4.7/lib/ -lclntsh  -L/applications/dte/src/ -lmqm  -lsocket -lnsl -ldl
    ld: 0706-006 Cannot find or open library file: -l socket
            ld:open(): No such file or directory
    make: The error code from the last command is 255.
    
    Stop.
    I addition when I type
    Code:
    which socket
    it says:
    Code:
     which socket
    no socket in /export/applications/ibm6000/CPAN/64-5.8.8-vac8-aix5.3/bin /usr/bin /usr/sbin /etc /usr/java14_64/bin /applications/dte/sh /applications/dte/bin /usr/vacpp/bin /export/applications/ibm6000/subversion/bin /export/applications/ibm6000/gnu/bin /usr/lpp/mqm/samp/bin /usr/local/bin /db/pub/infra/GNUgcc/3.2.2/bin /home/dteprod/bin /data/oracle/product/11.2.0.4.7/bin /db/pub/infra/SYBSclnt/12.5/OCS-12_5/bin /applications/dte/java/tools/apache-ant-1.7.0/bin /applications/dte/java/tools/axis-1_4/bin

    where is my mistake?
    Thanks
    Last edited by digioleg54; 12-23-2017 at 09:18 AM.

  2. #2
    Guest
    Guest
    Try locate libsocket. It looks like it cannot be found among the paths supplied.

  3. #3
    Registered User
    Join Date
    Apr 2017
    Posts
    51
    Quote Originally Posted by Guest View Post
    Try locate libsocket. It looks like it cannot be found among the paths supplied.
    how to do it in C UNIX AIX?

  4. #4
    Guest
    Guest
    If locate doesn't exist (it well might not), try e.g. find / -type f -name libsocket*

    On what do you base your assumption that the library in question is installed on your system? Maybe it isn't!

  5. #5
    Registered User
    Join Date
    Dec 2017
    Posts
    1,633
    which looks for commands, so it won't find a library file.

    Does your program compile if you leave out the -lsocket ?
    A little inaccuracy saves tons of explanation. - H.H. Munro

  6. #6
    Registered User
    Join Date
    Apr 2017
    Posts
    51
    I didn't try, let me do that

  7. #7
    Registered User
    Join Date
    Apr 2017
    Posts
    51
    It does not compile without -lsocket

  8. #8
    Registered User
    Join Date
    Dec 2017
    Posts
    1,633
    Quote Originally Posted by digioleg54 View Post
    It does not compile without -lsocket
    What is the error?
    A little inaccuracy saves tons of explanation. - H.H. Munro

  9. #9
    Registered User
    Join Date
    Apr 2017
    Posts
    51
    and locate doesn't exist, and find didn't find it. What else can I do?

  10. #10
    Registered User
    Join Date
    Apr 2017
    Posts
    51
    ld: 0711-317 ERROR: Undefined symbol: .ologof
    ld: 0711-317 ERROR: Undefined symbol: .orlon
    ld: 0711-317 ERROR: Undefined symbol: .oopen
    ld: 0711-317 ERROR: Undefined symbol: .oclose
    ld: 0711-317 ERROR: Undefined symbol: .oexec
    ld: 0711-317 ERROR: Undefined symbol: .ocom
    ld: 0711-317 ERROR: Undefined symbol: .oparse
    ld: 0711-317 ERROR: Undefined symbol: .odefin
    ld: 0711-317 ERROR: Undefined symbol: .oexfet
    ld: 0711-317 ERROR: Undefined symbol: .obndrv
    ld: 0711-317 ERROR: Undefined symbol: .ofetch
    ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
    make: The error code from the last command is 8.

  11. #11
    Registered User
    Join Date
    Dec 2017
    Posts
    1,633
    You may need to ask a local expert. Look at those undefined symbols: open, close, exec, ...

    As far as I know, the socket functions should be in the standard C library (libc.a), as mentioned here: socket. So you shouldn't have to link to another library for those.
    A little inaccuracy saves tons of explanation. - H.H. Munro

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compile error with Makefile...
    By LockTim in forum C++ Programming
    Replies: 3
    Last Post: 09-11-2013, 11:04 AM
  2. Replies: 5
    Last Post: 12-05-2011, 05:07 PM
  3. Replies: 15
    Last Post: 11-28-2011, 11:48 AM
  4. Using a makefile to compile a program using SDL
    By Noerbo in forum Game Programming
    Replies: 9
    Last Post: 04-30-2006, 09:11 AM
  5. Compile via makefile?
    By Blackroot in forum C++ Programming
    Replies: 21
    Last Post: 01-21-2006, 12:00 AM

Tags for this Thread