-
Notifications
You must be signed in to change notification settings - Fork 157
A lot of compiling issues since commit "Reverted submodule for libmsym in favor of straight import." #23
Comments
Are you using GCC? -Geoff |
I see this issues too, I was just taking a look at master. I am using GCC 5.2 - does the library have issues with GCC? Haven't tried other compilers yet. |
Yes, there was a thread. Try this patch: Also: |
I was using GCC 4.6.3 for that compiler output. I had issues when using GCC 4.8.4 as well (although the error output looked a little different). I tried replacing libavogadro/src/extensions/symmetry/libmsym with the new libmsym patch, but unfortunately (for GCC 4.8.4 at least), I got the same errors. Here's what the output looked like for 4.8.4: /home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:50:40: warning: ISO C++ does not allow C99 designated initializers [-Wpedantic] |
Okay. For my computer that uses gcc 4.8.4, I was able to get it working. I sent in a pull request with those changes. Basically, we needed to change the C-style designated initialization of structs to the style that is acceptable in C++ (otherwise the compiler will produce an error). I also updated libmsym with the patch. Unfortunately, I still got an error on my computer that is using gcc 4.6.3. I'll be looking into it to try to fix it. Here's the output I get, though: /usr/bin/ld: libmsym/libmsym.a(msym.c.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC |
That should be solvable by a change to symmetry/CMakeLists.txt diff --git a/libavogadro/src/extensions/symmetry/CMakeLists.txt b/libavogadro/sr add_subdirectory(libmsym) +set_property(TARGET msym PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON) |
The "ISO C++ does not allow C99 designated initializers" errors are not due to msym.h. The shared object error is due to libmsym depending on the BUILD_SHARED_LIBS variable, which is not used during Avogadro v1 building. |
Yes, the msym.h errors were fixed when I added the patch. As for the shared object error, getting libmsym to not depend on BUILD_SHARED_LIBS might be a better fix rather than using the "-fPIC" tag. The "ISO C++ does not allow C99 designated initializers" errors listed above were coming from symmetry/symmetryextension.cpp, though. Basically, what I found is that in a cpp file, you can't use designated initializers for a struct (http://stackoverflow.com/questions/18731707/why-does-c11-not-support-designated-initializer-list-as-c99). It looks like there are other methods to initialize a struct in C++. I put one of them in my pull request. By the way, one of my co-workers was able to compile the latest commit fine on his mac. It appears that this may just be a linux OS issue. But the pull request that I sent in should be good (other than maybe finding an alternative for the "-fPIC" flag). |
Problem is that many projects (including avogadro v2) use BUILD_SHARED_LIBS to decide how to build, so changing that may cause them some trouble. OS X uses clang (gcc/g++ are soft linked to clang as well)... much more forgiving. I can build all versions fine on my mac. |
Okay! Well, that "-fPIC" flag that I added in the pull request seems to work for the linux GCC. I was able to compile it on GCC 4.6, 4.8, and 5.2. I can try compiling it on msvc in the next few days too to see if another flag is needed for that. |
aha, but the above patch should work as well, for any compiler as far as I can see: diff --git a/libavogadro/src/extensions/symmetry/CMakeLists.txt b/libavogadro/sr add_subdirectory(libmsym) +set_property(TARGET msym PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON) |
I tried it. Unfortunately, it didn't seem to work. |
As in, same error output. No changes. |
Hm, try this, it worked with g++ arch linux. instead of this |
That worked! Thanks a ton! I submitted the pull request with that included! |
BUILD_SHARED_LIBS is a very common CMake variable, and if anything we should adapt Avogadro to set that even if it doesn't use it internally. When we wrote that CMake code I don't think we were aware of that variable. Seems like this is working now, sorry - I was largely offline with a sick child (who is feeling much better now) and only just saw all of the replies. |
Don't reset the camera on scene initialization
I'm getting a lot of compiling issues since this update. Here is the compiler output:
In file included from /home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.h:38:0,
from /home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:22:
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/libmsym/src/msym.h:142:88: error: use of parameter ‘length’ outside function body
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/libmsym/src/msym.h:145:70: error: use of parameter ‘l’ outside function body
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/libmsym/src/msym.h:156:75: error: use of parameter ‘l’ outside function body
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/libmsym/src/msym.h:156:78: error: use of parameter ‘l’ outside function body
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/libmsym/src/msym.h:157:93: error: use of parameter ‘length’ outside function body
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/libmsym/src/msym.h:159:76: error: use of parameter ‘l’ outside function body
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/libmsym/src/msym.h:159:79: error: use of parameter ‘l’ outside function body
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:51:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:52:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:53:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:54:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:55:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:56:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:57:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:61:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:62:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:63:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:64:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:65:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:66:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:67:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:71:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:72:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:73:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:74:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:75:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:76:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:77:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:81:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:82:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:83:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:84:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:85:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:86:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:87:5: error: expected primary-expression before ‘.’ token
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp: In member function ‘void Avogadro::SymmetryExtension::detectSymmetry()’:
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:187:17: warning: unused variable ‘error’ [-Wunused-variable]
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:189:12: warning: unused variable ‘cm’ [-Wunused-variable]
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:189:19: warning: unused variable ‘radius’ [-Wunused-variable]
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:189:33: warning: unused variable ‘symerr’ [-Wunused-variable]
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:193:32: warning: unused variable ‘msops’ [-Wunused-variable]
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:194:22: warning: unused variable ‘msg’ [-Wunused-variable]
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:195:9: warning: unused variable ‘msgl’ [-Wunused-variable]
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:195:19: warning: unused variable ‘msopsl’ [-Wunused-variable]
/home/patrick/src/avogadro/libavogadro/src/extensions/symmetry/symmetryextension.cpp:195:31: warning: unused variable ‘mlength’ [-Wunused-variable]
make[2]: *** [libavogadro/src/extensions/symmetry/CMakeFiles/symmetryextension.dir/symmetryextension.cpp.o] Error 1
make[1]: *** [libavogadro/src/extensions/symmetry/CMakeFiles/symmetryextension.dir/all] Error 2
make: *** [all] Error 2
The text was updated successfully, but these errors were encountered: