Link errors during Static linking of OCCI/ OCI programs in Oracle 12c - static-linking

I am trying to develop statically linked OCi/OCCI application and I am getting lots of undefined errors like following.
Can somebody tell me which .a libs to be included at link line.
Thanks.
/u01/home/oracle/product/12.1.0.2/lib/libnls12.a(lxxmlidc.o): In function lxXmlIdConv':
lxxmlidc.c:(.text+0x15d): undefined reference tolxuCvtToCtx'
lxxmlidc.c:(.text+0x23f): undefined reference to lxu4TstClass'
lxxmlidc.c:(.text+0x36f): undefined reference tolxu4TstClass'
lxxmlidc.c:(.text+0x386): undefined reference to lxu4TstClass'
lxxmlidc.c:(.text+0x39d): undefined reference tolxu4TstClass'
lxxmlidc.c:(.text+0x3be): undefined reference to lxu4TstClass'
/u01/home/oracle/product/12.1.0.2/lib/libnls12.a(lxxmlidc.o):lxxmlidc.c:(.text+0x7d4): more undefined references tolxu4TstClass' follow
/u01/home/oracle/product/12.1.0.2/lib/libnls12.a(lxuca.o): In function lxucaFindLastNonCombiningChar':
lxuca.c:(.text+0xc82): undefined reference tolxu4GCombiningClass'
/u01/home/oracle/product/12.1.0.2/lib/libnls12.a(lxuca.o): In function lxucaFindTrimPosition':
lxuca.c:(.text+0xfd6): undefined reference tolxuCvtToCtx'
/u01/home/oracle/product/12.1.0.2/lib/libnls12.a(lxuca.o): In function lxucaGetKey':
lxuca.c:(text.hot+0xb2c): undefined reference tolxuComposition'
lxuca.c:(text.hot+0xe06): undefined reference to lxu4GCombiningClass'
lxuca.c:(text.hot+0xeaa): undefined reference tolxu4GCombiningClass'
lxuca.c:(text.hot+0x112b): undefined reference to lxu4GCombiningClass'
/u01/home/oracle/product/12.1.0.2/lib/libnls12.a(lxuca.o): In functionlxucaConvertAndDecompose':
lxuca.c:(text.hot+0x181a): undefined reference to lxuDecomposition'
/u01/home/oracle/product/12.1.0.2/lib/libnls12.a(lxuca.o): In functionlxucaGetImplicitWeightBase':
lxuca.c:(text.hot+0x1b16): undefined reference to lxu4GBlock'
/u01/home/oracle/product/12.1.0.2/lib/libnls12.a(lxpisac.o): In functionlxpIsACollationElement':
lxpisac.c:(.text+0x2fc): undefined reference to lxuCvtToCtx'
/u01/home/oracle/product/12.1.0.2/lib/libnls12.a(lxpisac.o): In functionlxpNumOfUc4CollationElem':
lxpisac.c:(.text+0x753): undefined reference to lxuCvtToCtx'
lxpisac.c:(.text+0x91a): undefined reference tolxuComposition'
/u01/home/oracle/product/12.1.0.2/lib/libcore12.a(lrmini.o): In function lrminiu':
lrmini.c:(.text+0x5b6): undefined reference tolxuCvtToCtx'
/u01/home/oracle/product/12.1.0.2/lib/libcore12.a(lrmpu.o): In function lrmpu16to8':
lrmpu.c:(text.unlikely+0x57): undefined reference tolxuStrLen'
/u01/home/oracle/product/12.1.0.2/lib/libcore12.a(lsf.o): In function lsfiniu':
lsf.c:(.text+0x551): undefined reference tolxuCvtToCtx'
/u01/home/oracle/product/12.1.0.2/lib/libcore12.a(lsfu.o): In function lsfu16to8':
lsfu.c:(text.unlikely+0x65): undefined reference tolxuStrLen'
/u01/home/oracle/product/12.1.0.2/lib/libcore12.a(lrmckv.o): In function lrmckv':
lrmckv.c:(.text+0x54f): undefined reference tolxuCmpBinStr'
/u01/home/oracle/product/12.1.0.2/lib/libcore12.a(lrmpatk.o): In function lrmpatk':
lrmpatk.c:(text.unlikely+0x2f1): undefined reference tolxuCmpBinStr'
/u01/home/oracle/product/12.1.0.2/lib/libcore12.a(lrmcvv.o): In function lrmcvv':
lrmcvv.c:(.text+0x219): undefined reference tolxuCmpBinStr'

Thanks I have used nm command for all the symbols on all Oracle libraries and included them in link line. After trying some permutations and combinations it got linked

Related

glfw linking by cmake undefined reference error

