PDA

View Full Version : library not found for -lnsl - What should I do? (MAC)



rickrvo
7th September 2011, 18:31
Hi,

I'm trying to port a linux application to mac with Qt... And I've read in some forums that libnsl isn't supported on Mac, that it's included on libc. But I've tried to just erase the link -lnsl, and adding -lc, but it always stops at the same compilation line returning lots of undefined symbols but ending with the same single error: collect2: ld returned 1 exit status

any Ideas on how to fix this issue?

I even downloaded fink and apt-get commands to see if I could apt-get install libnsl but it doesn't find that package...


this is what Qt returns when I take -lnsl out:



g++ -headerpad_max_install_names -arch i386 -o uni-classroom.app/Contents/MacOS/uni-classroom release/local_system_ima.o release/kmultitabbar.o release/italc_side_bar.o release/dialogs.o release/config_widget.o release/cmd_input_dialog.o release/client.o release/classroom_manager.o release/tool_button.o release/tool_bar.o release/snapshot_list.o release/side_bar_widget.o release/remote_control_widget.o release/overview_widget.o release/main_window.o release/main.o release/haveupdates.o release/updater.o release/clientworkspace.o release/tree_widget_menu.o release/about_widget.o release/midetector.o release/singleapplication.o release/help.o release/moc_kmultitabbar.o release/moc_italc_side_bar.o release/moc_config_widget.o release/moc_client.o release/moc_tool_button.o release/moc_tool_bar.o release/moc_snapshot_list.o release/moc_remote_control_widget.o release/moc_overview_widget.o release/moc_haveupdates.o release/moc_updater.o release/moc_classroom_manager.o release/moc_tree_widget_menu.o release/moc_main_window.o release/moc_about_widget.o release/moc_dialogs.o release/moc_cmd_input_dialog.o release/moc_midetector.o release/moc_singleapplication.o release/moc_help.o release/qrc_uni-classroom.o -F/Library/Frameworks -L/Library/Frameworks -L../staticlib/ -L../plugins/attendees -L../libjpeg -lz -lc -llibjpeg -lssl -lcrypto -framework Foundation -lpthread -luni_net -lattendees -framework QtXml -framework QtGui -framework QtNetwork -framework QtCore

Undefined symbols:

"localSystem::globalConfigPath()", referenced from:

mainWindow::instantiateClassroomManagerPlugin(QObj ect*) in main_window.o

mainWindow::instantiateClassroomManagerPlugin(QObj ect*) in main_window.o

"isdConnection::stopAttendanceCall()", referenced from:

classroomManager::stopAttendanceCall() in classroom_manager.o

"isdConnection::lockDisplay()", referenced from:

updateThread::update() in client.o

"isdConnection::logonUser(QString const&, QString const&, QString const&)", referenced from:

updateThread::update() in client.o

"localSystem::personalConfigDir()", referenced from:

mainWindow::ensureConfigPathExists() in main_window.o

mainWindow::mainWindow(int)in main_window.o

"___role", referenced from:

___role$non_lazy_ptr in config_widget.o

___role$non_lazy_ptr in classroom_manager.o

___role$non_lazy_ptr in main_window.o

___role$non_lazy_ptr in main.o

(maybe you meant: ___role$non_lazy_ptr)

"isdConnection::isdConnection(QString const&, QObject*)", referenced from:

mainWindow::mainWindow(int)in main_window.o

"isdConnection::attendanceCall(BcAttendees&)", referenced from:

mainWindow::callList(BcAttendees&) in main_window.o

"localSystem::snapshotDir()", referenced from:

snapshotList::reloadList() in snapshot_list.o

snapshotList::snapshotDoubleClicked(QString const&) in snapshot_list.o

snapshotList::deleteSnapshot() in snapshot_list.o

snapshotList::snapshotSelected(QString const&) in snapshot_list.o

"isdConnection::sendGetAttendeesListRequest()", referenced from:

classroomManager::sendGetAttendeesListRequest() in classroom_manager.o

"isdConnection::wakeOtherComputer(QString const&)", referenced from:

client::powerOn() in client.o

"isdConnection::attendanceCallDefProf(BcAttendees&)", referenced from:

mainWindow::callListDefProf(BcAttendees&) in main_window.o

"isdConnection::displayTextMessage(QString const&)", referenced from:

updateThread::update() in client.o

"ivsConnection::ivsConnection(QString const&, ivsConnection::quality, bool, QObject*)", referenced from:

client::client(QString const&, QString const&, QString const&, QString const&, IClient::types, mainWindow*, int)in client.o

"ivsConnection::rescaleScreen()", referenced from:

client::resizeEvent(QResizeEvent*) in client.o

"isdConnection::execCmds(QString const&)", referenced from:

updateThread::update() in client.o

"isdConnection::handleServerMessages()", referenced from:

mainWindowUpdateThread::update() in main_window.o

"vtable for publicDSAKey", referenced from:

__ZTV12publicDSAKey$non_lazy_ptr in main_window.o

(maybe you meant: __ZTV12publicDSAKey$non_lazy_ptr)

"isdConnection::reset(QString const&, int*)", referenced from:

client::userLoggedIn() in client.o

updateThread::update() in client.o

"isdConnection::powerDownComputer()", referenced from:

updateThread::update() in client.o

"isdConnection::logoutUser()", referenced from:

updateThread::update() in client.o

"isdConnection::demoServerAllowClient(QString const&)", referenced from:

client::changeMode(IClient::modes) in client.o

classroomManager::changeMode_AllowClient(QString) in classroom_manager.o

"isdConnection::sendGetUserInformationRequest()", referenced from:

client::reload() in client.o

"isdConnection::demoServerDenyClient(QString const&)", referenced from:

client::changeMode(IClient::modes) in client.o

client::changeMode(IClient::modes) in client.o

classroomManager::changeMode_DenyClient(QString) in classroom_manager.o

"isdConnection::restartComputer()", referenced from:

updateThread::update() in client.o

"isdConnection::sendGetAttendeesDefProfListRequest( )", referenced from:

classroomManager::sendGetAttendeesDefProfListReque st() in classroom_manager.o

"isdConnection::demoServerRun(int, int)", referenced from:

mainWindow::mainWindow(int)in main_window.o

"isdConnection::shutdown()", referenced from:

_main in main.o

"vncView::vncView(QString const&, QWidget*, bool)", referenced from:

remoteControlWidget::remoteControlWidget(QString const&, bool, mainWindow*)in remote_control_widget.o

"isdConnection::unlockDisplay()", referenced from:

updateThread::update() in client.o

"ivsConnection::takeSnapshot()", referenced from:

remoteControlWidget::takeSnapshot() in remote_control_widget.o

"isdConnection::gracefulClose()", referenced from:

mainWindow::~mainWindow()in main_window.o

mainWindow::~mainWindow()in main_window.o

"localSystem::sleep(int)", referenced from:

client::~client()in client.o

client::~client()in client.o

"messageBox::information(QString const&, QString const&, QPixmap const&)", referenced from:

...

loadPersonalConfig() in main.o

"vncView::setViewOnly(bool)", referenced from:

remoteControlWidget::toggleViewOnly(bool) in remote_control_widget.o

"publicDSAKey::load(QString const&, QString)", referenced from:

mainWindow::registerNewLicense() in main_window.o

mainWindow::activatedLicense() in main_window.o

"localSystem::freePort(int)", referenced from:

mainWindow::mainWindow(int)in main_window.o

"ivsConnection::takeSnapshot(QString)", referenced from:

client::paintEvent(QPaintEvent*) in client.o

"localSystem::ensurePathExists(QString const&)", referenced from:

mainWindow::ensureConfigPathExists() in main_window.o

"localSystem::activateWindow(QWidget*)", referenced from:

remoteControlWidget::remoteControlWidget(QString const&, bool, mainWindow*)in remote_control_widget.o

"isdConnection::startDemo(QString const&, bool)", referenced from:

updateThread::update() in client.o

"isdConnection::endStudentAttendance()", referenced from:

updateThread::update() in client.o

"isdConnection::hideTrayIcon()", referenced from:

mainWindow::mainWindow(int)in main_window.o

"ivsConnection::handleServerMessages(bool, int)", referenced from:

client::reload() in client.o

"localSystem::initialize(void (*)(int, bool), QString const&)", referenced from:

localSystem::initialize() in local_system_ima.o

"localSystem::parameter(QString const&)", referenced from:

_main in main.o

_main in main.o

"isdConnection::disableLocalInputs(bool)", referenced from:

remoteControlWidget::lockStudent(bool) in remote_control_widget.o

"localSystem::globalConfigPathLock()", referenced from:

mainWindow::startTrialVersion() in main_window.o

mainWindow::unlockLicenses() in main_window.o

mainWindow::mainWindow(int)in main_window.o

"isdConnection::initAuthentication()", referenced from:

mainWindow::mainWindow(int)in main_window.o

ld: symbol(s) not found

collect2: ld returned 1 exit status

make[1]: *** [uni-classroom.app/Contents/MacOS/uni-classroom] Error 1

make: Leaving directory `/Users/tuareg/Desktop/uni/uni-classroom'

make: *** [release] Error 2

Exited with code 2.

Error while building project uni-classroom

When executing build step 'Make'

wysota
7th September 2011, 18:58
LibNSL is a C library and the errors you get are obviously related to classes. Is "localSystem" your own class? What about "isdConnection"? It seems more that your own classes are missing implementations for a number of methods.

rickrvo
8th September 2011, 10:36
yes, those are my classes.

The strange thing is that I forced mac to run the same code as Linux (where I had defined(Q_OS_LINUX) I added || defined(Q_OS_MAC) ) the same code compiles perfectly on linux but all these errors occurs in MAC... I've already noticed that some system includes don't exist in Mac, and I'm working on removing those parts but everytime I compile the same output is these undefined symbols

wysota
8th September 2011, 10:54
Did you implement the methods the compiler fails on? Show us their code.

rickrvo
8th September 2011, 13:52
I'll post one method since the entire file is too long..


local_system.h

extern IC_DllExport QByteArray __appInternalChallenge;
...
QString IC_DllExport globalConfigPath( void );


local_system.cpp

QString privateKeyPath( const ISD::userRoles _role, bool _only_path )
{
return( keyPath( _role, "private", _only_path ) );
}

isd_connection.h

class isdConnection : public QObject
{
...
bool stopAttendanceCall(void);


isd_connection.cpp

bool isdConnection::stopAttendanceCall( void ) {
if( m_socket == NULL ||
m_socket->state() != QTcpSocket::ConnectedState )
{
m_state = Disconnected;
return( FALSE );
}
return( ISD::msg( &m_socketDev, ISD::StopAttendanceCall ).send() );
}

all methods are implemented... I think it's some kind of linking problem...

I still have some similar errors compiling another .pro (same project) like:


Undefined symbols:
"_BN_rand", referenced from:
dsaKey::generateChallenge() in dsa_key.o
"_BN_copy", referenced from:
publicDSAKey::publicDSAKey(privateDSAKey const&)in dsa_key.o
publicDSAKey::publicDSAKey(privateDSAKey const&)in dsa_key.o
publicDSAKey::publicDSAKey(privateDSAKey const&)in dsa_key.o
publicDSAKey::publicDSAKey(privateDSAKey const&)in dsa_key.o
"_BN_new", referenced from:
createNewDSA() in dsa_key.o
createNewDSA() in dsa_key.o
createNewDSA() in dsa_key.o
createNewDSA() in dsa_key.o
dsaKey::verifySignature(QByteArray const&, QByteArray const&) constin dsa_key.o
dsaKey::verifySignature(QByteArray const&, QByteArray const&) constin dsa_key.o
dsaKey::generateChallenge() in dsa_key.o
"_DSA_do_sign", referenced from:
privateDSAKey::sign(QByteArray const&) constin dsa_key.o
"_EVP_DigestFinal", referenced from:
dsaKey::verifySignature(QByteArray const&, QByteArray const&) constin dsa_key.o
privateDSAKey::sign(QByteArray const&) constin dsa_key.o
"_DSA_free", referenced from:
privateDSAKey::load(QString const&, QString)in dsa_key.o
publicDSAKey::publicDSAKey(privateDSAKey const&)in dsa_key.o
privateDSAKey::privateDSAKey(unsigned int)in dsa_key.o
publicDSAKey::load(QString const&, QString)in dsa_key.o
publicDSAKey::~publicDSAKey()in dsa_key.o
dsaKey::~dsaKey()in dsa_key.o
dsaKey::~dsaKey()in dsa_key.o
privateDSAKey::~privateDSAKey()in dsa_key.o
privateDSAKey::~privateDSAKey()in dsa_key.o
publicDSAKey::~publicDSAKey()in dsa_key.o
isdConnection::initAuthentication() in isd_connection.o
dsaKey::~dsaKey()in isd_connection.o
dsaKey::~dsaKey()in isd_connection.o
"_BN_num_bits", referenced from:
buffer_put_bignum2(Buffer*, bignum_st*) in dsa_key.o
privateDSAKey::sign(QByteArray const&) constin dsa_key.o
privateDSAKey::sign(QByteArray const&) constin dsa_key.o
dsaKey::generateChallenge() in dsa_key.o
"_EVP_des_ede3_cbc", referenced from:
privateDSAKey::save(QString const&, QString) constin dsa_key.o
"_BN_free", referenced from:
dsaKey::generateChallenge() in dsa_key.o
"_EVP_sha1", referenced from:
dsaKey::verifySignature(QByteArray const&, QByteArray const&) constin dsa_key.o
privateDSAKey::sign(QByteArray const&) constin dsa_key.o
"_EVP_PKEY_get1_DSA", referenced from:
privateDSAKey::load(QString const&, QString)in dsa_key.o
"_EVP_DigestUpdate", referenced from:
dsaKey::verifySignature(QByteArray const&, QByteArray const&) constin dsa_key.o
privateDSAKey::sign(QByteArray const&) constin dsa_key.o
"_DSA_SIG_free", referenced from:
dsaKey::verifySignature(QByteArray const&, QByteArray const&) constin dsa_key.o
privateDSAKey::sign(QByteArray const&) constin dsa_key.o
privateDSAKey::sign(QByteArray const&) constin dsa_key.o
"_EVP_DigestInit", referenced from:
dsaKey::verifySignature(QByteArray const&, QByteArray const&) constin dsa_key.o
privateDSAKey::sign(QByteArray const&) constin dsa_key.o
"_BN_bn2bin", referenced from:
buffer_put_bignum2(Buffer*, bignum_st*) in dsa_key.o
privateDSAKey::sign(QByteArray const&) constin dsa_key.o
privateDSAKey::sign(QByteArray const&) constin dsa_key.o
dsaKey::generateChallenge() in dsa_key.o
"_EVP_PKEY_free", referenced from:
privateDSAKey::load(QString const&, QString)in dsa_key.o
"_DSA_do_verify", referenced from:
dsaKey::verifySignature(QByteArray const&, QByteArray const&) constin dsa_key.o
"_BN_bin2bn", referenced from:
buffer_get_bignum2(Buffer*, bignum_st*) in dsa_key.o
dsaKey::verifySignature(QByteArray const&, QByteArray const&) constin dsa_key.o
dsaKey::verifySignature(QByteArray const&, QByteArray const&) constin dsa_key.o
"_DSA_generate_key", referenced from:
privateDSAKey::privateDSAKey(unsigned int)in dsa_key.o
"_PEM_read_PrivateKey", referenced from:
privateDSAKey::load(QString const&, QString)in dsa_key.o
"_DSA_SIG_new", referenced from:
dsaKey::verifySignature(QByteArray const&, QByteArray const&) constin dsa_key.o
"_DSA_generate_parameters", referenced from:
privateDSAKey::privateDSAKey(unsigned int)in dsa_key.o
"_DSA_new", referenced from:
createNewDSA() in dsa_key.o
"_PEM_write_DSAPrivateKey", referenced from:
privateDSAKey::save(QString const&, QString) constin dsa_key.o
ld: symbol(s) not found
collect2: ld returned 1 exit status


This is even more important than the other. Since the first project uses this lib (2nd project) . but this one does not have dependencies and still undefined symbols error appear... I think it's something to do with linking. since the Linux version had -lnsl link to work and Mac doesn't have -lnsl
But it still a strange thing because the 2nd project doesn't have a -lnsl even for linux...

wysota
8th September 2011, 14:38
So let me get this straight. You are building a library of your own or is it an application in its own right? Does the compilation of the library fail or of the application using this library? What is this "uni_net" library?

rickrvo
8th September 2011, 16:38
the 2nd was a library to work with the 1st set of errors which is an application.

but never mind! I've already figured out the error! -lcrypto was missing... thanks anyway!

the library compiled fine but then the main application returned thousands of errors like these...



/System/Library/Frameworks/AppKit.framework/Headers/NSGraphics.h:126: error: declaration for parameter 'NSBlack' but no such parameter
/System/Library/Frameworks/AppKit.framework/Headers/NSGraphics.h:125: error: declaration for parameter 'NSDarkGray' but no such parameter
/System/Library/Frameworks/AppKit.framework/Headers/NSGraphics.h:124: error: declaration for parameter 'NSLightGray' but no such parameter
/System/Library/Frameworks/AppKit.framework/Headers/NSGraphics.h:123: error: declaration for parameter 'NSWhite' but no such parameter
/System/Library/Frameworks/AppKit.framework/Headers/NSGraphics.h:110: error: declaration for parameter 'NSWindowDepth' but no such parameter
/System/Library/Frameworks/AppKit.framework/Headers/NSGraphics.h:76: error: declaration for parameter 'NSColorRenderingIntent' but no such parameter
/System/Library/Frameworks/AppKit.framework/Headers/NSGraphics.h:65: error: declaration for parameter 'NSFocusRingType' but no such parameter
/System/Library/Frameworks/AppKit.framework/Headers/NSGraphics.h:56: error: declaration for parameter 'NSFocusRingPlacement' but no such parameter
/System/Library/Frameworks/AppKit.framework/Headers/NSGraphics.h:48: error: declaration for parameter 'NSWindowOrderingMode' but no such parameter
/System/Library/Frameworks/AppKit.framework/Headers/NSGraphics.h:40: error: declaration for parameter 'NSBackingStoreType' but no such parameter
/System/Library/Frameworks/AppKit.framework/Headers/NSGraphics.h:32: error: declaration for parameter 'NSCompositingOperation' but no such parameter
/System/Library/Frameworks/Foundation.framework/Headers/NSTextCheckingResult.h:32: error: declaration for parameter 'NSTextCheckingTypes' but no such parameter
/System/Library/Frameworks/Foundation.framework/Headers/NSTextCheckingResult.h:25: error: declaration for parameter 'NSTextCheckingType' but no such parameter
/System/Library/Frameworks/Foundation.framework/Headers/NSScriptWhoseTests.h:24: error: declaration for parameter 'NSTestComparisonOperation' but no such parameter
/System/Library/Frameworks/Foundation.framework/Headers/NSScriptStandardSuiteCommands.h:19: error: declaration for parameter 'NSSaveOptions' but no such parameter
/System/Library/Frameworks/Foundation.framework/Headers/NSScriptObjectSpecifiers.h:45: error: declaration for parameter 'NSWhoseSubelementIdentifier' but no such parameter
/System/Library/Frameworks/Foundation.framework/Headers/NSScriptObjectSpecifiers.h:36: error: declaration for parameter 'NSRelativePosition' but no such parameter
/System/Library/Frameworks/Foundation.framework/Headers/NSScriptObjectSpecifiers.h:30: error: declaration for parameter 'NSInsertionPosition' but no such parameter


like 22700 errors... so this suggests that I'm missing some configuration on .pro for these frameworks?