pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/49360: p7zip doesn't work on MacOSX



>Number:         49360
>Category:       pkg
>Synopsis:       p7zip doesn't work on MacOSX
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 04 20:50:00 +0000 2014
>Originator:     Jonathan Buschmann
>Release:        
>Organization:
>Environment:
>Description:
On OSX the current configuration/compilation of p7zip doesn't work.
Because it tries to load a library using the 'bundle' format and as it's a 'dylib' format it fails in NSCreateObjectFileImageFromFile with error NSObjectFileImageInappropriateFile

Attached is a patch to use the traditionnal / more UNIX/POSIX compliant way to load dynamic library by using dlopen()

Another fix would have been to use one of makefile.macosx as makefile.machine file

Also it may be missing a -DENV_MACOSX but that doesn't seem to bother my system at this point.



>How-To-Repeat:

>Fix:
See pach here : https://gist.github.com/jonthn/b793efacfbc4b3980099


--- CPP/Windows/DLL.cpp
+++ CPP/Windows/DLL.cpp
@@ -2,7 +2,7 @@
 
 #include "StdAfx.h"
 
-#ifdef __APPLE_CC__
+#if defined(USE_APPLE_BUNDLE)
 #include <mach-o/dyld.h>
 #elif ENV_BEOS
 #include <kernel/image.h>
@@ -39,7 +39,7 @@ TRACEN((printf("CLibrary::Free(%p)\n",(void *)_module)))
   if (_module == 0)
     return true;
 
-#ifdef __APPLE_CC__
+#if defined(USE_APPLE_BUNDLE)
   int ret = NSUnLinkModule ((NSModule)_module, 0);
 #elif ENV_BEOS
   int ret = unload_add_on((image_id)_module);
@@ -57,7 +57,7 @@ static FARPROC local_GetProcAddress(HMODULE module,LPCSTR lpProcName)
   void *ptr = 0;
   TRACEN((printf("local_GetProcAddress(%p,%s)\n",(void *)module,lpProcName)))
   if (module) {
-#ifdef __APPLE_CC__
+#if defined(USE_APPLE_BUNDLE)
     char name[MAX_PATHNAME_LEN];
     snprintf(name,sizeof(name),"_%s",lpProcName);
     name[sizeof(name)-1] = 0;
@@ -115,7 +115,7 @@ bool CLibrary::Load(LPCTSTR lpLibFileName)
 
   TRACEN((printf("CLibrary::Load(%ls) => %s\n",lpLibFileName,name)))
 
-#ifdef __APPLE_CC__
+#if defined(USE_APPLE_BUNDLE)
   NSObjectFileImage image;
   NSObjectFileImageReturnCode nsret;
 
@@ -173,7 +173,7 @@ TRACEN((printf("load_add_on(%s)=%d\n",p.Path(),(int)image)))
     if (fctTest) fctTest();
 
   } else {
-#ifdef __APPLE_CC__
+#if defined(USE_APPLE_BUNDLE)
     NSLinkEditErrors c;
     int num_err;
     const char *file,*err;



Home | Main Index | Thread Index | Old Index