I have a C library with a makefile that builds a shared library. Within my own CMAKE c++11 project, I target_link_libraries that shared library and include the header files. When building, during the linking process, I get the following error:
stdout: invalid version 5 (max 0)
error adding symbols: bad value
Based on a similar issue described in this post: gcc Invalid version (max ) error adding symbols: Bad value, I attempted to use a version script to prevent any symbol collision. I added the commands to use the below script into the flags within the makefile for the library
CODEABI_1.0{
local:*;
};
However, this made no difference, and the error remains. This issue feels especially odd to me, as the referenced stackoverflow post and other similar posts all cover issues where the function is being defined within the library itself or within a linked static library, and that function is causing collisions. However, stdout is not being defined in the library, and is a part of the language.
As well, modifying the library itself is a last resort.
I'm not sure how to solve this issue, as all solutions I've been able to find deal with cases where there are library export conflicts, and not what I suppose are language conflicts. Any solutions would be greatly appreciated.
I am compiling this on ubuntu 20.04.2 using make: 4.2.1, gcc 9.3.0
To reproduce:
CMakeLists.txt relevant section from my project
add_custom_command(
TARGET /*insert target*/
COMMAND make
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/relevant/path
)
target_link_libraries(/*target*/
/*other libs*/
${CMAKE_CURRENT_SOURCE_DIR}/relevant/path/to/file
)
target_include_directories(/*target*/
${CMAKE_CURRENT_SOURCE_DIR}/relevant/path
)
link to makefile for library: https://github.com/flightaware/dump1090/blob/master/Makefile
exampleHeader.h
void funct(void);
exampleC.c
#include "libraryHeader.h"
void funct(void){
funcFromLibraryCall();
}
exampleCxxHeader.h
int main();
exampleCxx.cpp
extern "C"{
#include "exampleHeader.h"
}
int main(){
funct();
}