1
votes

I've been trying to compile OpenVDB on window, but I have a type of error that I have not encountered before

Here is the command (generated by cmake and make) which causes an error:

C:\mingw\bin\g++.exe     -shared -o libopenvdb.dll -Wl,--out-implib,libopenvdb.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -Wl,--whole-archive CMakeFiles\openvdb.dir/objects.a -Wl,--no-whole-archive  -LC:\mingw\install C:\mingw\install\lib\Half.lib C:\mingw\install\lib\libzlib.dll -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 
CMakeFiles\openvdb.dir/objects.a(Grid.cc.obj):Grid.cc:(.text$_ZN4halfC2Ef[__ZN4halfC2Ef]+0x70): undefined reference to `half::_eLut'
CMakeFiles\openvdb.dir/objects.a(Grid.cc.obj):Grid.cc:(.text$_ZN4halfC2Ef[__ZN4halfC2Ef]+0xb5): undefined reference to `half::convert(int)'
c:/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.3/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\openvdb.dir/objects.a(Grid.cc.obj): bad reloc address 0xb5 in section `.text$_ZN4halfC2Ef[__ZN4halfC2Ef]'

Undefined reference but Half.lib is being linked.

I ran dumpbin on the lib file to check if the missing items were present and they are indeed there: http://pastebin.com/6JjhGyky

I tried looking at the other stack overflow posts and googled issues with similar description but they do not seem sufficiently relevant to my problem to be of help.

I'm not sure if I've seen the "bad realoc address" error before, which may be the key to my problem, but googling has provided me little understanding of what exactly it means.

Any suggestions to where my problem might lie is appreciated!

1
In the case of half::convert(int), it looks like the symbol is private, not public: Symbol name : ?convert@half@@CAFH@Z (private: static short __cdecl half::convert(int)).jww
That is indeed wierd and also goes for the _eLut variable! Especially wierd considering that both the interface and using file are part of reputable libraries, perhaps I got some versioning mixed up. Do you know if this error could be caused by this? Wouldn't the compiler know that it's an access issue and give a more precise error message?Jacob Jensen
Additionally it is worth noting that Grid.cc doesn't use any "convert" or "_eLut" so could the error be due to it including a header file like Half.h which then references the function and variable and causes the error?Jacob Jensen
I think my issue might be due to using a MSCV library for a mingw project. I didn't realise this was the case at the time.Jacob Jensen

1 Answers

0
votes

I think my issue might be due to using a MSCV library for a mingw project. I didn't realise this was the case