Menu

#303 dyld[39272]: symbol not found in flat namespace '_yylex'

None
closed-invalid
nobody
None
5
2022-01-30
2022-01-17
No

cscope 15.9 does not run on macOS Monterey. Here's what happens:

$ cscope
dyld[39272]: symbol not found in flat namespace '_yylex'
Abort

This was originally reported to MacPorts here: https://trac.macports.org/ticket/64448

Discussion

  • Hans-Bernhard Broeker

    The fact that building the same source for different versions of the same platform apparently gives a different result is a very strong indication that whatever the actual reason for this is, it has very little or nothing to do with the cscope source code.

    Given that, and the additional limitation that I don't have any personal experience,with, nor access to MacOS machines, I'm afraid you're on your own. I can only offer some rough suggestions:

    • yylex() is part of the scanner generated by whatever you use for LEX (most likely flex). It's supposed to be defined right there in the generated source (f)scanner.c, which is statically linked into the executable. So there's really no sane reason why it would be loaded dynamically. In other words, this error, if it was real, should not occur at runtime, but rather at link time.
    • in the MacPorts ticket they claim this doesn't seem to be a MacPorts issue. I have to disagree with that at least partly. Nobody else reported this problem in the years since 15.9 was released, so while it may not a a MacPorts issue as such, it evidently is a MacOS version specific issue.
    • It's completely unclear to me whether those builds were made using the system's "flex", MacPort's own port of flex, or tried to use the pre-generated scanner sources that are packaged with the tarball. I would advise against the latter, and have no idea what the difference between the two former might be.
     

    Last edit: Hans-Bernhard Broeker 2022-01-17
  • Ryan Carsten Schmidt

    I found that in the MacPorts portfile, we were running strip cscope after compilation, and that removing that fixed the problem.

    I don't know why we were stripping the executable, but we had been doing so ever since cscope was added to MacPorts back in 2003. macOS was a much younger operating system back then and perhaps there was a good reason for stripping things at that time or perhaps it was just a whim of whoever added it.

    I don't know why stipping the executable is now all of a sudden causing a problem in macOS 12. Maybe it represents a bug in the strip tool on macOS 12 (removing symbols it should not remove), or maybe it reveals that there is some problem with the way the yylex symbol is being used in cscope (maybe it is in some way being marked as transient or "strippable" when it should not be). In any case, the problem has been sufficiently worked around for the time being by not stripping.

     
    • Hans-Bernhard Broeker

      If strip can turning a working binary into a broken one then yes, that does mean it's quite thoroughly broken.

       
  • Hans-Bernhard Broeker

    • status: open --> closed-invalid
    • Group: -->
     
  • Ryan Carsten Schmidt

    I've reported it to Apple as feedback id FB9866173.

     

Log in to post a comment.