Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 28 days ago.
Improve this question
I am compiling LLVM and Clang from source but getting the following error when it tries to link lib/libclang-cpp.so.14git:-
/usr/bin/ld.gold: internal error in open, at ../../gold/descriptors.cc:99
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
I am using Gold Linker and my GCC version is 9.3.0. The LLVM branch is that of LLVM-12 (llvmorg-12.0.0). Earlier I was using LLD linker but that was causing memory overflow, after switching to Gold memory does not overflow but it still fails.
System specs:-
16GB RAM
512GB NVMe SSD
i7 10th Gen 8-cores
Also my swap size is 4GB. I have tried using lesser cores too, but the error still persists.
Any help would be appreciated. Thanks.
P.S:- I am an absolute noob when it comes to LLVM.strong text
I finally figured this out. I was getting the same error, but building a different project.
Turns out that gold is bad at reporting errors. The actual issue is that the OS is running out of file descriptors. In my case it was set to 1024 (you can check with ulimit -n) but a large linking job needed more than that.
If you bump the number of file descriptors then gold works just fine.
# I choose 65536, you can change this number
ulimit -n 65536
Why do I say gold is bad at reporting errors? Because if you force it to run on multithreaded mode (it defaults to single threaded) then it properly reports:
/usr/bin/ld.gold: fatal error: out of file descriptors and couldn't close any
Which is a more useful message.
Related
Building rocksdb on my Ubuntu 20.04 box. I get the following error:
In file included from db/malloc_stats.cc:16:
./port/jemalloc_helper.h:63:29: error: 'je_malloc' attribute directive ignored [-Werror=attributes]
63 | __attribute__((__weak__));
| ^
I'm compiling using a simple make -j and I have all the listed dependencies installed, including libjemalloc-dev, but I've tried uninstalling it to no avail. gcc version is 9.3.0. Reinstalling it as well. These attribute directives are an area of C++ I'm not at all familiar with and I have no idea how to diagnose this problem. If I pass DISABLE_WARNING_AS_ERROR, I end up with linker errors, so clearly this error is meaningful. Notably, I was able to build this quite recently on this machine, and I don't recall changing anything that would have affected this. I did system updates, but nothing else that would possibly cause this that I know of. I've checked previous commits of rocksdb and I get the same error so the problem is definitely on my end somehow, but I've checked with coworkers and none of them have this problem. Any ideas or advice on how to diagnose this issue would be appreciated.
EDIT: I've just tried running make alone, and while it took forever, the build succeeded. This is not practical and I'm still at a complete loss as to how to diagnose this issue.
EDIT 2: The successful build with make is not consistent, though I am confident that it succeeded at least once. When it doesn't succeed I get the same error as above.
I have found several conflicting answers over this topic. This blog post requires libuwind, but that doesn't work on Mac OS X. I included #include <google/profiler.h> in my code, however my compiler (g++) could not find the library. I installed gperftools via homebrew. In addition, I found this stackoverflow question showing this:
Then I ran pprof to generate the output:
[hidden ~]$ pprof --text ./a.out cpu.profile
Using local file ./a.out.
Using local file cpu.profile.
Removing __sigtramp from all stack traces.
Total: 282 samples
107 37.9% 37.9% 107 37.9% 0x000000010d72229e
16 5.7% 43.6% 16 5.7% 0x000000010d721a5f
12 4.3% 47.9% 12 4.3% 0x000000010d721de8
...
Running that command (without any of the prior steps) gets me this:
[hidden]$ pprof --text ./a.out cpu.profile
Using remote profile at ./a.out.
Failed to get the number of symbols from http://cpu.profile/pprof/symbol
Why does it try to access an internet site on my machine and a local file on his/hers?
Attempting to link lib profiler as a dry run with g++ gets me:
[hidden]$ g++ -l libprofiler
ld: library not found for -llibprofiler
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have looked at the man pages, the help option text, the official online guide, blog posts, and many other sources.
I am so confused right now. Can someone help me use gperftools?
The result of my conversation with #osgx was this script. I tried to clean it up a bit. It likely contains quite a few unnecessary options too.
The blog post https://dudefrommangalore.wordpress.com/2012/02/09/profiling-c-code-using-google-performance-tools/ "Profiling C++ code using Google Performance Tools" 2012 by dudefrommangalore missed the essential step.
You should link your program (which you want to be profiled) with cpu profiler library of gperftools library.
Check official manual: http://goog-perftools.sourceforge.net/doc/cpu_profiler.html, part "Linking in the Library"
add -lprofiler to the link-time step for your executable. (It's also probably possible to add in the profiler at run-time using LD_PRELOAD, but this isn't necessarily recommended.)
Second step is to collect the profile, run the code with profiling enabled. In linux world it was done by setting controlling environment variable CPUPROFILE before running:
CPUPROFILE=name_of_profile ./program_to_be_profiled
Third step is to use pprof (google-pprof in ubuntu world). Check that there is not-empty name_of_profile profile file generated; it there is no such file, pprof will try to do remote profile fetch (you see output of such try).
pprof ./program_to_be_profiled name_of_profile
First you need to run your program with profiling enabled.
This is usually first linking your program with libprofiler and then running it with CPUPROFILE=cpu.profile.
I.e.
$ CPUPROFILE=cpu.profile my_program
I think that later step is what you have been missing.
The program will create this cpu.profile file when it exits. And then you can use pprof (preferably from github.com/google/pprof) on it to visualize/analyze.
I am Mac OS 10.11 (El Capitan) user. I used 4.6 and when I tried to build some simulation I always get "Simulation terminated with exit code: 139" and couldn’t do nothing at all with that. I thought that when I install 5.0 then everything will be fine, but now I get something like that:
Simulation terminated with exit code: 132
Working directory: /Users/JL_Data/omnetpp-5.0/samples/tictoc
Command line: tictoc -r 0 --debug-on-errors=false omnetpp.ini
Environment variables:
PATH=/Users/JL_Data/omnetpp-5.0/bin::/usr/bin:/bin:/usr/sbin:/sbin
DYLD_LIBRARY_PATH=/Users/JL_Data/omnetpp-5.0/lib::
OMNETPP_IMAGE_PATH=/Users/JL_Data/omnetpp-5.0/images
And when I tried open some simulation in terminal I get:
Illegal instruction: 4
Do you have some idea what can I do with that problem? I tried to find something on the internet, but after one day I do not get any idea.
If you need some more information, please let me know.
As it is right now, your question is not completely clear, since it requires one to be familiar with omnet++ and probably some experience installing and setting it up. However, let me make a couple guesses.
First, Illegal instruction. This usually occurs when the binary was built for an architecture different than the one it's being run on; e.g. when then SSE2 or AVX instructions are present in the binary code, but are missing on the CPU.
See, for example, this SO question:
Find which assembly instruction caused an Illegal Instruction error without debugging
There is also a question that discusses exactly your problem, namely, "Illegal instruction: 4" on OS X:
What is the "Illegal Instruction: 4" error and why does "-mmacosx-version-min=10.x" fix it?
Now, since omnet++ appears to be an open source project, I expect it to have a mailing list and / or an IRC channel. Indeed, here is the communications page on the official website that links to a Google Groups-based mailing list:
https://omnetpp.org/get-involved
https://groups.google.com/forum/#!forum/omnetpp
I advise you to get in touch with the developers with a thorough description of your problem, since the chances of them knowing the solution are significantly higher compared to the chances of there being a user on SO who has faced similar problems when installing an identical version of omnet++ on an identical version of Mac OS X.
I am trying to compile OpenCL kernels on OS X. Everything is ok when there are just a few lines. However, after the code grows over 1.5k lines, clGetProgramBuildInfo with CL_PROGRAM_BUILD_LOG flag returned "Compile Server Error." every time. I googled but found nothing about it. Could anyone help me?
You can learn the meaning of OpenCL error codes by searching in cl.h. In this case, -11 is just what you'd expect, CL_BUILD_PROGRAM_FAILURE. It's certainly curious that the build log is empty. Two questions:
1.) What is the return value from clGetProgramBuildInfo?
2.) What platform are you on? If you are using Apple's OpenCL implementation, you could try setting CL_LOG_ERRORS=stdout in your environment. For example, from Terminal:
$ CL_LOG_ERRORS=stdout ./myprog
It's also pretty easy to set this in Xcode (Edit Scheme -> Arguments -> Environment Variables).
Please find the original answer by #James
This unhelpful error message indicates that there is bug in Apple's compiler. You can inform them of such bugs by using the Apple Bug Reporting System.
I'm trying to compile my application on AIX. It builds fine on Linux, Solaris x86 and Windows but this is the first time we've tried to build on AIX.
I've managed to get to the point of linking all of the libraries together and I get the error message:
Linking...
ld: 0711-101 FATAL ERROR: Allocation of 96864 bytes failed
in routine get_RLDs. There is not enough memory available.
Please check your ulimit or paging space
or use local problem reporting procedures.
collect2: ld returned 12 exit status
I've increased the page space by 1GB - no difference
I've increased the ulimit values - no difference
I've tried passing in the maxdata flag to the linker - no difference
Is there anything else I should be trying?
I'm not sure how to identify which library is causing the problem. We're trying to link statically against boost_date_time, xerces-c and libz and against 50 internal libraries. I can't change to dynamic linking and I can't change much about the structure of the system so I'm looking for ideas of configuration or parameters to try for ld.
The problem turned out to be the ulimit on the data seg size. Apparently that was still set quite small. Making it bigger like:
ulimit -d 1048575
allows the linker to get further.
Now to just figure out what I do about all of these undefined symbols.