Community
Arnold General Rendering Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Undefined reference to `CameraReverseRay shader Error - Arnold v6 shader

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
Fred_Blueroom
495 Views, 8 Replies

Undefined reference to `CameraReverseRay shader Error - Arnold v6 shader

Hello Everyone!


I'm trying to compile a Camera shader for Arnold v6 on Linux and have cleared all the compile errors from the old v4 code (I think) that I picked up!

Now I'm getting this link error that I don't understand,


In file included from /software/apps/arnold/6.1.0.1/cent7.x86_64/include/ai.h:33:0,
                 from fCameraShader.cpp:1:
/software/apps/arnold/6.1.0.1/cent7.x86_64/include/ai_cameras.h:115:13: warning: ‘bool CameraReverseRay(const AtNode*, const AtVector&, float, AtVector2&)’ used but never defined [enabled by default]
 static bool CameraReverseRay(const AtNode* node, const AtVector &Po, float relative_time, AtVector2 &Ps)
             ^
/software/apps/arnold/6.1.0.1/cent7.x86_64/include/ai_cameras.h:59:1: note: in expansion of macro ‘camera_reverse_ray’
 camera_reverse_ray;                          \
 ^
fCameraShader.cpp:10:1: note: in expansion of macro ‘AI_CAMERA_NODE_EXPORT_METHODS’
 AI_CAMERA_NODE_EXPORT_METHODS(VRCameraMethods);
 ^
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/tmp/ccDdbLFd.o:(.data+0x38): undefined reference to `CameraReverseRay(AtNode const*, AtVector const&, float, AtVector2&)'
collect2: error: ld returned 1 exit status
make: *** [target] Error 1


Iv'e only managed to find mentions of 'CameraReverseRay' in ai_cameras.h which is part of the defines.


My build command so far looks like this,

    gcc -std=c++11 -I$(ARNOLD_PATH)/include -L$(ARNOLD_PATH)/bin -L./ -lm -lai -loptix -lAdClmHub -lAdskLicensingSDK -lAdpSDKWrapper-arnold -dynamiclib fCameraShader.cpp -o fCameraShader.so


Here's the full shader source, https://pastebin.com/hD3CNZTz


Does anyone know how to resolve this?


Cheers

Fred

Tags (1)
Labels (1)
8 REPLIES 8
Message 2 of 9

I don't have an answer for the link error, but I don't think you need this stuff for a shader:

-loptix -lAdClmHub -lAdskLicensingSDK -lAdpSDKWrapper-arnold 





// Stephen Blair
// Arnold Renderer Support
Message 3 of 9

Ok, thanks! I got link errors saying I needed them but maybe there's something triggering that that is not needed now. The code I believe was written for V4 and maybe that's changed things.

Message 4 of 9

Do you have camera_create_ray() in fCameraShader.cpp ?

If not, if you put in something, like the one from this example, do you still get the same link errors?
https://docs.arnoldrenderer.com/x/TwAnAg



// Stephen Blair
// Arnold Renderer Support
Message 5 of 9

Thanks for that link.
I tried to compile that instead. First by removing the extra libs you pointed to but I then got pages of errors. Then I tried with and I didn't get the CameraReverseRay error.
But I did get a link error,

/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [test] Error 1


Message 6 of 9

Sorry my comment replies are getting removed by the system somehow.

Testing like this instead.

Thanks for the small camera example I tried to compile that instead and then I didn't get the CameraReverseRay error. One difference I see is that your example has both 'camera_create_ray' and 'camera_reverse_ray', whilst the code im using only has the 'camera_create_ray'. Maybe it needs something for the reverse ray too?

But unfortunately I still get a build error with the example code,

/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [test] Error 1


Message 7 of 9

Awesome thanks for your help. I'll study that example and see what I'm doing different.

Cheers!

Message 8 of 9
thiago.ize
in reply to: Fred_Blueroom

https://docs.arnoldrenderer.com/display/A5ARP/Creating+a+Simple+Plugin has instructions for how to build. Note the suggestion of -shared.

Message 9 of 9
Fred_Blueroom
in reply to: thiago.ize

Thanks a lot that helped me!
I had to also add '-fpic'

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums