-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Questions | ||
- what does it mean when brew installs a C library? ( "as C authors, the package manager is a key means by which we can get libraries for folding into our work") How does it play with apple-installed libraries of apps? (like gcc or c libraries) How do you even install C libraries on OSX? (`brew search libcurl` yields nothing) | ||
- difference between terminal (eg. mintty on Windows) and shell (eg. bash) | ||
|
||
# Notes | ||
- gprof (part of binutils; http://www.gnu.org/software/binutils/binutils.html) apparently not supported on OSX? use dtrace instead. | ||
|
||
# Tentative goals | ||
- wrap aqbanking for python | ||
- ??? (others!) | ||
|
||
# C "stack" | ||
- compiler, POSIX tools, packet manager (for (ISO (?) standard or not) libraries and more POSIX tools) | ||
|
||
## Compiling | ||
1. set compiler flags | ||
2. list libraries to link to (static libraries are linked by the compilerby copying their contents into the final executable, shared libraries are linked at runtime). (what is the linker exactly? is it a separate tool? if so, why do we say "the compiler is linking the (static) library") | ||
3. | ||
|
||
## Where are libraries installed | ||
"the usual places" | ||
- standard vendor directory | ||
- standard directory for custom local packages (/usr/local); home directories | ||
other places | ||
- | ||
Check for where libraries are installed with `find /usr -name 'lib*'` | ||
|
||
### Env variables | ||
CPATH, C_INCLUDE_PATH, LIBRARY_PATH, etc | ||
gcc on Linux and gcc on OSX use different variables | ||
|
||
### Passing library paths to compiler and linker (runtime) | ||
-Lpath (compile time) and -Rpath (runtime) | ||
LD_LIBRARY_PATH (Linux/Cygwin) or DYLD_LIBRARY_PATH(OSX): (additional) search path for shared libraries at runtime | ||
|
||
# Tools | ||
- See what libraries a program or dynamically linked library depends on: | ||
• Cygwin:cygcheck libxx.dll | ||
• Linux:ldd libxx.so | ||
• Mac: otool -L libxx.dylib | ||
|
||
# Various info | ||
- Cygwin: run by Red Hat (?). Uses a C library providing POSIX functions on Windows (cygwin1.dll apparently?). The library hides some differences between Windows and POSIX systems (eg. unified file system vs distinct drives). Tools that are used on POSIX systems (ls, bash, grep, make, etc) are compiled by linking to this library. A package manager is allowing the user to install all or a subset of these tools. | ||
|
||
# Finding libraries with pkg-config | ||
- pkg-config is looking for `libname.pc` files | ||
- | ||
## brew-installed libraries | ||
apparently it matters if brew-installed pkg-config is used (??) | ||
``` | ||
margold@home-macbook ~/RC/aqbanking-5.6.10 $ ls -lh `which pkg-config` | ||
lrwxr-xr-x 1 margold brew 42B Jun 6 16:10 /usr/local/bin/pkg-config -> ../Cellar/pkg-config/0.29.1/bin/pkg-config | ||
``` | ||
|
||
when it works: | ||
``` | ||
margold@home-macbook ~ $ pkg-config --libs libpng | ||
-L/usr/local/Cellar/libpng/1.6.17/lib -lpng16 | ||
# .pc file was installed by brew | ||
margold@home-macbook ~ $ brew ls --verbose libpng | grep pc | ||
/usr/local/Cellar/libpng/1.6.17/lib/pkgconfig/libpng.pc | ||
/usr/local/Cellar/libpng/1.6.17/lib/pkgconfig/libpng16.pc | ||
``` | ||
|
||
when it doesn't | ||
``` | ||
margold@home-macbook ~ $ pkg-config --libs gmp | ||
Package gmp was not found in the pkg-config search path. | ||
Perhaps you should add the directory containing `gmp.pc' | ||
to the PKG_CONFIG_PATH environment variable | ||
No package 'gmp' found | ||
# no .pc file was installed by brew | ||
brew ls --verbose gmp | grep pc | ||
``` |