Opened 4 years ago

Closed 4 years ago

#60453 closed defect (fixed)

wxMaxima fails to build if a gcc port has been selected

Reported by: dyne2meter Owned by: MSoegtropIMC
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: haspatch Cc: michaellass (Michael Lass)
Port: wxMaxima

Description (last modified by ryandesign (Ryan Carsten Schmidt))

build system 10.11.5

:info:build Undefined symbols for architecture x86_64:
:info:build   "non-virtual thunk to wxRichTextCtrl::AppendText(wxString const&)", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::DoSetValue(wxString const&, int)", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::SelectNone()", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::SetEditable(bool)", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::DoSetMargins(wxPoint const&)", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::SetSelection(long, long)", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::SetInsertionPoint(long)", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::SetInsertionPointEnd()", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::Cut()", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::Copy()", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::Redo()", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::Undo()", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::Paste()", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::Remove(long, long)", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::Replace(long, long, wxString const&)", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::WriteText(wxString const&)", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::DoGetValue() const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::IsEditable() const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::DoGetMargins() const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::GetSelection(long*, long*) const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::GetLastPosition() const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::GetInsertionPoint() const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::GetStringSelection() const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::CanCut() const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::CanCopy() const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::CanRedo() const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::CanUndo() const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::CanPaste() const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::GetRange(long, long) const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxTextCtrl::Cut()", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxTextCtrl::Copy()", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxTextCtrl::Paste()", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxTextCtrlBase::SetHint(wxString const&)", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxGrid::GetSizeAvailableForScrollTarget(wxSize const&)", referenced from:
:info:build       vtable for Variablespane in VariablesPane.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::DoLoadFile(wxString const&, int)", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::DoSaveFile(wxString const&, int)", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::DiscardEdits()", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::ShowPosition(long)", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::SetDefaultStyle(wxTextAttr const&)", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::GetStyle(long, wxTextAttr&)", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::SetStyle(long, long, wxTextAttr const&)", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::MarkDirty()", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxTextCtrlBase::overflow(int)", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::IsModified() const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::GetLineText(long) const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::PositionToXY(long, long*, long*) const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::XYToPosition(long, long) const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::GetLineLength(long) const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::GetNumberOfLines() const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::HitTest(wxPoint const&, long*) const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxRichTextCtrl::HitTest(wxPoint const&, long*, long*) const", referenced from:
:info:build       vtable for XmlInspector in XmlInspector.cpp.o
:info:build   "non-virtual thunk to wxTextCtrl::DiscardEdits()", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxTextCtrl::ShowPosition(long)", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxTextCtrl::SetDefaultStyle(wxTextAttr const&)", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxTextCtrl::GetStyle(long, wxTextAttr&)", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxTextCtrl::SetStyle(long, long, wxTextAttr const&)", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxTextCtrl::MarkDirty()", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxTextCtrl::IsModified() const", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxTextCtrl::GetLineText(long) const", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxTextCtrl::PositionToXY(long, long*, long*) const", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxTextCtrl::XYToPosition(long, long) const", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxTextCtrl::GetLineLength(long) const", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxTextCtrl::GetNumberOfLines() const", referenced from:
:info:build       vtable for BTextCtrl in BTextCtrl.cpp.o
:info:build   "non-virtual thunk to wxGenericListCtrl::GetSizeAvailableForScrollTarget(wxSize const&)", referenced from:
:info:build       vtable for AutocompletePopup in AutocompletePopup.cpp.o
:info:build   "operator<<(std::basic_ostream<char, std::char_traits<char> >&, wxString const&)", referenced from:
:info:build       ErrorRedirector::DoLogRecord(unsigned long, wxString const&, wxLogRecordInfo const&) in ErrorRedirector.cpp.o
:info:build       MyApp::OnInit()     in main.cpp.o
:info:build       wxMaxima::TryToReadDataFromMaxima()      in wxMaxima.cpp.o
:info:build       wxMaxima::ReadStdErr()      in wxMaxima.cpp.o
:info:build ld: symbol(s) not found for architecture x86_64

Attachments (2)

main.log.zip (6.5 KB) - added by dyne2meter 4 years ago.
wxMaxima-build-10.15.4.log (43.4 KB) - added by michaellass (Michael Lass) 4 years ago.
build.log from an up-to-date macOS

Download all attachments as: .zip

Change History (26)

Changed 4 years ago by dyne2meter

Attachment: main.log.zip added

comment:1 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: GitHub: MSoegtropIMC removed
Owner: set to MSoegtropIMC
Status: newassigned

comment:2 Changed 4 years ago by MSoegtropIMC

This looks like a compiler issue. There might be ways to fix this, see e.g.:

https://trac.wxwidgets.org/ticket/15618

which mentions adding "-mmaxosx-version-min=10.5" to the compiler options, but I don't know how much sense it makes to add this to support a 5 years old OS - it might lead to other issues. Maxima is typically used by scientists which tend to have recent HW and even a 5 year old Mac can be updated to a more recent OSX.

