linker

Link static library using CMake

≡放荡痞女 提交于 2020-01-28 10:58:06
问题 I cannot get the library ${static_library} to statically link using CMake. I have tried hard coding the path and as far as I'm aware TARGET_LINK_LIBRARIES should link this in automatically. ADD_LIBRARY(libraryA STATIC ${source_files}) TARGET_LINK_LIBRARIES(libraryA debug ${static_library}) There is a sub project that links libraryA later in the build ADD_EXECUTABLE(testA ${test_sources}) TARGET_LINK_LIBRARIES(testA libraryA) which has ${static_library} correctly linked in but I need ${static

Link static library using CMake

时间秒杀一切 提交于 2020-01-28 10:56:02
问题 I cannot get the library ${static_library} to statically link using CMake. I have tried hard coding the path and as far as I'm aware TARGET_LINK_LIBRARIES should link this in automatically. ADD_LIBRARY(libraryA STATIC ${source_files}) TARGET_LINK_LIBRARIES(libraryA debug ${static_library}) There is a sub project that links libraryA later in the build ADD_EXECUTABLE(testA ${test_sources}) TARGET_LINK_LIBRARIES(testA libraryA) which has ${static_library} correctly linked in but I need ${static

Ordering of object files and libraries in static linking

本秂侑毒 提交于 2020-01-25 00:41:07
问题 I've created a simple static library libvec.a with AR tool from simple addv.o and multo.o . The object file addv.o contains 1 function symbol ( addvec ) and multo.o contains 1 function ( multvec ). I have also written a simple program to test it ( driver.c which adds 2 vectors and uses addvec function from the library; also it has included vector.h that defines the function prototypes). And then I compiled it with gcc -static driver.o ./libvec.a and everything went okay. But at first I tried

nvcc is picking wrong libcudart library

杀马特。学长 韩版系。学妹 提交于 2020-01-24 21:37:14
问题 This problem comes when, I try to import theano with gpu mode. While importing the theano, it tries to compile some code, make a shared library of it and tries to load it. Here is the command to make the so file. nvcc -shared -O3 -m64 -Xcompiler -DCUDA_NDARRAY_CUH=mc72d035fdf91890f3b36710688069b2e,\ -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,-fPIC,-fvisibility=hidden -Xlinker \ -rpath,/home/jay/.theano/compiledir_Linux-4.8--ARCH-x86_64-with-arch-Arch-Linux--3.6.0-64/cuda_ndarray \ -I/usr/lib

nvcc is picking wrong libcudart library

偶尔善良 提交于 2020-01-24 21:37:07
问题 This problem comes when, I try to import theano with gpu mode. While importing the theano, it tries to compile some code, make a shared library of it and tries to load it. Here is the command to make the so file. nvcc -shared -O3 -m64 -Xcompiler -DCUDA_NDARRAY_CUH=mc72d035fdf91890f3b36710688069b2e,\ -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,-fPIC,-fvisibility=hidden -Xlinker \ -rpath,/home/jay/.theano/compiledir_Linux-4.8--ARCH-x86_64-with-arch-Arch-Linux--3.6.0-64/cuda_ndarray \ -I/usr/lib

Difference between *(.data), *(.data*) and *(.data.*) in linker script

十年热恋 提交于 2020-01-24 19:11:37
问题 Just curious to know what is the difference between such constructions (for text , data , rodata , bss etc) in linker script: .data : { *(.data) } .data : { *(.data*) } .data : { *(.data.*) } In all cases we gather data sections from all object files, but the devil is in the detail. Fast test showed that addresses in map file differ and in turn it influences the size of executable file. I tried to find the information in ld documentation but found nothing (or just missed it). I guess that it

Difference between *(.data), *(.data*) and *(.data.*) in linker script

六眼飞鱼酱① 提交于 2020-01-24 19:11:13
问题 Just curious to know what is the difference between such constructions (for text , data , rodata , bss etc) in linker script: .data : { *(.data) } .data : { *(.data*) } .data : { *(.data.*) } In all cases we gather data sections from all object files, but the devil is in the detail. Fast test showed that addresses in map file differ and in turn it influences the size of executable file. I tried to find the information in ld documentation but found nothing (or just missed it). I guess that it

ESP8266: What can I do to overcome “section `.text' will not fit in region `iram1_0_seg'”?

我是研究僧i 提交于 2020-01-24 13:16:49
问题 What are general measures against the .text region not fitting into "iram1_0_seg" when linking for the ESP8266 using the xtensa GCC based toolchain? I guess that the ESP8266s RAM is not big enough to hold certain functions. However, what can I do to move as many functions into flash as possible? Here is an example of what the linker returns: /home/user/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-gcc -I/home/user/git/esp-open-sdk/sdk/include

How to create shared library specific singleton instances

雨燕双飞 提交于 2020-01-24 09:47:09
问题 I have a set of plugins for an application which all link to a common base library. The base library defines a singleton which maintains a list of all object constructors in each plugin. On windows, I can create this base library as a static library and thus a copy of the singleton is placed in each plugin. However on Linux I have a bit of the opposite problem as this fellow. I've tried the following so far: Build base as shared library (as per the original author) Build base as static with

Why do optimisation flags cause linker errors for some template functions?

情到浓时终转凉″ 提交于 2020-01-24 05:23:08
问题 I have a problem where an app compiles fine in debug mode with all optimization turned off. But the moment I compile for release it prints out unresolved link errors. The functions in question are the following: template <typename T> T & Block::val(size_t offset) { return *(reinterpret_cast<T*>(_data + offset)); } template <typename T> const T & Block::val(size_t offset) const { return *(reinterpret_cast<T*>(_data + offset)); } And the errors I'm getting all look like: undefined reference to