I tried to link staticly glfw lib but it's not working (idk why),so basically when i complie and run the compile throw many error mostly "undefined reference" so it's the linking error I have encounter
here's my cmake code:
cmake_minimum_required(VERSION 3.1)
project(nerd)
add_executable(${PROJECT_NAME} main.cpp)
target_link_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/../external/glfw/include)
target_link_libraries(${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/../external/glfw/lib/libglfw3.a)
and here's my c++ code :
#include "../external/glfw/include/glfw3.h"
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
you can check file structre on my github : https://github.com/Solirous/glfw-help
I tried to read many document,many problem but it doesnt help
trying to link glfw:
and the error is
CMakeFiles\nerd.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x17): undefined reference to `glfwInit'
CMakeFiles\nerd.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x56): undefined reference to `glfwCreateWindow'
CMakeFiles\nerd.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x64): undefined reference to `glfwTerminate'
CMakeFiles\nerd.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x76): undefined reference to `glfwMakeContextCurrent'
CMakeFiles\nerd.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x81): undefined reference to `glfwWindowShouldClose'
CMakeFiles\nerd.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x96): undefined reference to `_imp__glClear#4'
CMakeFiles\nerd.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xa6): undefined reference to `glfwSwapBuffers'
CMakeFiles\nerd.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xab): undefined reference to `glfwPollEvents'
CMakeFiles\nerd.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xb2): undefined reference to `glfwTerminate'
collect2.exe: error: ld returned 1 exit status

Trying to TryParse in c++/clr but OUT is undefined

im trying to use
public: bool^ IsNumeric(Object^ Expression) {
double^ retNum;
bool^ isNum = Double::TryParse(Convert::ToString(Expression), System::Globalization::NumberStyles::Any, System::Globalization::NumberFormatInfo::InvariantInfo, out retNum);
return isNum;
}
but i get a error: identifer OUT is undefined
i have no idea how to use OUT in clr/c++
Thanks
Use "%" instead of out to take a tracking reference.
https://learn.microsoft.com/en-us/cpp/extensions/tracking-reference-operator-cpp-component-extensions?view=vs-2019

Error when declaring a __block variable, "Undefined symbols for architecture x86_64"

Here's a simple program using __block variables:
typedef void (^incrementBlock)(void);
__block int incrementMe = 0;
incrementBlock add_one = ^{
incrementMe++;
};
incrementBlock add_two = ^{
incrementMe++;
incrementMe++;
};
add_one();
add_two();
printf("%d", incrementMe);
When I compile this, I get this error:
Undefined symbols for architecture x86_64: "___objc_personality_v0",
referenced from:
_main in test-b0a9a6.o
Dwarf Exception Unwind Info (__eh_frame) in test-b0a9a6.o ld: symbol(s) not found for architecture x86_64 clang: error: linker
command failed with exit code 1 (use -v to see invocation)
It definitely is a problem with declaring incrementMeas a __block int, when I comment it out it works.
I tried compiling with gcc and it also didn't work.
I got this example more or less straight from a book so it should work.
Is my declaration deprecated? Should I be declaring a mutable block variable differently?
Your code is fine, you just need to make sure to link with the Objective-C runtime library. Add -lobjc to your linker command line and you should be good.

Firebreath MethodConverter.h invalid initialization

Hi I created a firebreath project. I added this methods to the default generated code:
In the application API header file (MYAppAPI.h):
FB_JSAPI_EVENT(bgp, 3, (const FB::variant&, bool, int));
std::string bgp(std::string& val);
In the application API source file (MAppAPI.mm I am using objective-c):
registerMethod("bgp", make_method(this, &MyAppAPI::bgp));
std::string MyAppAPI::bgp(std::string& val){...}
But when I build the code, I am getting this error:
...firebreath/src/ScriptingCore/MethodConverter.h:115: error: invalid initialization of non-const reference of type 'std::string&' from a temporary of type 'std::basic_string, std::allocator >'
Any ideas?
that should read:
std::string MyAppAPI::bgp(const std::string& val){...}
note the const. You can't pass things by reference into a JS function, so it won't let you pass a non-const reference.

Why do static functions eliminate undefined symbols in Xcode?

I am attempting to use I/O kit and have linked to I/O kit properly.
When I use a function in I/O kit and don't call it within a static function, I get the following error Undefined symbols for architecture x86_64.
Here is an example to suppress the error
static void test(void)
{
if (IORegisterForSystemPower(...))
{
}
}
Here is an example that will cause the error.
void test(void)
{
if (IORegisterForSystemPower(...))
{
}
}
Any suggestions as to why this is happening?
EDIT:
Here are the exact error messages:
Undefined symbols for architecture x86_64:
"_IORegisterForSystemPower", referenced from:
_registerNotificaitonUsingIOKit in AppDelegate.o
"_IONotificationPortGetRunLoopSource", referenced from:
_registerNotificaitonUsingIOKit in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Okay I got one scenario when this can happen. If the static function is never called, you won't get that link time error.
For example, I wrote a simple c file with this function, and undef_foobar is not defined:
static int foobar (void)
{
undef_foobar ();
}
Now, if foobar() is called from my main(), I get the error:
Undefined symbols for architecture x86_64:
"_undef_foobar", referenced from:
If the function isn't called at all from within this c file, there are no linker errors.