Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3361278
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:08:00+00:00 2026-05-18T03:08:00+00:00

I just tried out the latest LLVM and Clang trunk versions. They compiled without

  • 0

I just tried out the latest LLVM and Clang trunk versions. They compiled without a single warning out of the box, but I’m having trouble linking a Hello, World! example. My code is

#include <stdio.h>

int main(){
  printf("Hello, World!\n");
}

If I compile using

clang test.c

I get the following error

/usr/bin/ld: crt1.o: No such file: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Using -v shows that the GNU ld is invoked as:

"/usr/bin/ld" --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o a.out crt1.o crti.o crtbegin.o -L -L/../../.. /tmp/cc-0XJTsG.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o crtn.o

But I have the crt1.o object file!

locate crt1.o

Output:

/usr/lib/Mcrt1.o
/usr/lib/Scrt1.o
/usr/lib/crt1.o
/usr/lib/gcrt1.o

This also works:

clang -c test.c
gcc test.o

And of course

gcc test.c

What I further tried:

clang -Xlinker "-L /usr/lib" test.c

/usr/bin/ld: crt1.o: No such file: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)

clang -Xlinker "-L /usr/lib" test.c -v

"/usr/bin/ld" --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o a.out crt1.o crti.o crtbegin.o -L -L/../../.. -L /usr/lib /tmp/cc-YsI9ES.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o

I also tried copying the crt1.o file into the current directory. That seemed to work. Well, it didn’t compile because after that crti.o was missing.

My Linux distribution is Ubuntu.

Well, I don’t really know what to try next. I don’t see how I could fix clang nor do I have an idea on how to inject the necessary path in the ld invocation. Any ideas?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T03:08:01+00:00Added an answer on May 18, 2026 at 3:08 am

    It seems to be the Clang version which can’t detect the host’s Linux version and GCC version…

    This code in Clang which must add path to the crt*:

    llvm → tools → clang → lib → Driver → Tools.cpp

      CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crt1.o")));
      CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crti.o")));
      CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crtbegin.o")));
    

    and the GetFilePath will try to search asked files in getFilePaths() list of current ToolChain (file clang/lib/Driver/ToolChains.cpp). If it can’t find a file it will return the Name unchanged.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just read Emacs :TODO indicator at left side , and tried it out.
I just got out of a small project and I've tried to follow a
I tryed to email me debug_backtrace() but it just prints out the array. I
I've tried everything to figure this out but I can't get the correct total.
I just downloaded the latest version of SmartMusic (http://www.smartmusic.com) and tried running it for
I just found out that LightSwitch 2011 is out. I tried to install it
Ive just tryed some things out with my new server today, and ive found
UPDATE Turns out I'm just tired. There isn't any problem here sorry for wasting
Just tried some small graphics application of mine on Windows 7, and I'm getting
I just tried to install git-flow, however, it does not seem to be integrated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.