question

Fred Blueroom avatar image
Fred Blueroom asked ·

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

shaders
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Stephen Blair avatar image
Stephen Blair answered ·

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

4 comments
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

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


0 Likes 0 ·

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

Cheers!

0 Likes 0 ·

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

0 Likes 0 ·
Show more comments
Fred Blueroom avatar image
Fred Blueroom answered ·

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


10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Stephen Blair avatar image
Stephen Blair answered ·

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 



1 comment
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

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.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Welcome to the Arnold Answers community.

This is the place for Arnold renderer users everywhere to ask and answer rendering questions, and share knowledge about using Arnold, Arnold plugins, workflows and developing tools with Arnold.

If you are a new user to Arnold Answers, please first check out our FAQ and User Guide for more information.

When posting questions, please be sure to select the appropriate Space for your Arnold plugin and include the plugin version you are using.

Please include images, scene and log files whenever possible as this helps the community answer your questions.

Instructions for generating full verbosity log files are available for MtoA, MaxtoA, C4DtoA, HtoA, KtoA, and Kick.

If you are looking for Arnold Documentation and Support please visit the Arnold Support site.

To try Arnold please visit the Arnold Trial page.

Bottom No panel present for this section.