CMake and Static Linking

I’ve managed to solve my problem by using the following: #Dynamic/Shared Libs … #Static start set_target_properties(icarus PROPERTIES LINK_SEARCH_START_STATIC 1) set_target_properties(icarus PROPERTIES LINK_SEARCH_END_STATIC 1) set(CMAKE_FIND_LIBRARY_SUFFIXES “.a”) #Static Libs … #Set Linker flags set(CMAKE_EXE_LINKER_FLAGS “-static-libgcc -static-libstdc++”) This works without passing a -static which creates other big issues, and can essentially mix static and dynamic libraries. As long … Read more

How does GCC’s ‘-pg’ flag work in relation to profilers?

Compiling with -pg instruments your code, so that Gprof reports detailed information. See gprof’s manual, 9.1 Implementation of Profiling: Profiling works by changing how every function in your program is compiled so that when it is called, it will stash away some information about where it was called from. From this, the profiler can figure … Read more

How to install ‘make’ and GCC on a Mac

Update for newer versions: The command line versions can now be installed straight from the command line itself; Open “Terminal” (it is located in Applications/Utilities) In the terminal window, run the command xcode-select –install In the windows that pops up, click Install, and agree to the Terms of Service. Once the installation is complete, the … Read more

How do debug symbols affect performance of a Linux executable compiled by GCC?

The debug symbols are located in totally different sections from the code/data sections. You can check it with objdump: $ objdump -h a.out a.out: file format elf64-x86-64 Sections: Idx Name Size VMA LMA File off Algn 0 .interp 0000001c 0000000000400200 0000000000400200 00000200 2**0 CONTENTS, ALLOC, LOAD, READONLY, DATA 1 .note.ABI-tag 00000020 000000000040021c 000000000040021c 0000021c 2**2 … Read more

Can gcc use multiple cores when linking?

Try gold, which was developed by Ian Lance Taylor et al. from Google and released as part of GNU binutils package. From Wikipedia: The motivation for writing gold was to make a linker that is faster than the GNU linker, especially for large applications coded in C++ I must admit I haven’t tried it myself … Read more

What are “nosys”, “nano”, “rdimon” terms when using ARM GCC?

Gcc uses specs-strings, which control which subprocesses to run and what parameters it shall pass to them. The behavior defined by the spec-strings can be overridden using spec-files, whose purpose and syntax is documented here: https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html Looking at these spec files in the lib folder of the gcc tool chain (e.g. /usr/lib/arm-none-eabi/lib) we can see … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)