Opened 8 years ago

Closed 7 years ago

#50713 closed defect (fixed)

unRAR 5.2.7 does nor build on Mac OS X 10.6.8, Snow Leopard, because "‘mprintf’ was not declared in this scope"

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: krischik@…
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: snowleopard Cc:
Port: unrar

Description

/usr/bin/llvm-g++-4.2  -Os -DSILENT -DGUI -fPIC -arch x86_64  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP -DRARDLL -c rijndael.cpp
consio.cpp: In function ‘void OutComment(const wchar*, size_t)’:
consio.cpp:328: error: ‘mprintf’ was not declared in this scope
consio.cpp:330: error: ‘mprintf’ was not declared in this scope
make: *** [consio.o] Error 1
make: *** Waiting for unfinished jobs....
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_archivers_unrar/libunrar/work/unrar'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_archivers_unrar/libunrar/work/unrar" && /usr/bin/make -j8 -w lib -f makefile CXX="/usr/bin/llvm-g++-4.2" DESTDIR=/opt/local CXXFLAGS="-Os -DSILENT -DGUI -fPIC -arch x86_64 " LDFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 " 
Exit code: 2
Error: org.macports.build for port libunrar returned: command execution failed
DEBUG: Error code: CHILDSTATUS 54538 2
DEBUG: Backtrace: command execution failed

I'm not that proficient in C++ but I think the cause is that consio.hpp is not included. This C++ header file has:

#ifdef SILENT
  inline void mprintf(const wchar *fmt,...) {}
  inline void eprintf(const wchar *fmt,...) {}
  inline void Alarm() {}
  inline int Ask(const wchar *AskStr) {return 0;}
  inline bool getwstr(wchar *str,size_t n) {return false;}
#else
  void mprintf(const wchar *fmt,...);
  void eprintf(const wchar *fmt,...);
  void Alarm();
  int Ask(const wchar *AskStr);
  bool getwstr(wchar *str,size_t n);
#endif

Attachments (8)

main.log (15.2 KB) - added by ballapete (Peter "Pete" Dyballa) 8 years ago.
main.log
patch-consio.cpp.diff (264 bytes) - added by ballapete (Peter "Pete" Dyballa) 8 years ago.
patch-volume.cpp.diff (259 bytes) - added by ballapete (Peter "Pete" Dyballa) 8 years ago.
patch-cmddata.cpp.diff (201 bytes) - added by ballapete (Peter "Pete" Dyballa) 8 years ago.
patch-list.cpp.diff (317 bytes) - added by ballapete (Peter "Pete" Dyballa) 8 years ago.
patch-recvol3.cpp.diff (297 bytes) - added by ballapete (Peter "Pete" Dyballa) 8 years ago.
patch-recvol5.cpp.diff (240 bytes) - added by ballapete (Peter "Pete" Dyballa) 8 years ago.
patch-Portfile.diff (574 bytes) - added by ballapete (Peter "Pete" Dyballa) 8 years ago.

Download all attachments as: .zip

Change History (11)

Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

main.log

comment:1 Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

After applying the suggested patch compilation stops again here:

/usr/bin/llvm-g++-4.2  -Os -DSILENT -DGUI -fPIC -arch x86_64  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP -DRARDLL -c unpack.cpp
volume.cpp: In function ‘bool MergeArchive(Archive&, ComprDataIO*, bool, wchar)’:
volume.cpp:123: error: ‘mprintf’ was not declared in this scope
make: *** [volume.o] Error 1
make: *** Waiting for unfinished jobs....
list.cpp: In function ‘void ListArchive(CommandData*)’:
list.cpp:41: error: ‘mprintf’ was not declared in this scope
list.cpp:84: error: ‘mprintf’ was not declared in this scope
list.cpp:127: error: ‘mprintf’ was not declared in this scope
list.cpp:134: error: ‘mprintf’ was not declared in this scope
list.cpp:141: error: ‘mprintf’ was not declared in this scope
list.cpp:144: error: ‘mprintf’ was not declared in this scope
list.cpp:162: error: ‘mprintf’ was not declared in this scope
list.cpp:180: error: ‘mprintf’ was not declared in this scope
list.cpp:182: error: ‘mprintf’ was not declared in this scope
list.cpp: In function ‘void ListFileHeader(Archive&, FileHeader&, bool&, bool, bool, bool)’:
list.cpp:199: error: ‘mprintf’ was not declared in this scope
list.cpp:207: error: ‘mprintf’ was not declared in this scope
list.cpp:212: error: ‘mprintf’ was not declared in this scope
list.cpp:249: error: ‘mprintf’ was not declared in this scope
list.cpp:388: error: ‘mprintf’ was not declared in this scope
make: *** [list.o] Error 1
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_archivers_unrar/libunrar/work/unrar'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_archivers_unrar/libunrar/work/unrar" && /usr/bin/make -j8 -w lib -f makefile CXX="/usr/bin/llvm-g++-4.2" DESTDIR=/opt/local CXXFLAGS="-Os -DSILENT -DGUI -fPIC -arch x86_64 " LDFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 " 
Exit code: 2
Error: org.macports.build for port libunrar returned: command execution failed

After patching these errors come up:

/usr/bin/llvm-g++-4.2  -Os -DSILENT -DGUI -fPIC -arch x86_64  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP -DRARDLL -c filestr.cpp
cmddata.cpp: In member function ‘void CommandData::ProcessSwitch(const wchar*)’:
cmddata.cpp:410: error: ‘eprintf’ was not declared in this scope
cmddata.cpp:643: error: ‘eprintf’ was not declared in this scope
cmddata.cpp: In member function ‘void CommandData::BadSwitch(const wchar*)’:
cmddata.cpp:900: error: ‘mprintf’ was not declared in this scope
list.cpp: In function ‘void ListArchive(CommandData*)’:
list.cpp:41: error: ‘mprintf’ was not declared in this scope
/usr/bin/llvm-g++-4.2  -Os -DSILENT -DGUI -fPIC -arch x86_64  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP -DRARDLL -c recvol.cpp
list.cpp:84: error: ‘mprintf’ was not declared in this scope
list.cpp:127: error: ‘mprintf’ was not declared in this scope
list.cpp:134: error: ‘mprintf’ was not declared in this scope
list.cpp:141: error: ‘mprintf’ was not declared in this scope
list.cpp:144: error: ‘mprintf’ was not declared in this scope
list.cpp:162: error: ‘mprintf’ was not declared in this scope
list.cpp:180: error: ‘mprintf’ was not declared in this scope
list.cpp:182: error: ‘mprintf’ was not declared in this scope
list.cpp: In function ‘void ListFileHeader(Archive&, FileHeader&, bool&, bool, bool, bool)’:
list.cpp:199: error: ‘mprintf’ was not declared in this scope
list.cpp:207: error: ‘mprintf’ was not declared in this scope
list.cpp:212: error: ‘mprintf’ was not declared in this scope
list.cpp:249: error: ‘mprintf’ was not declared in this scope
list.cpp:388: error: ‘mprintf’ was not declared in this scope
make: *** [cmddata.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [list.o] Error 1
In file included from recvol.cpp:3:
recvol3.cpp: In member function ‘bool RecVolumes3::Restore(RAROptions*, const wchar*, bool)’:
recvol3.cpp:379: error: ‘LastPercent’ was not declared in this scope
In file included from recvol.cpp:4:
recvol5.cpp: In member function ‘bool RecVolumes5::Restore(RAROptions*, const wchar*, bool)’:
recvol5.cpp:390: error: ‘LastPercent’ was not declared in this scope
make: *** [recvol.o] Error 1
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_archivers_unrar/libunrar/work/unrar'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_archivers_unrar/libunrar/work/unrar" && /usr/bin/make -j8 -w lib -f makefile CXX="/usr/bin/llvm-g++-4.2" DESTDIR=/opt/local CXXFLAGS="-Os -DSILENT -DGUI -fPIC -arch x86_64 " LDFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 " 
Exit code: 2
Error: org.macports.build for port libunrar returned: command execution failed

The function eprintf is also #define'd in consio.hpp, so let's try the same patch! Which leads to:

/usr/bin/llvm-g++-4.2  -Os -DSILENT -DGUI -fPIC -arch x86_64  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP -DRARDLL -c rs.cpp
In file included from recvol.cpp:3:
recvol3.cpp: In member function ‘bool RecVolumes3::Restore(RAROptions*, const wchar*, bool)’:
recvol3.cpp:379: error: ‘LastPercent’ was not declared in this scope
In file included from recvol.cpp:4:
recvol5.cpp: In member function ‘bool RecVolumes5::Restore(RAROptions*, const wchar*, bool)’:
recvol5.cpp:390: error: ‘LastPercent’ was not declared in this scope
/usr/bin/llvm-g++-4.2  -Os -DSILENT -DGUI -fPIC -arch x86_64  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP -DRARDLL -c scantree.cpp
make: *** [recvol.o] Error 1

rdwrfn.hpp seems to have its declaration. The same patch seems to be needed for this:

usr/bin/llvm-g++-4.2  -Os -DSILENT -DGUI -fPIC -arch x86_64  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP -DRARDLL -c qopen.cpp
In file included from recvol.cpp:3:
recvol3.cpp: In member function ‘bool RecVolumes3::Restore(RAROptions*, const wchar*, bool)’:
recvol3.cpp:379: error: ‘LastPercent’ was not declared in this scope
In file included from recvol.cpp:4:
recvol5.cpp: In member function ‘bool RecVolumes5::Restore(RAROptions*, const wchar*, bool)’:
recvol5.cpp:391: error: ‘LastPercent’ was not declared in this scope
make: *** [recvol.o] Error 1

but it fails, because the actual cause are these lines:

  343  #ifndef GUI
  344	     int LastPercent=-1;
  345	     mprintf(L"     ");
  346	  #endif

and the compile command with CXXFLAGS="-Os -DSILENT -DGUI -fPIC -arch x86_64". So we need to put the line

  344	     int LastPercent=-1;

outside of the #ifndef GUI clause? Well, I tried that, and unRAR compiled. I only do not know whether this is correct…

All patch files, including that for Portfile will be attached!

Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: patch-consio.cpp.diff added

Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: patch-volume.cpp.diff added

Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: patch-cmddata.cpp.diff added

Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: patch-list.cpp.diff added

Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: patch-recvol3.cpp.diff added

Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: patch-recvol5.cpp.diff added

Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: patch-Portfile.diff added

comment:2 Changed 8 years ago by mf2k (Frank Schima)

Cc: krischik@… removed
Keywords: snowleopard added
Owner: changed from macports-tickets@… to krischik@…

comment:3 Changed 7 years ago by l2dy (Zero King)

Resolution: fixed
Status: newclosed

In 793242fb/macports-ports:

unrar: update to 5.4.5

Fixes: #48194
Fixes: #48417
Fixes: #50713

Note: See TracTickets for help on using tickets.