Fix El Capitan OSX 10.11 Compil

This commit is contained in:
Phenom 2016-07-16 23:10:00 +02:00
parent 46dd5be2f2
commit 2db8dbd45f
11 changed files with 502 additions and 448 deletions

View File

@ -1,27 +1,31 @@
##Compilation on MacOS
# Compilation on MacOS
### Qt Installation
## Qt Installation
Install Qt via: [Qt Download](http://www.qt.io/download/)
Use default options.
Add to the PATH environment variable with this temporary solution.
Use default options. And add Qt Script support.
export PATH=/users/$USER/Qt/5.5/clang_64/bin:$PATH
Add to the PATH environment variable by editing your *~/.profile* file.
export PATH="/users/$USER/Qt/5.5/clang_64/bin:$PATH"
Depends on wich version of Qt you use.
## ***Choose if you use MacPort or HomeBrew***
### MacPort Installation
Install MacPort and XCode following this guide: [MacPort and XCode](http://guide.macports.org/#installing.xcode)
Start XCode to get it updated and to able C compiler to create executables.
###Install libraries
#### Install libraries
$sudo port -v selfupdate
$sudo port install openssl
$sudo port install miniupnpc
$sudo port install libmicrohttpd
For VOIP Plugin:
@ -30,36 +34,50 @@ For VOIP Plugin:
Get Your OSX SDK if missing: [MacOSX-SDKs](https://github.com/phracker/MacOSX-SDKs)
###Last Settings
### HOMEBREW Installation
In QtCreator Option Git add its path:
Install HomeBrew following this guide: [HomeBrew](http://brew.sh/)
C:\Program Files\Git\bin
Install XCode command line developer tools:
and select "Pull" with "Rebase"
$xcode-select --install
###Compil missing libraries
####SQLCipher
Start XCode to get it updated and to able C compiler to create executables.
#### Install libraries
$brew install openssl
$brew install miniupnpc
$brew install libmicrohttpd
If you have error in linking, run this:
$sudo chown -R $(whoami) /usr/local/lib/pkgconfig
For VOIP Plugin:
$brew install speex
$brew install homebrew/science/opencv
$brew install ffmpeg
Get Your OSX SDK if missing: [MacOSX-SDKs](https://github.com/phracker/MacOSX-SDKs)
## Last Settings
In QtCreator Option Git select "Pull" with "Rebase"
## Compil missing libraries
### SQLCipher
cd <your development directory>
git clone https://github.com/sqlcipher/sqlcipher.git
cd sqlcipher
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
./configure --disable-shared --disable-tcl --enable-static --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -I/opt/local/include" LDFLAGS="-lcrypto"
make
sudo make install
NOTE, might be necessary to *chmod 000 /usr/local/ssl* temporarily during *./configure* if
homebrew uses newer, non-stock ssl dependencies found there. configure might get confused.
####libMicroHTTPD
The one with port don't have good support.
cd <your development directory>
wget http://ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-0.9.46.tar.gz
tar zxvf libmicrohttpd-0.9.46.tar.gz
cd libmicrohttpd-0.9.46
bash ./configure
sudo make install
homebrew uses newer, non-stock ssl dependencies found there. Configure might get confused.
You can now compile RS into Qt Creator or with terminal
@ -68,4 +86,6 @@ You can now compile RS into Qt Creator or with terminal
cd retroshare
qmake; make
You can change Target and SDK in *./retroshare.pri:82* changing value of QMAKE_MACOSX_DEPLOYMENT_TARGET and QMAKE_MAC_SDK
You can find compiled application on *./retroshare/retroshare-gui/src/RetroShare06.app*

View File

@ -113,7 +113,8 @@ libresapihttpserver {
} else {
mac {
INCLUDEPATH += . $$INC_DIR
for(lib, LIB_DIR):exists($$lib/libmicrohttpd.a){ LIBS *= $$lib/libmicrohttpd.a}
#for(lib, LIB_DIR):exists($$lib/libmicrohttpd.a){ LIBS *= $$lib/libmicrohttpd.a}
LIBS *= -lmicrohttpd
} else {
LIBS *= -lmicrohttpd
}

View File

@ -295,7 +295,7 @@ mac {
OBJECTS_DIR = temp/obj
MOC_DIR = temp/moc
#DEFINES = WINDOWS_SYS WIN32 STATICLIB MINGW
DEFINES *= MINIUPNPC_VERSION=13
#DEFINES *= MINIUPNPC_VERSION=13
CONFIG += upnp_miniupnpc
CONFIG += c++11
@ -315,6 +315,7 @@ mac {
DEPENDPATH += . $$INC_DIR
INCLUDEPATH += . $$INC_DIR
INCLUDEPATH += ../../../.
# We need a explicit path here, to force using the home version of sqlite3 that really encrypts the database.
LIBS += /usr/local/lib/libsqlcipher.a

View File

@ -30,7 +30,17 @@
#include <iostream>
#include <time.h>
#ifdef __APPLE__
int __attribute__((weak)) pthread_setname_np(const char *__buf) ;
int RS_pthread_setname_np(pthread_t /*__target_thread*/, const char *__buf) {
return pthread_setname_np(__buf);
}
#else
int __attribute__((weak)) pthread_setname_np(pthread_t __target_thread, const char *__buf) ;
int RS_pthread_setname_np(pthread_t __target_thread, const char *__buf) {
return pthread_setname_np(__target_thread, __buf);
}
#endif
#ifdef RSMUTEX_DEBUG
#include <stdio.h>
@ -167,6 +177,7 @@ void RsThread::start(const std::string &threadName)
// set name
if(pthread_setname_np)
{
if(!threadName.empty())
{
// thread names are restricted to 16 characters including the terminating null byte
@ -175,9 +186,10 @@ void RsThread::start(const std::string &threadName)
#ifdef DEBUG_THREADS
THREAD_DEBUG << "RsThread::start called with to long name '" << name << "' truncating..." << std::endl;
#endif
pthread_setname_np(mTid, threadName.substr(0, 15).c_str());
RS_pthread_setname_np(mTid, threadName.substr(0, 15).c_str());
} else {
pthread_setname_np(mTid, threadName.c_str());
RS_pthread_setname_np(mTid, threadName.c_str());
}
}
}
}

View File

@ -1,11 +1,7 @@
!include("../../retroshare.pri"): error("Could not include file ../../retroshare.pri")
TEMPLATE = lib
macx {
CONFIG = staticlib
} else {
CONFIG += staticlib
}
DEFINES *= OPENSSL_NO_IDEA
@ -13,8 +9,8 @@ QMAKE_CXXFLAGS *= -Wall -Werror -W
TARGET = ops
DESTDIR = lib
DEPENDPATH += .
INCLUDEPATH += .
DEPENDPATH += . $$INC_DIR
INCLUDEPATH += . $$INC_DIR
#################################### Windows #####################################
@ -34,9 +30,13 @@ win32 {
# Switch on optimization for debug version
#QMAKE_CXXFLAGS_DEBUG += -O2
#QMAKE_CFLAGS_DEBUG += -O2
}
DEPENDPATH += $$INC_DIR
INCLUDEPATH += $$INC_DIR
macx {
for(lib, LIB_DIR):LIBS += -L"$$lib"
for(bin, BIN_DIR):LIBS += -L"$$bin"
DEFINES += OPENSSL_NO_CAMELLIA
}
# Input
@ -73,8 +73,10 @@ HEADERS += openpgpsdk/writer.h \
openpgpsdk/armour.h \
openpgpsdk/parse_local.h \
openpgpsdk/keyring_local.h \
openpgpsdk/opsdir.h \
openpgpsdk/opsstring.h
openpgpsdk/opsdir.h
win32{
HEADERS += openpgpsdk/opsstring.h
}
SOURCES += openpgpsdk/accumulate.c \
openpgpsdk/compress.c \
@ -113,5 +115,7 @@ SOURCES += openpgpsdk/accumulate.c \
openpgpsdk/writer_memory.c \
openpgpsdk/writer_skey_checksum.c \
openpgpsdk/writer_stream_encrypt_se_ip.c \
openpgpsdk/opsdir.c \
openpgpsdk/opsstring.c
openpgpsdk/opsdir.c
win32{
SOURCES += openpgpsdk/opsstring.c
}

View File

@ -1,6 +1,7 @@
#include "opsdir.h"
#ifdef WIN32
#include "opsstring.h"
#endif
#include <fcntl.h>
int ops_open(const char* filename, int flag, int pmode)

View File

@ -584,10 +584,13 @@ void GenCertDialog::genPerson()
QCoreApplication::processEvents();
QAbstractEventDispatcher* ed = QAbstractEventDispatcher::instance();
std::cout << "Waiting ed->processEvents()" << std::endl;
time_t waitEnd = time(NULL) + 10;//Wait no more than 10 sec to processEvents
if (ed->hasPendingEvents())
while(ed->processEvents(QEventLoop::AllEvents));
while(ed->processEvents(QEventLoop::AllEvents) && (time(NULL) < waitEnd));
std::string email_str = "" ;
std::cout << "RsAccounts::GeneratePGPCertificate" << std::endl;
RsAccounts::GeneratePGPCertificate(
ui.name_input->text().toUtf8().constData(),
email_str.c_str(),
@ -609,6 +612,7 @@ void GenCertDialog::genPerson()
std::cerr << "GenCertDialog::genPerson() Generating SSL cert with gpg id : " << PGPId << std::endl;
std::string err;
this->hide();//To show dialog asking password PGP Key.
std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl;
bool okGen = RsAccounts::GenerateSSLCertificate(PGPId, "", genLoc, "", isHiddenLoc, sslPasswd, sslId, err);
if (okGen)

View File

@ -234,6 +234,9 @@ macx {
mac_icon.files = $$files($$PWD/rsMacIcon.icns)
mac_icon.path = Contents/Resources
QMAKE_BUNDLE_DATA += mac_icon
mac_webui.files = $$files($$PWD/../../libresapi/src/webui)
mac_webui.path = Contents/Resources
QMAKE_BUNDLE_DATA += mac_webui
CONFIG += version_detail_bash_script
LIBS += -lssl -lcrypto -lz

View File

@ -77,12 +77,12 @@ macx {
LIB_DIR += "/usr/local/lib"
LIB_DIR += "/opt/local/lib"
!QMAKE_MACOSX_DEPLOYMENT_TARGET {
message(***retroshare.pri: No Target, set it to MacOS 10.10 )
QMAKE_MACOSX_DEPLOYMENT_TARGET=10.10
message(***retroshare.pri: No Target. Set it to MacOS 10.11 )
QMAKE_MACOSX_DEPLOYMENT_TARGET=10.11
}
!QMAKE_MAC_SDK {
message(***retroshare.pri: No SDK, set it to MacOS 10.10 )
QMAKE_MAC_SDK = macosx10.10
message(***retroshare.pri: No SDK. Set it to MacOS 10.11 )
QMAKE_MAC_SDK = macosx10.11
}
CONFIG += c++11
}

View File

@ -192,23 +192,30 @@ mac {
CONFIG += upnp_miniupnpc
# zeroconf disabled at the end of libretroshare.pro (but need the code)
CONFIG += zeroconf
CONFIG += zcnatassist
#CONFIG += zeroconf
#CONFIG += zcnatassist
# Beautiful Hack to fix 64bit file access.
QMAKE_CXXFLAGS *= -Dfseeko64=fseeko -Dftello64=ftello -Dfopen64=fopen -Dvstatfs64=vstatfs
UPNPC_DIR = ../../../miniupnpc-1.0
#UPNPC_DIR = ../../../miniupnpc-1.0
#GPG_ERROR_DIR = ../../../../libgpg-error-1.7
#GPGME_DIR = ../../../../gpgme-1.1.8
#OPENPGPSDK_DIR = ../../openpgpsdk/src
#INCLUDEPATH += . $${UPNPC_DIR}
#INCLUDEPATH += $${OPENPGPSDK_DIR}
OPENPGPSDK_DIR = ../../openpgpsdk/src
#for(lib, LIB_DIR):exists($$lib/libminiupnpc.a){ LIBS += $$lib/libminiupnpc.a}
for(lib, LIB_DIR):LIBS += -L"$$lib"
for(bin, BIN_DIR):LIBS += -L"$$bin"
INCLUDEPATH += . $${UPNPC_DIR}
INCLUDEPATH += $${OPENPGPSDK_DIR}
DEPENDPATH += . $$INC_DIR
INCLUDEPATH += . $$INC_DIR
INCLUDEPATH += ../../../.
#../openpgpsdk
#INCLUDEPATH += . $${UPNPC_DIR} $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
# We need a explicit path here, to force using the home version of sqlite3 that really encrypts the database.
LIBS += /usr/local/lib/libsqlcipher.a
#LIBS += -lsqlite3
}
################################# FreeBSD ##########################################

View File

@ -172,8 +172,8 @@ win32 {
macx {
# ENABLE THIS OPTION FOR Univeral Binary BUILD.
CONFIG += ppc x86
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4
#CONFIG += ppc x86
#QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4
CONFIG += version_detail_bash_script
LIBS += ../../libretroshare/src/lib/libretroshare.a
@ -181,24 +181,25 @@ macx {
LIBS += ../../openpgpsdk/src/lib/libops.a -lbz2
LIBS += -lssl -lcrypto -lz
#LIBS += -lssl -lcrypto -lz -lgpgme -lgpg-error -lassuan
LIBS += ../../../miniupnpc-1.0/libminiupnpc.a
for(lib, LIB_DIR):exists($$lib/libminiupnpc.a){ LIBS += $$lib/libminiupnpc.a}
LIBS += -framework CoreFoundation
LIBS += -framework Security
gxs {
LIBS += ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
LIBS += ../../../lib/libsqlcipher.a
for(lib, LIB_DIR):LIBS += -L"$$lib"
for(bin, BIN_DIR):LIBS += -L"$$bin"
DEPENDPATH += . $$INC_DIR
INCLUDEPATH += . $$INC_DIR
#LIBS += ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
# We need a explicit path here, to force using the home version of sqlite3 that really encrypts the database.
LIBS += /usr/local/lib/libsqlcipher.a
#LIBS += -lsqlite3
}
INCLUDEPATH += .
#DEFINES* = MAC_IDLE # for idle feature
CONFIG -= uitools
}
##################################### FreeBSD ######################################