gcc

How to support dynamic plugins when statically linking in standard libraries?

让人想犯罪 __ 提交于 2021-02-10 05:39:17
问题 Suppose an application myapp.exe is built using g++ and it uses the flag -static-libstdc++ so that it can be installed in enviroments without libstdc++.so . myapp.exe also adds plugin support for some function plugf that can be dynamically loading via dlopen from a shard library. If libplug.so is such a plugin library that also links to libstdc++ , how can it do so in a way to be able to work with myapp.exe ? This is straightforward if libstdc++ is linked in dynamically since both myapp.exe

How do you Implement printf in GCC from Newlib?

送分小仙女□ 提交于 2021-02-10 05:20:46
问题 I'm struggling to properly implement printf from newlib into my esp32, using GCC. I've gone through the newlib documentation and it gives me general information about how printf is called, but doesn't explain the back end implementation to me. Based on my current research I have determined that printf outputs a formatted string to the STDOUT. On a PC this was simpler for me to understand because there's a console window that would display the formatted output from printf, however on an

Linking static libraries into shared: enum class in header -> relocation R_X86_64_PC32 against undefined symbol

北战南征 提交于 2021-02-10 05:19:50
问题 What I want to do I try to separate my code into modules, which are compiled as static libraries with the -fPIC option. Finally, they are to be linked into a shared library using --whole-archive , also compiled with -fPIC . For the whole compilation, I use CMake generated make files and C++17 with GCC8 ! Problem Trying to do so with GCC8 x86_64 and libstdc++_pic fails with: /usr/bin/x86_64-linux-gnu-ld: CMakeFiles/shirabeengine.dir/code/source/core/engine.cpp.o: relocation R_X86_64_PC32

Linking static libraries into shared: enum class in header -> relocation R_X86_64_PC32 against undefined symbol

不问归期 提交于 2021-02-10 05:19:29
问题 What I want to do I try to separate my code into modules, which are compiled as static libraries with the -fPIC option. Finally, they are to be linked into a shared library using --whole-archive , also compiled with -fPIC . For the whole compilation, I use CMake generated make files and C++17 with GCC8 ! Problem Trying to do so with GCC8 x86_64 and libstdc++_pic fails with: /usr/bin/x86_64-linux-gnu-ld: CMakeFiles/shirabeengine.dir/code/source/core/engine.cpp.o: relocation R_X86_64_PC32

Linking static libraries into shared: enum class in header -> relocation R_X86_64_PC32 against undefined symbol

旧城冷巷雨未停 提交于 2021-02-10 05:19:12
问题 What I want to do I try to separate my code into modules, which are compiled as static libraries with the -fPIC option. Finally, they are to be linked into a shared library using --whole-archive , also compiled with -fPIC . For the whole compilation, I use CMake generated make files and C++17 with GCC8 ! Problem Trying to do so with GCC8 x86_64 and libstdc++_pic fails with: /usr/bin/x86_64-linux-gnu-ld: CMakeFiles/shirabeengine.dir/code/source/core/engine.cpp.o: relocation R_X86_64_PC32

How do you Implement printf in GCC from Newlib?

家住魔仙堡 提交于 2021-02-10 05:18:58
问题 I'm struggling to properly implement printf from newlib into my esp32, using GCC. I've gone through the newlib documentation and it gives me general information about how printf is called, but doesn't explain the back end implementation to me. Based on my current research I have determined that printf outputs a formatted string to the STDOUT. On a PC this was simpler for me to understand because there's a console window that would display the formatted output from printf, however on an

'Compiler proper' command for C program

孤街浪徒 提交于 2021-02-10 05:09:56
问题 This is regarding the compilation steps mentioned in the Linux Journal article. The C program was compiled using cpp , cc1 , as and ld commands in that article. I am able to execute the steps with cpp , as and ld . But the cc1 throws error. cpp hello_new_world.c -o hello_new_world.i As I am unable to use cc1: gcc -S hello_new_world.i -o hello_new_world.s ld -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr

'Compiler proper' command for C program

老子叫甜甜 提交于 2021-02-10 05:03:19
问题 This is regarding the compilation steps mentioned in the Linux Journal article. The C program was compiled using cpp , cc1 , as and ld commands in that article. I am able to execute the steps with cpp , as and ld . But the cc1 throws error. cpp hello_new_world.c -o hello_new_world.i As I am unable to use cc1: gcc -S hello_new_world.i -o hello_new_world.s ld -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr

Cython: prange is repeating not parallelizing

…衆ロ難τιáo~ 提交于 2021-02-10 04:13:35
问题 I have the following simple Cython function for a parallel reduction: # cython: boundscheck = False # cython: initializedcheck = False # cython: wraparound = False # cython: cdivision = True # cython: language_level = 3 from cython.parallel import parallel, prange cpdef double simple_reduction(int n, int num_threads): cdef int i cdef int sum = 0 for i in prange(n, nogil=True, num_threads=num_threads): sum += 1 return sum Which horrifyingly returns the following: In [3]: simple_reduction(n=10,

Cython: prange is repeating not parallelizing

守給你的承諾、 提交于 2021-02-10 04:07:36
问题 I have the following simple Cython function for a parallel reduction: # cython: boundscheck = False # cython: initializedcheck = False # cython: wraparound = False # cython: cdivision = True # cython: language_level = 3 from cython.parallel import parallel, prange cpdef double simple_reduction(int n, int num_threads): cdef int i cdef int sum = 0 for i in prange(n, nogil=True, num_threads=num_threads): sum += 1 return sum Which horrifyingly returns the following: In [3]: simple_reduction(n=10,