i'm new in libgit2. and my problem is about git_remote_connect function, this problem has been confusing me for many days.
when i use git_remote_connect, it always return wrong, the message is:This transport isn't implemented. Sorry
The code is simply looks like:
git_remote *remote = NULL;
git_remote_load(remote, git_repo, remote_name);
// output the correctly result, just like run: git remote -v
g_message("remote user:", git_remote_name(remote)); // github-username
g_message("remote url:", git_remote_url(remote)); // git#github.com/github-username/Repo
if (git_remote_connect(remote, GIT_DIRECTION_FETCH) < 0) {
const git_error *e = giterr_last();
g_error("connect wrong!\n"
"message: %s",
e->message);
}
The protocol you're asking libgit2 to use was not included while compiling. Install the development package/headers for whatever package is needed and compile libgit2 again. The cmake output will tell you what was discovered; see the README for the libraries.
As an aside, git#github.com/github-username/Repo is a local path, which is always available, so it's unlikely that this is the URL which libgit2 is trying to use.
you should enable SSH in CMakeLists.txt
OPTION(USE_SSH "Link with libssh2 to enable SSH support" ON)
Related
I recently did a fresh install of CSFML and I am getting this errors when running my program:
object.Exception#source/app.d(38): Fatal error(s) encountered whilst calling `loadSFML()` function:
["Error: libcsfml-system.so, Message: libsfml-system.so.2.5: cannot open shared object file: No such file or directory",
"Error: libcsfml-system.so.2, Message: libcsfml-system.so.2: cannot open shared object file: No such file or directory",
"Error: libcsfml-system.so.2.0, Message: libcsfml-system.so.2.0: cannot open shared object file: No such file or directory"]
I am using SFML D bindings (https://github.com/BindBC/bindbc-sfml):
void loadDyn() {
if (!loadSFML()) {
string[] messages;
foreach (const(ErrorInfo) err; errors) {
string errorStr = to!string(err.error);
string messageStr = to!string(err.message);
messages ~= format("Error: %s, Message: %s", errorStr, messageStr);
}
throw new Exception(format("Fatal error(s) encountered whilst calling `loadSFML()` function: %s", messages));
}
}
void main() {
loadDyn();
sfRenderWindow* renderWindow = sfRenderWindow_create(sfVideoMode(500, 500), "Snake Smooth Dynamics", sfWindowStyle.sfDefaultStyle, null);
sfEvent event;
while (renderWindow.sfRenderWindow_isOpen()) {
while (renderWindow.sfRenderWindow_pollEvent(&event)) {
if (event.type == sfEventType.sfEvtClosed) {
renderWindow.sfRenderWindow_close();
}
}
renderWindow.sfRenderWindow_clear(sfYellow);
renderWindow.sfRenderWindow_drawSprite(snakeHeadSprite, null);
renderWindow.sfRenderWindow_display();
}
}
Things I've tried:
I found someone with a similar question: Linux SFML - Cannot Open Shared Object File, tried out some answers but to no avail
I tried to sudo apt purge every CSFML dependency (graphics, audo, etc) and reinstall each component (csfml-audio, csfml-graphics) manually etc, to no avail.
I tried to run sudo ldconfig... didn't work
As a last ditch effort I tried to manually move the shared object files to the /usr/local/lib directory (to try and perhaps trick the compiler to run the program?) but to no avail.
I tried to run on a new VM and still didn't work
I tried to set LD_LIBRARY_PATH environment variable
The amount of layers I depend on make it impossible to find where the bug is from, there are a lot of separate things going on and it's very multilayered, I don't know where the issue is specifically coming from as it used to work just fine I ran the exact same commands to install CSFML previously, now when I do it it just refuses to run.
The weird thing is when I ran a brand new virtual machine, installed those packages, still same issue.
I am running Linux Mint 21.1, Ubuntu based. Relatively new PC.
Goodday guys,
I am trying to build and run program in linux (raspberry) as a service.
It is a sample application that uses the Cerence SDK C API that implements a wake-up-word (WUW) plus command utterance recognition.
I can execute it by ./name.exe or using the Makefile commands.
The problem is that when I execute the program by console it works fine, without any problem.
When I try to execute it as a service (using both systemd or crontab and also rc.local), an error occours.
This is the function that gives me error:
printf("Selecting audio configuration %s\n", audioScenarioName);
rc = nuance_audio_IAudioManager_activateScenario(audioMgr, audioScenarioName);
if (NUANCE_COMMON_OK != rc) {
printf("Audio scenario activation failed: %d\n", rc); <-- returns 1 (error, impossible to activate scenario)
return rc;
}
ActivateScenario it's a function that simply selects the correct mic (audioScenarioName) following a JSON file and the audio manager (audioMgr).
Unfortunately this function returns 1 if something goes wrong, closes the program and nothing else.
This is the JSON:
"type": "AudioInput",
"name": "mic_input",
"adapter_type": "CUSTOM_AUDIO",
"adapter_params": {
"device_name": "default"
},
"audio_format": { "uses": "16khz_1ch" }
The service should be running as root permissions (default).
I also tried by setting the whole folder as chmod -R 777 as a test, but same problem.
This is my service:
[Unit]
Description=My Service
[Service]
Type=simple
ExecStart=+/home/pi/.../nameexec
Restart=on-failure
RestartSec=5
KillMode=process
[Install]
WantedBy=multi-user.target
I've also set the absolute path of its lib directory that it needs into the ld.so.conf file.
The only libraries I put in it are the .so ones, but not .h.
I am now trying to understand what might be different about starting the same executable but in different ways.
Could it be a permissions issue? Or is it not detecting the microphone? Any library out of place?
I really don't know why it works with the classic command and not as a service.
Can someone please help me with this?
Thank you in advance!
I succeeded!
The problem was the microphone being used.
Using Raspbian ver. Desktop, I set the mic from the bottom right part of the taskbar and changed the defaults in/out.
But these settings seem to be not system-wide and not used by the services in background (even though the "User=" is set to "pi").
So I had to change alsa.conf file:
sudo nano /usr/share/alsa/alsa.conf
Then find and edit these lines:
defaults.ctl.card cardnumber
defaults.pcm.card cardnumber
You can find the card number by running arecord -l.
I am trying to get Rsyslog's imfile plugin working without
any real success.
Here is useful OS version information:
# cat /etc/centos-release
CentOS Linux release 7.1.1503 (Core)
And here is Rsyslog version information:
# rsyslogd -v
rsyslogd 7.4.7, compiled with:
FEATURE_REGEXP: Yes
FEATURE_LARGEFILE: No
GSSAPI Kerberos 5 support: Yes
FEATURE_DEBUG (debug build, slow code): No
32bit Atomic operations supported: Yes
64bit Atomic operations supported: Yes
Runtime Instrumentation (slow code): No
uuid support: Yes
See http://www.rsyslog.com for more information.
I tried both legacy and RainerScript format of the configuration.
None of them works for me, sadly. I must be doing something completely wrong
but I simply can not decide on what it could be.
Here is my actual testing configuration (in RainerScript, the
former legacy version I tested was exactly the same in it's meaning):
# cat /etc/rsyslog.conf
global(
workDirectory = "/tmp"
)
module(
load = "imuxsock"
)
module(
load = "imjournal"
stateFile = "journal.state"
)
module(
load = "imfile"
pollingInterval = "10"
)
ruleset(name = "test-ruleset") {
if $syslogtag contains "test-syslogtag" then {
action(
type = "omfile"
file = "/tmp/test-file.log"
)
stop
}
}
input(
type = "imfile"
tag = "test-syslogtag"
stateFile = "test-input.state"
facility = "daemon"
severity = "debug"
file = "/tmp/test-input.in"
ruleset = "test-ruleset"
)
if prifilt("*.*") then {
action(
type = "omfile"
file = "/tmp/rsyslog-testing.log"
)
}
No warning nor error are produced by the Rsyslog with the above
configuration but also nothing from the /tmp/test-input.in file
is copied to the /tmp/test-file.log.
(I also double-checked the /var/log/audit/audit.log, of course, and ...
nothing suspicious is there. Being desperate on what's going on, I also
tried to setenforce 0 to switch SELinux off completely and to restart
the Rsyslog afterwards. It did not helped so the root cause of the problem
may not be SELinux-related issue.)
Also, the test-input.state file is correctly created in the global
workDirectory path (/tmp in this testing case). I also tried
standard paths (logs in /var/log, state file in /var/lib/rsyslog)
and it does not work either although all related files were created properly.
What's weird: I can not see any change in the state file if I populate the
input log file with some testing data even after Rsyslog restart using
# systemctl restart rsyslog (it should update the state file by default).
Just to point out: the imjournal and imuxsock plugins work and populate the fallback log file /tmp/rsyslog-testing.log correctly. Also
manually running Rsyslog on foreground with -D and/or -d options
did not helped me much to clarify why the imfile plugin does not work
for me in this particular configuration.
So, could you please
check my RainerScript syntax whether there is no obvious fault (I guess there is no such),
show me some working imfile plugin configuration on EL7?
Thank you very much.
--
mjf
With a few minor changes it finaly started to work properly. I think the
main root cause of the problem in my case must have been my testing it in
the /tmp directory where Rsyslog does not seem to work properly for some
reason on CentOS 7.
(May it be the /tmp is populated by the File System Namespace even
despite the fact that Systemd option PrivateTmp is not set to true in
the Rsyslog unit file and this option should be set to false by
default according to the Systemd manual page? This is higly unprobable, but
I haven't managed myself to dig more further into it yet. If I find it out,
I will update this answer.)
The other minor cause might have been incorrect filter written in
RainerScript (my real testing instance contained a horrible typo I
simply over-looked). So here is the resulting testing configuration that
works like charm for me.
# cat /etc/rsyslog.conf
global(
workDirectory = "/var/lib/rsyslog"
)
module(
load = "imuxsock"
)
module(
load = "imjournal"
stateFile = "journal.state"
)
module(
load = "imfile"
pollingInterval = "10"
)
ruleset(name = "test-ruleset") {
if $programname == "test-syslogtag" then {
action(
type = "omfile"
file = "/var/log/test-file.log"
)
stop
}
}
input(
type = "imfile"
tag = "test-syslogtag:"
stateFile = "test-input.state"
facility = "daemon"
severity = "debug"
file = "/var/log/test-input.in"
ruleset = "test-ruleset"
)
if prifilt("*.*") then {
action(
type = "omfile"
file = "/var/log/rsyslog-testing.log"
)
}
A little hint for those not knowing it - the $syslogtag and the
$programname seem to be close relatives: $syslogtag := $programname ":".
You can easily find out all the $ prefixed variables you can match against
by using RSYSLOG_DebugFormat output template which is already compiled in.
I hope it helps.
--
mjf
We are using libwebsockets 1.3 in our ssl enabled web socket client program written in c, we are compiling on Centos 6.5 with openssl 1.0.1 installed, making a .so library which is later used in asterisk. The compilation goes fine but I'm getting this runtime error:
problem creating ssl context 336236705: error:140A90A1:lib(20):func(169):reason(161)
Going through libwebsockets code I spotted the part that is generating the error message (lib/ssl.c line 90):
/* basic openssl init */
SSL_library_init();
OpenSSL_add_all_algorithms();
SSL_load_error_strings();
openssl_websocket_private_data_index =
SSL_get_ex_new_index(0, "libwebsockets", NULL, NULL, NULL);
/*
* Firefox insists on SSLv23 not SSLv3
* Konq disables SSLv2 by default now, SSLv23 works
*/
method = (SSL_METHOD *)SSLv23_server_method();
if (!method) {
error = ERR_get_error();
lwsl_err("problem creating ssl method %lu: %s\n",
error, ERR_error_string(error,
(char *)context->service_buffer));
return 1;
}
context->ssl_ctx = SSL_CTX_new(method); /* create context */
if (!context->ssl_ctx) {
error = ERR_get_error();
lwsl_err("problem creating ssl context %lu: %s\n",
error, ERR_error_string(error,
(char *)context->service_buffer));
return 1;
}
Which according to examples I've seen on the web looks absolutely fine, I've been scratching my head, searching and trying everything for the past couple of days including reinstalling different versions of openssl, changing the code above, replacing SSLv23_server_method with other methods, etc... but can't get it to work, does anybody know where the problem might be?
Additional informaiton:
Using ERR_print_errors_fp() I get:
3077879544:error:140A90A1:lib(20):func(169):reason(161):ssl_lib.c:1802:
part of our code that calls libwebsocket_create_context looks like this:
int opts = 0;
const char *interface = NULL;
int listen_port;
memset(&wsInfo, 0, sizeof wsInfo);
listen_port = CONTEXT_PORT_NO_LISTEN;
wsInfo.port = listen_port;
wsInfo.iface = interface;
wsInfo.protocols = protocols;
wsInfo.extensions = libwebsocket_get_internal_extensions();
wsInfo.gid = -1;
wsInfo.uid = -1;
wsInfo.options = opts;
wsContext = libwebsocket_create_context(&wsInfo);
The program is compiled into an .so library and the library is used in our modified version of asterisk (which itself uses openssl as far as I know).
problem creating ssl context 336236705: error:140A90A1:lib(20):func(169):reason(161)
This may have helped:
$ openssl errstr 0x140A90A1
error:140A90A1:SSL routines:SSL_CTX_new:library has no ciphers
"library has no ciphers" is a sure sign the library was not initialized. See OpenSSL's wiki page on intializing the library at Library Initialization.
Since Asterisk is doing really clever things, you should check what else its doing. In particular, you should ensure its not using weak/wounded/broken protocols and cipher suites. An example of how to improve a security posture can be found at SSL/TLS Client. The sample ensure TLS 1.0 and above, and uses "strong" cipher suites.
I got this error too by using a library that used the boost asio.
The lib was compiled against openssl-1.0, while my binary was compiled against openssl-1.1.
Switching my binary to also use openssl-1.0 solved the issue for me.
The problem is asterisk overrides all openssl initialization functions including SSL_library_init() and OpenSSL_add_all_algorithms() in main\libasteriskssl.c and replaces them with dummy functions that do nothing, instead it defines an ast_ssl_init() which does all the initializations and is called once in main() in main/asterisk.c, my code happened to be before that call.
Too long for a comment, but:
First things first, let's eliminate your code. In the libwebsockets distribution, in test/test-server.c there is a test server that works with SSL. Does that work? If so, I'm guessing it's something you are doing in your code (in which case we are going to need some of your code). If not, I'm guessing it's your distribution.
Next, let's make that error message a bit more informative. Can you introduce ERR_print_errors_fp() to print SSL errors to stderr or similar, and tell us what it says?
I've taken xinimin.c and added seek and osd functionality. The last big piece that I need to implement is deinterlacing, however, I'm finding very little documentation. I've been through the hacker's guide and of course I haved googled and googled. I found the deprecated method:
xine_set_param(stream, XINE_PARAM_VO_DEINTERLACE, 1);
which did not work. I saw that the current method involves post plugins, but my /usr/include/xine/post.h doesn't have the word deinterlace in it.
Can anyone provide an example of how to implement deinterlacing. It would be nice to have the flexibility down the road to change the deinterlacer, but something equivalent to the -D option on the command line is what I'm looking for to start with.
Is there a good resource for example source files?
Is this what you are looking for? src/post/deinterlace directory:
(4 links to pretty much the same:)
debian.org/hg/xine-lib
github || huceke/xine-lib-vaapi/tree/master/src/post/deinterlace
fossies dox ** xine-lib 1.2.1, deinterlace.h File Reference
xine_plugin.c File Reference
From hackersguide - Walking the source tree:
post
Video and audio post effect plugins live here. Post plugins
modify streams of video frames or audio buffers as they leave
the decoder to provide conversion or effects.
deinterlace (imported)
The tvtime deinterlacer as a xine video filter post.
hackersguide, Plugin system
Edit:
I have only installed libxine, not anything else.
It is however a good idea to download the source as the project in large part is documented in the code. If you use i.e. Vim it is nice to use it with cscope and/or ctags. (As show in this tutorial.). Then you can jump to functions, definitions, callers, ... (across files etc), simply by a couple of key strokes. (They map where every function is defined, called, etc.)
When compiling, if on linux at least, I have to add the lib's at end (after source file):
gcc -Wall -Wextra -pedantic -std=c89 -o muxine muxine.c -lX11 -lxine
Perhaps this'll get you further on the way: Using sample code, muxine.c,:
And reading source documentation, (mainly here): xine.h
I added in main:
const char* const *tmp;
xine_post_t *post_x;
xine_post_api_t *post_api;
xine_post_in_t *input_api;
xine_post_api_descr_t *param;
const char *post_plug_t = "tvtime";
/*const char *post_plug_d = "deinterlace"; perhaps this?? */
After the existing sample code:
ao_port = xine_open_audio_driver(xine , ao_driver, NULL);
stream = xine_stream_new(xine, ao_port, vo_port);
I added
/* get a list of all available post plugins */
if((tmp = xine_list_post_plugins(xine)) == NULL) {
fprintf(stderr, "Unable to get post plugins\n");
xine_exit(xine);
return 1;
}
printf("Post plugins:\n");
while (*tmp != NULL)
printf(" %s\n", *tmp++);
/* initialize a post plugin */
if ((post_x = xine_post_init(xine, post_plug_t, 1,
&ao_port, &vo_port)) == NULL) {
fprintf(stderr, " *ERR: Unable to 'post init' %s;\n",
post_plug_t);
xine_exit(xine);
return 1;
}
/* get a list of all outputs of a post plugin */
tmp = xine_post_list_outputs(post_x);
printf("Post List Outputs:\n");
while (*tmp != NULL)
printf(" %s\n", *tmp++);
! I get at least tvtime. Believe that is the deinterlacing plugin. (Sounds like it when reading the src/post/... comments.
One have the struct xine_post_api_t whic in turn has set_parameters(), that can be used to control the plugin (from the looks of it).