If there is really someone out there who desperately wants to use wxMaxima on OSX 10.11.5, please leave me a note and I see what I can do.

To the MacPort Pros: is there a way to add this option conditionally for OSX 10.11? What is the recommendation here?

comment:3 Changed 4 years ago by michaellass (Michael Lass)

I do have the exact same problem on an up-to-date macOS though. I'll attach my build log as well.

Changed 4 years ago by michaellass (Michael Lass)

Attachment: wxMaxima-build-10.15.4.log added

build.log from an up-to-date macOS

comment:4 Changed 4 years ago by michaellass (Michael Lass)

Cc: michaellass added

comment:5 Changed 4 years ago by dyne2meter

Using a bleeding-edge wxMaxima is not critical for me. The latest binaries I can download from sourceforge don't run on my system, either. TBH, that I have managed this long with an obsolete system is by itself gratifying -- my hardware is 12 years old :-D. With Sage(math), maxima runs in a jupyter notebook environment, too, but I like the 1990's feel of wxMaxima for nostalgia's sake.

Last edited 4 years ago by dyne2meter (previous) (diff)

comment:6 Changed 4 years ago by MSoegtropIMC

Intersting, I am also on 10.15.4 and have built it over the last 3 months at least a few 100 times.

What compiler are you using? Xcode, MacPorts gcc, MacPorts clang? Which version? I am using an up to date Xcode.

Would you be able to set up a local port repo to test a patched port file?

comment:7 Changed 4 years ago by mf2k (Frank Schima)

Indeed it built fine for me too on 10.15.4. wxMaxima will be using Xcode clang to build like nearly every port in Macports.

$ port -v installed wxMaxima 
The following ports are currently installed:
  wxMaxima @20.04.0_0 (active) platform='darwin 19' archs='x86_64' date='2020-05-07T12:36:50-0600'

What version of Xcode do you have installed? I have 11.4.1.

comment:8 Changed 4 years ago by michaellass (Michael Lass)

I do have a local repository anyway, so I'd be glad to test possible fixes.

Detailed versions:

macOS 10.15.4 19E287
Xcode 11.4.1 11E503a

From the build log:

:debug:sysinfo SDK 10.15
:debug:sysinfo MACOSX_DEPLOYMENT_TARGET: 10.15
[...]
:debug:configure Preferred compilers: clang macports-clang-9.0 macports-clang-8.0 macports-clang-7.0 macports-clang-6.0 macports-clang-5.0
:debug:configure Using compiler 'Xcode Clang'

This would suggest that clang is used for compilation, preferrably the one provided by XCode. However, later it says:

:info:build -- The CXX compiler identification is GNU 9.3.0

So it is actually building with GCC 9.3. I double-checked what copiler is running during compilation and it's this one:

/opt/local/bin/c++ --version
c++ (MacPorts gcc9 9.3.0_1) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

comment:9 Changed 4 years ago by michaellass (Michael Lass)

The same is visible in dyne2meter's log file, so I guess we have the same issue here.

I hacked the Portfile in a crude way to force use of clang:

--- a/math/wxMaxima/Portfile
+++ b/math/wxMaxima/Portfile
@@ -52,7 +52,7 @@ post-patch {
 
 build {
     system -W ${worksrcpath}       "mkdir ./build"
-    system -W ${worksrcpath}/build "cmake -DwxWidgets_CONFIG_EXECUTABLE:FILEPATH=${wxWidgets.wxconfig} -DUSE_CPPCHECK=YES -DUSE_OPENMP=YES -DCMAKE_CXX_FLAGS=-I${prefix}/include/libomp -DOpenMP_CXX_FLAGS='-Xpreprocessor -fopenmp' -DOpenMP_CXX_LIB_NAMES=libomp -DOpenMP_libomp_LIBRARY=${prefix}/lib/libomp/libomp.dylib .."
+    system -W ${worksrcpath}/build "CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -DwxWidgets_CONFIG_EXECUTABLE:FILEPATH=${wxWidgets.wxconfig} -DUSE_CPPCHECK=YES -DUSE_OPENMP=YES -DCMAKE_CXX_FLAGS=-I${prefix}/include/libomp -DOpenMP_CXX_FLAGS='-Xpreprocessor -fopenmp' -DOpenMP_CXX_LIB_NAMES=libomp -DOpenMP_libomp_LIBRARY=${prefix}/lib/libomp/libomp.dylib .."
     system -W ${worksrcpath}/build "cmake -LA ."
     system -W ${worksrcpath}/build "cmake --build ."
 }

With this, wxMaxima builds and installs fine. But there must be a better solution. The question is: why does cmake choose a different compiler here? And GCC should probably be blacklisted.

comment:10 Changed 4 years ago by MSoegtropIMC

Good - we are making progress!

Is it common that people have only gcc or can we assume that everyone has XCode?

I will look into the cmake logic. Maybe the issue is that only rather old Xcode is listed:

clang macports-clang-9.0 macports-clang-8.0 macports-clang-7.0 macports-clang-6.0 macports-clang-5.0

But since gcc isn't listed at all, it shouldn't choose it. Maybe it looks into the list of preferred compilers, doesn't find any of these and then does some fallback which ends up at gcc.

comment:11 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Michael, I guess you used sudo port select to select MacPorts gcc9 as your compiler. It is a bug that the wxMaxima port is not UsingTheRightCompiler, caused by running commands manually in the build phase rather than using the infrastructure MacPorts has in the cmake portgroups.

comment:12 Changed 4 years ago by michaellass (Michael Lass)

Ryan, that's correct. I configured gcc9 as default for gcc and this seems to include the c++ symlink (not only g++).

As far as I can see, there was an attempt made to use the cmake portgroup but it failed: https://github.com/macports/macports-ports/pull/6920#discussion_r420677626

Last edited 4 years ago by michaellass (Michael Lass) (previous) (diff)

comment:13 Changed 4 years ago by MSoegtropIMC

I am still struggling to understand what is going on. I have:

:debug:configure Preferred compilers: clang macports-clang-9.0 macports-clang-8.0 macports-clang-7.0 macports-clang-6.0 macports-clang-5.0
:debug:configure Using compiler 'Xcode Clang'

:info:build -- The CXX compiler identification is AppleClang 11.0.3.11030032

and

wxmaxima$ which clang
/usr/bin/clang

wxmaxima$ /usr/bin/clang --version
Apple clang version 11.0.3 (clang-1103.0.32.59)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

I would think either this is a bug in MacPorts itself or your /usr/bin/clang is not the Apple Xcode clang.

Can you please check what the two above commands give for you, so that we can exclude the latter?

Another thing which I think is strange that the preferred compilers fo not list Xcode 10 and Xcode 11. Does someone have a good explanation for this?

comment:14 Changed 4 years ago by michaellass (Michael Lass)

I have /opt/local/bin at the front of $PATH, so the output looks a bit different:

 ~ % which clang
/opt/local/bin/clang
 ~ % /opt/local/bin/clang --version
clang version 9.0.1 
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-9.0/bin
 ~ % /usr/bin/clang --version
Apple clang version 11.0.3 (clang-1103.0.32.59)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

But I think this misses the point becuase clang is not our issue here. The important aspect is that I have gcc9 installed via macports and set as default gcc version. I think to reproduce the problem you need to do the following:

  1. port install gcc9
  2. port select --set gcc mp-gcc9
  3. make sure that /opt/local/bin is at the front of your $PATH

I think what is happening then: CMake just chooses c++ from $PATH and this happens to be gcc:

 ~ % which c++
/opt/local/bin/c++
 ~ % /opt/local/bin/c++ --version
c++ (MacPorts gcc9 9.3.0_1) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

It may be questionable to overwrite the default c++, but normally this does not cause issues because macports chooses a suitable compiler (clang macports-clang-9.0 macports-clang-8.0 ...). The problem in the current Portfile is that CMake does not know about that.

comment:15 Changed 4 years ago by dyne2meter

/opt/local/bin/c++ is a symlink

comment:16 Changed 4 years ago by dyne2meter

So... I hacked the symlink and pointed it (temporarily!) at clang++-mp-9.0, and this worked to build wxMaxima. The new version launches normally.

Last edited 4 years ago by dyne2meter (previous) (diff)

comment:17 Changed 4 years ago by willic3 (Charles Williams)

I had the same problem under MacOS 10.14.6 using XCode 11.3.1. After reading this thread I did:

sudo port select --set gcc none

I then rebuilt wxMaxima and ran into the case issue (#60457). I manually changed the name of wxmaxima.app (to wxMaxima.app) and the install finished OK. After finishing the install I then set gcc back to mp-gcc9.

Last edited 4 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:18 Changed 4 years ago by MSoegtropIMC

Thanks for the report. I will look again into using the cmake port group - this should be most reliable and least maintenance effort, but it is a bit of work to get it done. This should fix both issues.

comment:19 Changed 4 years ago by bal-agates

I just encountered the same problem on macOS 10.13.6. My Xcode is 10.1. The fixed reported by willic3

sudo port select --set gcc none

worked for me. Previously I had gcc = mp-gcc9.

comment:20 Changed 4 years ago by tcspestana (Tiago Pestana)

Same for me on macOS 10.12.6. As above, calling sudo port select --set gcc none before building works...

comment:21 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Summary: build failure wxMaximawxMaxima fails to build if a gcc port has been selected

comment:22 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

comment:23 in reply to:  18 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added

Replying to MSoegtropIMC:

I will look again into using the cmake port group

https://github.com/macports/macports-ports/pull/7777

comment:24 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

In cc9b82ef7c786d8383444e35c2f626e2054a2c6f/macports-ports (master):

wxMaxima: Use the cmake portgroup

Closes: #60453

Also, -I flags go in cppflags, not cxxflags.

Note: See TracTickets for help on using tickets.