{"comment":{"url":"https://api.github.com/repos/libopencm3/libopencm3/comments/14880796","html_url":"https://github.com/libopencm3/libopencm3/commit/7c1cd2e5cd3f3d1193ee375b46cfd8afaccb89f7#commitcomment-14880796","id":14880796,"user":{"login":"anatol","id":7032,"avatar_url":"https://avatars.githubusercontent.com/u/7032?v=3","gravatar_id":"","url":"https://api.github.com/users/anatol","html_url":"https://github.com/anatol","followers_url":"https://api.github.com/users/anatol/followers","following_url":"https://api.github.com/users/anatol/following{/other_user}","gists_url":"https://api.github.com/users/anatol/gists{/gist_id}","starred_url":"https://api.github.com/users/anatol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anatol/subscriptions","organizations_url":"https://api.github.com/users/anatol/orgs","repos_url":"https://api.github.com/users/anatol/repos","events_url":"https://api.github.com/users/anatol/events{/privacy}","received_events_url":"https://api.github.com/users/anatol/received_events","type":"User","site_admin":false},"position":18,"line":74,"path":"Makefile","commit_id":"7c1cd2e5cd3f3d1193ee375b46cfd8afaccb89f7","created_at":"2015-12-09T18:09:43Z","updated_at":"2015-12-09T18:09:43Z","body":"> The reallllly common problem with this install step is that people were installing into their toolchain, and then passing -L paths inside their toolchain, which confuses/breaks multilib toolchains\r\n\r\nWhen you say toolchain do you mean 'gcc' or 'ld'? For 'ld' it is indeed required to use `-L` flag like this `-L /usr/arm-none-eabi/lib/`. The explanation is that default script includes a number paths where it searches for libopencm3 libraries:\r\n\r\n```\r\n$ arm-none-eabi-ld --verbose | grep SEARCH_DIR\r\nSEARCH_DIR(\"=/usr/arm-none-eabi/lib\"); SEARCH_DIR(\"=/usr/local/lib\"); SEARCH_DIR(\"=/lib\"); SEARCH_DIR(\"=/usr/lib\");\r\n```\r\n\r\nI believe most users do not use default linker script and instead include stm32 one `INCLUDE libopencm3_stm32f4.ld`. That script does not specify any search paths:\r\n\r\n```\r\n$ arm-none-eabi-ld --verbose -T /usr/arm-none-eabi/lib/libopencm3_stm32f4.ld  | grep SEARCH_DIR\r\n```\r\n\r\nThus path `/usr/arm-none-eabi/lib/` should be provided by the command line.\r\n\r\nOther way to solve the problem is to add `SEARCH_DIR` directly to stm32 linker scripts. For example with following script instruction `SEARCH_DIR(\"=/lib\");` in `/usr/arm-none-eabi/lib/libopencm3_stm32f4.ld` I do not need to use any -L flag."}}