
Hi Aycan.. Indeed I was able to use patchelf, so I don't need the
LD_PRELOAD trick anymore either. Thanks for the pointer..
As a side note: While I'm impressed with the level of trickery available to
inject/remove/change arbitrary functionality to binaries, I'm also
surprised to see how easy it would be to insert Trojan-horses on the fly
using these mechanisms as well. With "Trusted Haskell" brand, it almost
begs the question if GHC should do a "self-check" to make sure it's binary
hasn't been mocked up in this way. That would make my life harder of
course, but food for thought.
-Levent.
On Mon, Aug 31, 2015 at 2:44 AM, Aycan iRiCAN
I'm happy to see it worked. If you want to get rid of LD_PRELOAD, you may use patchelf to modify your binary to inject your fakelib. See 'add-needed' parameter here:
https://github.com/NixOS/patchelf/blob/master/README
On Mon, 31 Aug 2015 01:50 Levent Erkok
wrote: Thanks Aycan. The LD_PRELOAD solution did indeed work. I didn't know about that facility before, so I'm pleasantly surprised.
One gotcha though: I had to add the "fake-library" into the runtime as well; with a command that looked like this:
ar q libHsrts_thr.a ghcFakeLib.o
where the libHsrts_thr.a comes from the binary distro, and the ghcFakeLib.o is the object file I got by defining those pthread_setname_np and pthread_getname_np. (They do nothing but return 0.)
Thanks,
-Levent.
On Sun, Aug 30, 2015 at 12:37 AM, Aycan İrican
wrote: Hi Levent,
For a quick fix, you may want to create a wrapper script which uses LD_PRELOAD to inject `set_threadname_np` to your runtime. An example is given in this blog page:
http://hackerboss.com/overriding-system-functions-for-fun-and-profit/
-aycan
On 30 Aug 2015, at 03:02, Levent Erkok
wrote: I really like the idea of nix. Alas, generating native binaries that can run on SuSE without being in the nix environment is a requirement that's hard to let go. (Everyone in my group would have to start using nix, a tall order.)
Thanks for the advice however, it can indeed come handy for one-off trials if needed. In the meantime, I'm still looking for a binary-linux-distro that doesn't require the set_threadname_np functionality, if anyone can point me in that direction.
Thanks,
-Levent.
On Sat, Aug 29, 2015 at 3:23 PM, Kosyrev Serge < _deepfire@feelingofgreen.ru> wrote:
Levent Erkok
writes: Hello all,
I've been having a lot of trouble installing the binary-distro's on a SuSE machine. Unfortunately, I don't have root privileges and thus my options are rather limited.
The problem seem to boil down to the use of the function pthread_setname_np. It appears the problem was noted before, and Simon Marlow added a corresponding configure check for platforms that do not have this function. See here: https://mail.haskell.org/pipermail/ghc-devs/2014-October/006707.html
Alas, none of the binary distributions listed on https://www.haskell.org/ghc/download_ghc_7_10_2#binaries seem to be built against a system that does not have this function. So, I was unable to install 7.10.2 successfully.
Essentially, I'm looking for a binary distro on SuSE, or with a libc that doesn't have the GNU extensions such as pthread_setname_np; if anyone would be kind enough to put out such a binary distro, that'd really be appreciated.
(Yes, I tried building from the source; but in the corporate environment with so many things controlled, that did not go very far.)
You could try the Nix route, which, conceptually, would boil down to:
1. Installing the Nix package manager into your $HOME on the SuSE system 2. Use Nix to install GHC
Which expands to:
1. Following the instructions at:
https://nixos.org/wiki/How_to_install_nix_in_home_%28on_another_distribution...
2. Invoking:
nix-env -iA haskellPackages.ghc
This would require only HTTP access, which, I presume, should be available within the corporate environment.
All the packages from Hackage can be had precompiled from Nixpkgs, but that's slightly more involved and requires some reading:
http://nixos.org/nixpkgs/manual/#users-guide-to-the-haskell-infrastructure
Should you meet trouble, you can always seek help either at nix-dev@lists.science.uu.nl, or on the #nixos/irc.freenode.net IRC channel -- both have a vibrant nightlife^W Haskell community.
-- с уважениeм / respectfully, Косырев Серёга -- “And those who were seen dancing were thought to be insane by those who could not hear the music.” – Friedrich Wilhelm Nietzsche
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs