[fpc-pascal] Issue with deploying linux application in /opt directory

Bernd prof7bit at gmail.com
Tue Sep 4 02:34:50 CEST 2012


2012/9/3 Krzysztof <dibo20 at wp.pl>:
> Hmm problem is that I'm trying deploy libQt4Pas with my application (I
> have run.sh script which do "export
> LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/myapp/lib" before running
> application) and I see that this library trying do something in /opt
> folder:
> open("/opt/myapp/lib/tls/x86_64/libpthread.so.0", O_RDONLY|O_CLOEXEC)
> = -1 ENOENT (No such file or directory)
> stat("/opt/myapp/lib/tls/x86_64", 0x7fff625d38f0) = -1 ENOENT (No such
> file or directory)
> open("/opt/myapp/lib/tls/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1
> ENOENT (No such file or directory)
> stat("/opt/myapp/lib/tls", 0x7fff625d38f0) = -1 ENOENT (No such file
> or directory)
> open("/opt/myapp/lib/x86_64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1
> ENOENT (No such file or directory)
> stat("/opt/myapp/lib/x86_64", 0x7fff625d38f0) = -1 ENOENT (No such
> file or directory)
> open("/opt/myapp/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT
> (No such file or directory)
> stat("/opt/myapp/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

This looks normal. Its searching for libpthread (probably because
cthreads is used) in this folder because you added the folder to the
library path. This is normal and it does only try to read, not write.
It will also search this lib in /usr/lib and will finally find it
there, so this does not look the cause of your problem. It must be
something else.

You said it cannot access the network. This has nothing to do with
folder permissions. Try to catch the possible errors in your code and
put some writeln() into the code to see what exactly is going on when
it is trying to make a network connection, maybe it does not even
reach that part of your code because something else is silently
failing and you your code is just ignoring the error. Try to catch all
possible errors and write some diagnostic information to the console.

Or maybe you are already trying to write a debug log file into the
application directory (not allowed!) and this is failing because of
permissions and due to some unlucky try/except an important part of
your code will never execute and makes it behave as if the error where
somewhere else? (Just a wild guess but I have made errors like this
before too)

try
  WriteToLog('will now connect');  // <--- this will raise exception
already here
  ConnectToTheServer();
  DoEvenMoreStuff();
except
  // nothing
end;

This would silently fail to connect but its not because of network
problems, its because something happened that you simply did not
expect to ever happen when writing the code.



More information about the fpc-pascal mailing list