View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0015855 | CMake | CMake | public | 2015-11-22 17:01 | 2016-05-02 08:30 | ||||
Reporter | Raphael Kubo da Costa | ||||||||
Assigned To | Brad King | ||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | FreeBSD | OS Version | ||||||
Product Version | CMake 3.4 | ||||||||
Target Version | CMake 3.4.1 | Fixed in Version | CMake 3.4.1 | ||||||
Summary | 0015855: "Disable shared library support when compiler links statically" forbids shared library builds with -nostdlib | ||||||||
Description | Commit 8b4873a1b025d7f47c90f3cafc93ca152b9e4652 ("Disable shared library support when compiler links statically") introduced a check in Modules/CMakeDetermineCompilerId.cmake that ends up running file(1) on the compiler itself and assumes it cannot generate shared libraries if file(1) says the compiler was statically linked. This breaks builds if one passes "-nostdlib" in C{XX}FLAGS and there's an ADD_LIBRARY(... SHARED ...) target: CMake Warning (dev) at CMakeLists.txt:3 (add_library): ADD_LIBRARY called with SHARED option but the target platform does not support dynamic linking. Building a STATIC library instead. This may lead to problems. This happens because if -nostdlib is passed, as running the binary produced by CMakeC{XX}CompilerId.c{pp}.in in will be statically linked (and crash on startup, even though it is not relevant here). On FreeBSD, this breaks the build of ports (packages) such as libcxxrt, which, being a very low-level library that provides features to a compiler, needs to be built with -nostdlib. This is not limited to FreeBSD, however, as the same file(1) returns a false-positive on Linux as well. | ||||||||
Steps To Reproduce | foo.c: int foo(void) { return 42; } CMakeLists.txt: project(foo) cmake_minimum_required(VERSION 3.4) add_library(foo SHARED foo.c) It will produce libfoo.a, not libfoo.so. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0039901) Brad King (manager) 2015-11-23 10:18 |
Thanks. We'll have to revert that commit and look for another solution to the problem it tried to address: Revert "Disable shared library support when compiler links statically" https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9682de56 [^] |
(0039902) Brad King (manager) 2015-11-23 10:19 |
I've queued this change for merge to the 'release' branch for inclusion in 3.4.1. |
(0040966) Robert Maynard (manager) 2016-05-02 08:30 |
Closing resolved issues that have not been updated in more than 4 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2015-11-22 17:01 | Raphael Kubo da Costa | New Issue | |
2015-11-23 09:47 | Brad King | Assigned To | => Brad King |
2015-11-23 09:47 | Brad King | Status | new => assigned |
2015-11-23 09:47 | Brad King | Target Version | => CMake 3.4.1 |
2015-11-23 10:18 | Brad King | Note Added: 0039901 | |
2015-11-23 10:19 | Brad King | Note Added: 0039902 | |
2015-11-23 10:19 | Brad King | Status | assigned => resolved |
2015-11-23 10:19 | Brad King | Resolution | open => fixed |
2015-11-23 10:19 | Brad King | Fixed in Version | => CMake 3.4.1 |
2016-05-02 08:30 | Robert Maynard | Note Added: 0040966 | |
2016-05-02 08:30 | Robert Maynard | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |