I'm trying to make the --dynamic-linker option work with CodeSourcery's ARM cross toolchain. However gcc seems to ignore it, and never adds an interpreter segment in the shared library's ELF. What am I missing to make this work?
I doubt gcc ignores the option. Add -v to the compiler command line to verify that the option is indeed passed to the linker.
More likely, you are using the option incorrectly. --dynamic-linker is taking a =file argument, and you didn't mention that you are passing one.
Edit: as you found out, you have no .interp section in your linker script. However, you should - see this example.
Related
Say I have compiled a project (not my own) with autotools and passed some flags to configure. Now I want to compile this same project again, but with slightly different configure flags. Is there a way to tell the configure script to use the old flags, but update them with some additional ones?
I would love to see an easier approach, but to simply add flags you can do:
sed -i '/^ac_configure_extra_args=/s/$/--new-flag --other-flag/' config.status
./config.status --recheck
Normally, I manually edit config.status to do this, and not all sed support -i, but you get the idea. Change the original flags as they are defined in config.status to be the flags you want.
Another option is to cut-n-paste the original configure invocation out of the top of config.log and edit it.
I'm trying to install CurlPP, but it seems to put "-Os" in the CXXFLAGS. Then, it tries to remove the optimization flag, but the regex is -O[0-9] in automake doesn't match the 's'. This is causing builds to fail.
Where does this "-Os" come from? Is this a legitimate optimization flag, or what?
How can I change CXXFLAGS on my machine with homebrew?
-Os is optimise for size. It's pretty standard on any C compiler to be honest. Perhaps just change the regex?
Thank you, I have the same problem, but I had no idea why it complains about some 's' in command line!
The fix is really simple: run brew edit curlpp, then insert line
ENV.remove_from_cflags(/-O./)
at the beginning of the install function in the script. That turns off the optimization though, so you may find better solution. But the package installs well.
Just like we specify input flags in the settings of the project in Xcode
Can I make few flags like -O3 or -fopenmp as default flags in command line when I use Terminal.
So that I dont have to type them everytime I compile some c++ fies. Is there a file in the installed gcc or C++ that I can edit to make them default.
Please let me know
thanks
For situations like this you'd probably use a makefile if it's project specific (or other similar automated build management like scons or cmake).
If you want it always on the terminal, you can alias your command to always specify those options, i.e.
alias g++='g++ -O3 -fopenmp'
Note that you said 'terminal' so I assume this is a type of *nix. If that is the case you can also set this into your terminal profile, like ~/.bashrc if you use bash, or ~/.zshrc if you use zsh, etc.
Lately I have been working on OS X. Things were going pretty peachy for a while until somehow ld got on my system and now gcc won't use dyld. Furthermore, all of my shared libraries are in *.dylib format, and ld is stubornly ignoring there existance. If I mv ld from PATH, gcc just complains it cant find ld.
Please help me to get gcc back on track and using what it should.
You can try some gcc options. From the man page:
-c Compile or assemble the source files, but do not link. The linking
stage simply is not done. The ultimate output is in the form of an
object file for each source file.
You could then link explicitly using whatever linker you want.
Does it help to symlink ld to dyld?
mv /usr/bin/ld /usr/bin/ld.old
ln -s /usr/bin/dyld /usr/bin/ld
Edit: fixed ld params order
This isn't your exact question, but I had a need to switch to ld.gold, and for that, the -fuse-ld=gold option to gcc was very useful.
look at -Xlinker option
I got it from man gcc
you can double check using some verbose options like -v
I am using GNU autoconf/automake. Is there any way I can control what make prints to stdout from configure.ac or Makefile.am? For example, suppress mv and cp commands being printed out to the screen, only print the name of the file being compiled by gcc rather than the whole command line, highlight gcc warnings in some way.
Is Prettify Automake what you want?
Edit: As of Automake 1.10b, silent-rules is built-in. Not the same code or style but similar in effect.
Modern Automake (after in 1.10b) supports --silent-rules which will suppress the full compile command. (eg, output is "CC foo" instead of "gcc -DHAVE_CONFIG_H ...") That may be all you need. You need to add "silent-rules" to AM_INIT_AUTOMAKE and pass --enable-silent-rules to configure (or put it in CONFIG_SITE) to enable the feature. See the automake docs for details.
I believe the easiest thing is to write a wrapper script which runs *make and parses the output. I believe I have seen this being done in Ubuntu somewhere ...