Opened 2 years ago

Closed 2 years ago

#63892 closed defect (fixed)

id3lib: symbol not found in flat namespace '_compress'

Reported by: catap (Kirill A. Korinsky) Owned by: catap (Kirill A. Korinsky)
Priority: Normal Milestone:
Component: ports Version:
Keywords: arm64 Cc:
Port: id3lib

Description

catap@Kirills-mini-m1 /tmp % cat test.c 
#include <id3.h>
#include <stdio.h>


int main (void)
{
 
     FILE *output;
     output=fopen("conftest.id3","w");
     fprintf(output,"ID3LIB_MAJOR=%d\nID3LIB_MINOR=%d\nID3LIB_PATCH=%d\n",ID3LIB_MAJOR_VERSION,ID3LIB_MINOR_VERSION,ID3LIB_PATCH_VERSION);
     fclose(output);
     return 0;
 }
catap@Kirills-mini-m1 /tmp % clang -I/opt/local/include -L/opt/local/lib -l id3 test.c  
catap@Kirills-mini-m1 /tmp % ./a.out 
dyld[18908]: symbol not found in flat namespace '_compress'
zsh: abort      ./a.out
catap@Kirills-mini-m1 /tmp % 

Attachments (1)

main.log (101.7 KB) - added by catap (Kirill A. Korinsky) 2 years ago.

Download all attachments as: .zip

Change History (11)

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

Keywords: arm64 added
Summary: id3lib is broken on M1id3lib: symbol not found in flat namespace '_compress'

Note that this release of id3lib is 17 years old, so breakage on new systems is not surprising.

Since upstream has clearly long abandoned this software, and the port has no maintainer, a fix would have to come from a volunteer.

According to this old post, adding -lz to your test.c compile line may help. (It wasn't necessary for me on High Sierra but I didn't test on Big Sur or Monterey nor on Apple Silicon.)

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

Actually the mention of the flat namespace is suspicious. There's no reason to use the flat namespace on Mac OS X 10.3 or later but many old build systems misidentify macOS versions greater than 10.x as needing the flat namespace.

If you rebuild and attach the main.log maybe we'll see why it's choosing the flat namespace for you. Run:

sudo port -ns build id3lib

Then attach the logfile at:

port logfile id3lib
Last edited 2 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:3 Changed 2 years ago by catap (Kirill A. Korinsky)

@ryandesign yes, -lz help. I do not understand why it is linked with iconv but not with z:

catap@Kirills-mini-m1 ~ % otool -L $(port work id3lib)/id3lib-3.8.3/src/.libs/libid3.dylib
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_id3lib/id3lib/work/id3lib-3.8.3/src/.libs/libid3.dylib:
	/opt/local/lib/libid3-3.8.3.dylib (compatibility version 4.0.0, current version 4.0.0)
	/opt/local/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)
catap@Kirills-mini-m1 ~ % 

I also attached required log.

Changed 2 years ago by catap (Kirill A. Korinsky)

Attachment: main.log added

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

Replying to catap:

I do not understand why it is linked with iconv but not with z

Same on my system—libid3.dylib does not link with libz.dylib but the programs in bin/ do—so that doesn't explain the problem.

I see that id3lib includes a bundled copy of zlib that gets used if it can't find a system one. (This shouldn't occur in MacPorts; we should always use MacPorts zlib.) Since id3lib seems to require zlib functionality, it sure seems like libid3.dylib should link with libz.dylib; I'm not sure why it doesn't.

comment:5 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

The problem was reported to the developers in 2001: https://sourceforge.net/p/id3lib/bugs/41/ It was supposed to have been resolved by "the release of next monday" (after 2002-07-07)—not sure what release that was since the oldest one on SourceForge now is 3.8.1 from 2002-11-03—but there is a possibly similar report from 2003: https://sourceforge.net/p/id3lib/feature-requests/13/

comment:6 Changed 2 years ago by catap (Kirill A. Korinsky)

@ryandesign yes, I'm converting csv repository to git to try to understand why it is happened.

Anyway, I'll open a PR to fix it soon.

Thanks for pointing that it may requires libz. I was very confused by flat namespace '_compress'

comment:7 in reply to:  6 ; Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to catap:

@ryandesign yes, I'm converting csv repository to git to try to understand why it is happened.

I was trying to do that too! Maybe you could publish your conversion on GitHub?

Anyway, I'll open a PR to fix it soon.

The fix you propose in https://github.com/macports/macports-ports/pull/12881 looks weird. I mean you're setting zlib_include, which is supposed to specify an include path, to -lz, which a link flag.

comment:8 in reply to:  7 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to ryandesign:

I was trying to do that too! Maybe you could publish your conversion on GitHub?

Here's mine so far: https://github.com/ryandesign/id3lib

The fix you propose in https://github.com/macports/macports-ports/pull/12881 looks weird. I mean you're setting zlib_include, which is supposed to specify an include path, to -lz, which a link flag.

Thanks for changing it; it looks good now.

comment:9 in reply to:  7 Changed 2 years ago by catap (Kirill A. Korinsky)

Replying to ryandesign:

Replying to catap:

@ryandesign yes, I'm converting csv repository to git to try to understand why it is happened.

I was trying to do that too! Maybe you could publish your conversion on GitHub?

I will as soon as I finish it. It requires some time and I need a rest ;)

Anyway, I'll open a PR to fix it soon.

The fix you propose in https://github.com/macports/macports-ports/pull/12881 looks weird. I mean you're setting zlib_include, which is supposed to specify an include path, to -lz, which a link flag.

Yep, it was very wrong way. I’ve fixed as soon as I realized that I’ve pushed.

comment:10 Changed 2 years ago by catap (Kirill A. Korinsky)

Owner: set to catap
Resolution: fixed
Status: newclosed

In 89d9402bb1a321db97a55f547a2276d4080f7b12/macports-ports (master):

id3lib: fix linking

Fixes: #63892

Note: See TracTickets for help on using tickets.