-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xlib linking error on macOS Catalina [SOLVED (anaconda issue); keeping open to improve CMake reporting, likely related to #416 - CMAKE_PREFIX_PATH] #780
Comments
Heu, obviously, you are doing that on the Git version of today ?! I do not have access to a Catalina but I can compile without such problem on a Mojave, with very similar CMake options. (just I cannot activate OpenMP here but it is not the question !) Concerning X11, on my side, all the X11 aspect (include, lib, ...) is prefixed by
(not sure this is related but do you have xcode around ? I have :
|
Yes, I tested on the most recent master branch. My CMakeCache.txt file shows the same exact paths for X11 as you posted. When I ran For what it's worth, I initially thought my problem was caused by the relocated items issue. Essentially, upon upgrading to Catalina, certain files were relocated to a folder for security reasons. Annoyingly, this breaks XQuartz. Had I known about it, I would have uninstalled XQuartz (using this gist) before upgrading to Catalina and then reinstall XQuartz. Fixing the issue, otherwise, involved booting into recovery mode and deleting the folder that holds the relocated files. Long story short, it seems like XQuartz is working now and the /usr/X11 and /usr/X11R6 simlinks are fixed. Despite that, the same compiler errors remain. |
In order to troubleshoot, I made a bare-bones test program that calls #include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
int main(void)
{
Display* display = XOpenDisplay(NULL);
if (display == NULL)
{
fprintf(stderr,
"%s:%d: failed to open X11 display\n",
__FILE__, __LINE__);
exit(EXIT_FAILURE);
}
XCloseDisplay(display);
return 0;
} I compiled and ran it with: $ clang main.c -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -o test_x11
$ ./test_x11 This successfully opened XQuartz, so it seems like there is no issue with linking to the Xlib library and using some of its functions. |
two tests I would make
Which version of CMake do you use ? A. |
I had already been removing the entire contents of the build directory before each test. I just tried manually providing the X11 paths to Cmake with the flags Here is the very first error that comes up when compiling, for reference.
Could this have anything to do with plplot? I know Xlib is included from plxwd.h, but I don't see anything obviously wrong with my plplot. Is there a recommended way to install plplot in order to work with GDL (ideally with wxWidgets)? I compiled the most recent release of plplot using the CMake command here. |
Just to check whether it is due to recent changes, could you check with an older version ? rc2 or rc1 On my side, I will try to have the same Cmake version on my 10.14.4, and I asked to some colleagues to access to Catalina systems, without answers up to now. |
Thanks for the continued help. I tried both of those versions with the same results. |
Hm, this may come from plplot includes. |
I did try adding that include to that file a couple days ago, but it didn't change anything. I know that the include works on my Mac because of the test program I posted above. I've tried the plplot from homebrew and compiled from source, as well. |
What you can try too is to run the script/minimum_script4gdl.sh because it uses its own plplot |
I ran the script, and it compiled fully. When I went to execute, I got this:
It seems like this issue has already been encountered with #611, but the issue was solved there by changing the FreeBSD ports to use ImageMagick instead of GraphicsMagick. I tried setting |
Great. OK. My point with the script is maybe we can test if something is wrong with the plplot you have before we re-compile it locally. (a way to circumvent the OSX system/mess) Now I would say you should succeed on the GDL git version but linking with the local plplot
|
Right, got distracted ;) ... I used this:
I still got the same errors when compiling. |
Strange ! Do we made such a change ? Last idea for today : trying on 1.0.0rc1 here https://github.com/gnudatalanguage/gdl/releases/tag/v1.0.0-rc.1 |
I tried it, yet still got the same errors. |
Sorry, I'm confused:
If not, then #611 is not solved 🤕 |
Google seem to suggest that such problem exists on OSX when Anaconda is installed (along with custom Xlib.h, custom include paths, etc), do you happen to use it? Does switching off Python support in GDL change anything? (Alain's script has -DPYTHON=OFF) |
Ha, would be great ! |
Oy vey! I can't believe that's what I was. I had come across something mentioning the bad interplay between Anaconda and CMake, but I tried -DPYTHON=OFF, so I thought I had ruled it out. Turns out Anaconda is a nasty little bugger. I had to completely remove it from my path to solve it. I suppose, in order to close this issue, it should be noted in the MacOS/Linux install part of the wiki that Anaconda cannot be on the path at all. |
A note in a wiki/README can easily get outdated and cause more trouble than help. It would be great to make CMake detect and report the situation. After all, it should be a simple X11-hello-world test for availability of XOpenDisplay... |
Well done @slayoo ! It is not the first time we had such a problem, see comments stating at A note, on my system when I manually may switch Anaconda, when I switch it on, then running CMake, I got a serious warning !
I searched around for a way to detect then clean-up the PATH if Conda/MiniConda/AnaConda prepend it in the PATH, but nothing clear. When activated once, Conda sets up several CONDA_ variables, included CONDA_PREFIX, CONDA_SHLVL and CONDA_EXE. When doing :
change the status of CONDA_SHLVL and remove CONDA_PREFIX but CONDA_EXE still exist, and unfortunatlly on my env, the PATH is not clean-up. May I suggested we had at the beginning of _CMake a strong test on that ?
|
I doubt it's a good idea - for many users, Anaconda is the preferred way of obtaining Python. |
I tried but, as long as Anaconda is in the PATH, it did not change the problem (and the warning message I have at the end of CMake). May be we just need to say they have to temporarily removed it in the PATH ? |
OK, so #611 is solved. |
Hm, probably I misunderstood the situation. |
Sorry, my messages were unclear : I think we can survive with Conda prepended in the PATH after the compilation (Conda don't alter LD_LIBRARY_PATH !), but during CMake run, at compilation time, the PATH should not point to Conda libs. first, this is not what we want to compile GDL. |
Still, adding a note in the Wiki is better than nothing and will not harm. We'll remove it when it's not usfeul. |
And what about a big warning at the end of the running of CMake ?? |
I'm wondering if this is not related: #416 If we would append all the include paths on the way in CMakeLists.txt, then the find_package(X11) should fail in @saweiss's case. As of now, since the Python paths are not used by find_package(X11), but are used during compilation, one is not warned by CMake of inability to work with X11, but the compilation fails later on. Right? |
I realize this is not a solution for GDL's CMake routine, but perhaps it would be helpful in the mean time for those using Anaconda to do what I did. I completely uninstalled Anaconda and installed pyenv instead. This is a much more friendly python manager that won't conflict with GDL (or other programs that use Xlib). I can still install any version of Anaconda or Miniconda, but if I need to compile something that may conflict, I can switch the python to a non-Anaconda version with a simple command, and Andaconda would no longer be on my path. So far, this is the most full-featured CMake command that I've been able to run and then compile successfully:
With this configuration, only 5 of the EDIT: $ env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.8.2
$ pyenv global 3.8.2
$ ln -s ~/.pyenv/versions/3.8.2/lib/libpython3.8.dylib ~/.pyenv/versions/3.8.2/lib/libpython.dylib
$ pip install numpy |
@GillesDuvert A propos: what is the current status regarding the need for using pslib in GDL - from earlier exchanges I understood that it is to be completely dropped, right? |
Indeed, as I said, pslib is not really used and certainly not necessary for the simple need it was used. |
@GillesDuvert Please check if this would be OK then: #781 Thanks! |
OK. For me this CMAKE_PREFIX_PATH is not clear at all now. I did not resist to put a large conda warning at the end of CMakeLists.txt in #791. I found it is a good trade off and may help not to loose time later. Comments welcome. (Please keep in mind I help end-users to compile GDL from scratch. It will help me !) Should we take notes on Conda and pyenv in the Wiki ? |
Let me close this one, and open a new issue on the CMAKE_PREFIX_PATH: #794 Re Wiki: if it's already in the CmakeLists.txt, I guess it's enough? ... but I don't have a clear vision what kind of contents in the Wiki would be useful. |
I already mentioned something in the wiki (Known Issues) |
I am using macOS Catalina Version 10.15.4. My cmake command is:
When I run make, I get a bunch of errors on the files "gdlxstream.hpp", "gdlxstream.cpp", and "devicex.hpp". All of the errors are "use of undeclared identifier", and all of the undeclared identifiers seem to be from the X11/Xlib.h header, e.g., "XOpenDisplay". Is this maybe a linking error with X11? The configure script showed that it correctly located the XQuartz header and lib folders, so it's a bit odd to me that it's not finding those identifiers.
Does anyone have an idea why I am getting this error?
The text was updated successfully, but these errors were encountered: