Skip to content

Instantly share code, notes, and snippets.

void
_wrap_add_torrent_params_name_get(void *swig_v)
{
libtorrent::add_torrent_params *arg1 = (libtorrent::add_torrent_params *) 0 ;
std::string *result = 0 ;
struct swigargs {
libtorrent::add_torrent_params *arg1;
long : 0;
_gostring_ result;
@steeve
steeve / _readme.md
Last active March 25, 2025 07:32
How to cross compile Go with CGO programs for a different OS/Arch

How to cross compile Go with CGO programs for a different OS/Arch

It is possible to compile Go programs for a different OS, even though go build says otherwise.

You'll need:

@steeve
steeve / config.txt
Last active December 26, 2015 03:38
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue ([email protected])
# Inspired and partly copied from:
# http://youresuchageek.blogspot.fr/2012/09/howto-raspberry-pi-openelec-on.html
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
@steeve
steeve / overclock.sh
Last active December 26, 2015 03:39
OpenELEC resize to SD card
cd /
touch /var/lock/xbmc.disabled
killall -9 xbmc.bin
fuser -m /storage | xargs kill -9; umount /storage
parted /dev/mmcblk0
unit s
rm 2
mkpart primary 258048 -1
quit
e2fsck -f /dev/mmcblk0p2 && resize2fs /dev/mmcblk0p2 && mount /dev/mmcblk0p2 /storage
#include <windows.h>
#include <assert.h>
#ifdef __cplusplus
extern "C" {
#endif
void (*crosscall2)(void (*fn)(void *, int), void *, int);
void (*_cgo_allocate)(void *, int);
void (*_cgo_panic)(void *, int);
#ifdef __cplusplus
$ arm-linux-androideabi-g++ test.cpp -ltorrent-rasterbar -L/usr/local/gcc-4.8.0-arm-linux-androideabi/lib -I/usr/local/gcc-4.8.0-arm-linux-androideabi/include -DTORRENT_USE_OPENSSL -DWITH_SHIPPED_GEOIP_H -DBOOST_ASIO_HASH_MAP_BUCKETS=1021 -DBOOST_EXCEPTION_DISABLE -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_DYN_LINK -DTORRENT_LINKING_SHARED
fatal error: runtime: stack split during syscall
runtime stack:
runtime.throw(0x6a8934)
/usr/local/go/src/pkg/runtime/panic.c:464 +0x5c
runtime.newstack()
/usr/local/go/src/pkg/runtime/stack.c:261 +0x5bc
runtime.morestack()
/usr/local/go/src/pkg/runtime/asm_arm.s:212 +0x44
$ make clean all TARGET_OS=android ARCH=arm CROSS_PREFIX=arm-linux-androideabi CROSS_HOME=/usr/local/gcc-4.8.0-arm-linux-androideabi
rm -rf build/android_arm build/android_arm/obj/libtorrent_wrap.o build/android_arm/obj/libtorrent_wrap.cxx libtorrent_gc.c libtorrent.go *.so
mkdir -p build/android_arm
mkdir -p build/android_arm/obj
mkdir -p build/android_arm/bin
swig -go -c++ -soname libtorrent-go.so -intgosize 32 -I/usr/local/gcc-4.8.0-arm-linux-androideabi/include -I/usr/local/gcc-4.8.0-arm-linux-androideabi/arm-linux-androideabi/include -DTORRENT_USE_OPENSSL -DWITH_SHIPPED_GEOIP_H -DBOOST_ASIO_HASH_MAP_BUCKETS=1021 -DBOOST_EXCEPTION_DISABLE -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_DYN_LINK -I/usr/local/gcc-4.8.0-arm-linux-androideabi
sed -i '' 's/} \*swig_a/} __attribute__((__packed__)) \*swig_a/g' build/android_arm/obj/libtorrent_wrap.cxx
sed -i '' 's/} a/} __attribute__((__packed__)) a/g' build/android_arm/obj/libtorrent_wrap.cxx
~/p/g/s/g/s/t/build git:master ❯❯❯ ls -la
total 0
drwxr-xr-x 8 steeve staff 272 2 déc 20:27 .
drwxr-xr-x 16 steeve staff 544 2 déc 20:01 ..
drwxr-xr-x 3 steeve staff 102 2 déc 18:07 android_arm
drwxr-xr-x 5 steeve staff 170 2 déc 18:06 darwin_x64
drwxr-xr-x 3 steeve staff 102 2 déc 20:24 linux_arm
drwxr-xr-x 3 steeve staff 102 2 déc 14:14 linux_x64
drwxr-xr-x 3 steeve staff 102 2 déc 20:28 linux_x86
drwxr-xr-x 4 steeve staff 136 2 déc 14:04 windows_x86
11001101 10011110 01111001 01111101 11111111 11111100 10100100 01111110 Metro Sens 1
10011111 10001001 01001111 11111111 11101111 10100111 10011110 01101100 Metro Sens 2
10111111 10011110 01111111 10011111 11111111 11111100 11111111 11111110 RER Sens 1
10011111 11111111 11001111 11111111 11111110 01111111 10011110 01111111 01011111 RER Sens 2
10111111 10011110 01111111 10011111 11111111 11111100 11111111 11111110 RER Sens 1
10011111 11111111 11001111 11111111 11111110 01111111 10011110 01111111 01011111 RER Sens 2