Linking a C program directly with ld fails with undefined reference to `__libc_csu_fini`

后端 未结 8 1475
被撕碎了的回忆
被撕碎了的回忆 2020-11-30 08:54

I\'m trying to compile a C program under Linux. However, out of curiosity, I\'m trying to execute some steps by hand: I use:

  • the gcc frontend to produce assemb
相关标签:
8条回答
  • 2020-11-30 09:42

    This is how I fixed it on ubuntu 11.10:

    apt-get remove libc-dev
    

    Say yes to remove all the packages but copy the list to reinstall after.

    apt-get install libc-dev
    
    0 讨论(0)
  • 2020-11-30 09:46

    Since you are doing the link process by hand, you are forgetting to link the C run time initializer, or whatever it is called.

    To not get into the specifics of where and what you should link for you platform, after getting your intel asm file, use gcc to generate (compile and link) your executable.

    simply doing gcc hello.c -o hello should work.

    0 讨论(0)
提交回复
热议问题