BIzzare Gcc vs Clang on Linux Ubuntu 16.04


#1

Hi all,

This may not be possible for anyone to help with but someone more knowledgeable in regards to compilers may be able to point me in the right direction.

I’ve been developing on Linux recently and have been able to compile plugins with both clang 3.8 and gcc 5.3.2.

Both are using libstdc++ due to issues on Ubuntu 16.04 with clang 3.8 and the libc++ available through apt-get. See this link: http://stackoverflow.com/questions/37096062/get-a-basic-c-program-to-compile-using-clang-on-ubuntu-16

Recently though I began a plugin which uses the mlpack machine learning library. The library also requires boost which I installed through apt-get so I have the pre-built binaries for libboost-dev as a result which I assume are built with gcc.

So I then build the mlpack library with gcc which works fine and links to the relevant boost libraries without issue. I then compile my plugin with gcc/g++ and the plugin compiles fine without any issues and links correctly with mlpack.

However, when I then load my plugin in any kind of host I’m informed that the plugin is recognized but failed to load.

But for some reason if I then compile the same plugin with clang (still using the gcc compiled mlpack library) the plugin loads without issues in both the JUCE Plugin Host and Tracktion7.

Does anyone have any ideas as to what might be causing this or if I can dig in with any kind of debugging technique/stack trace. My command line debug skills are limited but slowly improving.

I should probably give this a go on a few more hosts but haven’t got the mac in the office here setup with the relevant dev tools yet.

I’m just trying to build boost manually with clang to see what results this has. I have built manually once with gcc and had the exact same issue.

If anyone could shed some light on this I’d be most grateful. I’m hesitant to carry on blindly with clang less I get obscure errors down the line.

Thanks

Josh


#2

So I cleaned all my builds. Has the same issue and then switched to compile with clang again.

After compiling with clang once I could then change my CXX environment var to g++, call make clean as well as removing myplugin/Builds/LinuxMakeFile/build for good measure.

After compiling once with clang gcc appears to have worked also and the plugin loads in both hosts. I have no idea what caused this but suspect some bizzare mistake on my part. Thanks anyways