Compiling errors for SGI Origin

This is a discussion on Compiling errors for SGI Origin within the C Programming forums, part of the General Programming Boards category; Hi, I'm trying to use my code on a SGI Origin machine (IRIX64) and I am getting some compiling errors. ...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    23

    Compiling errors for SGI Origin

    Hi,

    I'm trying to use my code on a SGI Origin machine (IRIX64) and I am getting some compiling errors. I ran my program on another Linux machine and there were no errors.
    Here is my error message:
    Code:
    cc-1164 cc: WARNING File = main-pthread.c, Line = 143
      Argument of type "void *" is incompatible with parameter of type
              "void *(*)(void *)".
    
                            if (pthread_create(&threads[j], NULL, (void *)elim_fcn, (void *)&param[j])) 
                                                                  ^
    
    ld32: WARNING 84 : /usr/lib32/libpthread.so is not used for resolving any symbol.
    ld32: WARNING 84 : /usr/lib32/mips4/libm.so is not used for resolving any symbol.
    ld32: ERROR   33 : Unresolved text symbol "pthread_join" -- 1st referenced by main-pthread.o.
            Use linker option -v to see when and which objects, archives and dsos are loaded.  
    ld32: INFO    152: Output file removed because of error.
    For the warning I don't know why this happens as elim_fcn is of type: void *elim_fcn(t_param *t).

    As for the error I compile the program with: cc -lpthread -lm main-pthread.c Why isn't the -lpthread resolving the pthread_join?
    Thanks.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You aren't supposed to assign functions (pointers to) to void pointer. They're incompatible types. That's what your error is telling you.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    23
    Hi,

    then how much am I suppose to write pthread_create?
    But that was just a warning... my bigger problem is how come it does not recognize pthread_join..

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    man pthread_join

    As to your other function, consider making a typedef to the appropriate function pointer type and using that as an argument instead of a void pointer.


    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,548
    If your thread function is declared properly to begin with, then the cast is redundant.
    The other cast is pretty dubious as well, since the function should be accepting void* to begin with.

    > cc -lpthread -lm main-pthread.c
    Compiler command lines are order sensitive.

    cc main-pthread.c -lpthread -lm

    The linker has to see the unresolved symbol first (in the .c file) in order to know to extract the actual implementation from the library.
    Without any symbols to resolve, a library just gets skipped.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User
    Join Date
    Feb 2006
    Posts
    23
    Hi,
    thanks Poseidon... that really helped alot.

    I'm not sure if people here know about this (out of scope maybe) but I'm getting desperate and don't know where to post. On this IRIX64 machine you have to submit your jobs to the portable batch system (PBS), but I can't get it to work...
    here is how my script looks like:
    Code:
    #PBS -l mem=256mb
    #PBS -l ncpus=2
    #PBS -V
    ./pthread.out 100 2 >> t2.txt
    then I do qsub <script_name>
    And I get the following error:
    /usr/spool/PBS/mom_priv/jobs/20334.euler.SC[4]: ./pthread.out: cannot execute

    Does anyone know what I am doing wrong? Why won't it accept any of my jobs?
    Thanks.

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,548
    Unless you named it differently, the default executable file is a.out
    Check that you're in the right directory.
    Have you successfully used PBS before now?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  8. #8
    Registered User
    Join Date
    Feb 2006
    Posts
    23
    I changed the executable to pthread.out... and this is my first time using PBS so I have yet to get it to work..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 03-10-2008, 07:03 AM
  2. Quincy 2005: Compiling Errors
    By Thileepan_Bala in forum C Programming
    Replies: 6
    Last Post: 01-18-2008, 07:26 PM
  3. Replies: 2
    Last Post: 12-07-2004, 01:31 AM
  4. errors when compiling, but I don't know what they mean
    By indigo0086 in forum C++ Programming
    Replies: 7
    Last Post: 11-04-2002, 01:50 PM
  5. stupid errors i got after compiling!! HELP ME!
    By Leeman_s in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2001, 04:13 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21