GithubHelp home page GithubHelp logo

babelouest / orcania Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 12.0 905 KB

Potluck with different functions for different purposes that can be shared among C programs

Home Page: https://babelouest.github.io/orcania/

License: GNU Lesser General Public License v2.1

Makefile 6.78% C 78.33% CMake 13.64% Roff 1.01% Shell 0.25%

orcania's Introduction

What?

Main projects

Project Descripion License Last release
Glewlwyd Experimental Single Sign On server, OAuth2, Openid Connect, MFA GitHub GitHub release (latest by date)
Ulfius Web Framework in C GitHub GitHub release (latest by date)
Rhonabwy JWK, JWKS, JWS, JWE and JWT C library GitHub GitHub release (latest by date)
Iddawc OAuth2 and OIDC client library GitHub GitHub release (latest by date)
Hoel C Database abstraction library with json based language GitHub GitHub release (latest by date)
Taliesin Lightweight audio streaming server GitHub GitHub release (latest by date)
Angharad House automation system with a REST/Json interface GitHub GitHub release (latest by date)
Hutch Online password and secret locker GitHub GitHub release (latest by date)
Yder Logging library for C applications GitHub GitHub release (latest by date)
Orcania Potluck library GitHub GitHub release (latest by date)

Other projects

Project Descripion License
Taulas Arduino source files for Angharad system devices GitHub
Huddersfield Project packages builder and publisher GitHub

Why?

C combines the power and performance of assembly language with the flexibility and ease-of-use of assembly language.

Coding backend in C and front-end in HTML/Javascript is the true meaning of life.

Who?

Nicolas Mora

My GPG key: 8405 B02F CC28 EF97 44C8 F253 FE82 1394 40BD 22B9

avatar I don't look like that

Where?

Québec City, Canada

How?

(Debian || Ubuntu) && GNU && Geany

orcania's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

orcania's Issues

small fix for Windows

It fixes the building on mingw32/64:

From 2a06bfc7f4440cfc11164b5a22c1483f375f75ea Mon Sep 17 00:00:00 2001
From: silvioprog <[email protected]>
Date: Mon, 22 Jan 2018 19:22:27 -0300
Subject: [PATCH 1/1] [cmake] fix building on mingw32/64.

---
 CMakeLists.txt | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c72fa0..e3c3f9a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -111,20 +111,21 @@ if (BUILD_TESTING)
     include(FindCheck)
     find_package(Check)
     if (CHECK_FOUND)
-        include(FindSubunit)
-        find_package(Subunit REQUIRED)
+        if (NOT WIN32)
+            include(FindSubunit)
+            find_package(Subunit REQUIRED)
+        endif ()
 
         enable_testing()
 
         set(CMAKE_CTEST_COMMAND ctest -V)
 
         set(TST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test)
-        set(LIBS orcania ${LIBS} ${CHECK_LIBRARIES} ${SUBUNIT_LIBRARIES})
+        set(LIBS orcania ${LIBS} ${CHECK_LIBRARIES})
         if (NOT WIN32)
             find_package(Threads REQUIRED)
-            set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT})
+            set(LIBS ${LIBS} ${SUBUNIT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} m rt)
         endif ()
-        set(LIBS ${LIBS} m rt)
 
         set(TESTS
                 str_test
-- 
2.7.4

Building with U_DISABLE_JANSSON & make is failing

Looks like we getting redefining of U_DISABLE_JANSSON.

jc957059@stbirv-lnx-2:/local/users/jc957059/probes/ejtag/app/rest/orcania$ make JANSSONFLAG=-DU_DISABLE_JANSSON
cd ./src && make
make[1]: Entering directory '/local/users/jc957059/probes/ejtag/app/rest/orcania/src'
Config file ../include/orcania-cfg.h generated
gcc -c -fPIC -Wall -Werror -Wextra -I../include -D_REENTRANT -O3 -DU_DISABLE_JANSSON memory.c
In file included from ../include/orcania.h:30:0,
from memory.c:12:
../include/orcania-cfg.h:31:0: error: "U_DISABLE_JANSSON" redefined [-Werror]
#define U_DISABLE_JANSSON
^
:0:0: note: this is the location of the previous definition
cc1: all warnings being treated as errors
Makefile:60: recipe for target 'memory.o' failed

Build Orcania with CMake

Hi dudes.

I've tried to build Ulfius on Windows using MinGW-w64 for 32 and 64 bits, but I've got some difficult. First, I'm trying to compile its dependences, so Orcania was the first one. However, it doesn't have a building system, and all building are done by a make file only for Linux. After this fix I can generated the .so file on MinGW, so I just need to rename its extension to .dll and enjoy it. OK, we can add a "mv" in the current makefile and solve it, but now the question is: why not adopting a cross platform building system like CMake. Check some challenges:

  • On Linux, all user's includes are installed in "/usr/local/include", on MinGW in "C:\msys32\mingw32\include" for 32 bits and "C:\msys32\mingw64\include" for 64 bits;
  • On Linux, all user's shared and static libraries are installed in "/usr/local/lib", on MinGW in the static and shared libraries are installed in different directories, "*\mingw*\lib" (notice the asterisk are representing 32 and 64 respectively) for static and "*\mingw*\bin" for shared libraries, and both shared and static are installed by default on MinGW (Orcania's makefile just install the shared one);
  • On Linux, we have some tools like ldconfig, but it is not available on MinGW because it is not necessary on Windows;
  • On Linux, for a library called mynicelibrary, we have a file like libmynicelibrary.so.N.N.N, on Windows, it is called libmynicelibrary-V.dll (e.g: on Linux, libmicrohttpd.so.12.46.0, on Windows, libmicrohttpd-12.dll);
  • Using only makefile, the easiest way to use third party library is installing its shared version, but, o Windows, it is very common to see stand-alone libraries (eg: libsqlite.dll, ftd2xx.dll etc.) without depending to download its dependances (libgcc.dll, zlib.dll, libwinpthread.dll etc. etc. etc.), we just distribute only one DLL file (eg: libulfius-V.dll).

I think there are other things that I don't remember now, but these ones above already make difficult to build Ulfius, Orcania etc.

So, what to you think about using some building system like CMake? I know autotools, but it is very hard to do even simple things with that, the CMake is easier and present in many popular GNU libraries too (LibVNC, libjwt, libcurl etc.).

--
Silvio Clécio

compilation warning

orcania.c: In function ‘trimwhitespace’:
orcania.c:382:3: warning: implicit declaration of function ‘isspace’ [-Wimplicit-function-declaration]
while(isspace((unsigned char)*str)) str++;
^
gcc -shared -Wl,-soname,liborcania.so -o liborcania.so.0.8 orcania.o -lc -ljansson

I am getting this warning,
I was able to overcome this error by including ctype.h

cosmetic fix

Please update repo description from "... among c programs" to "... among C programs":


screenshot_2018-01-24_21-55-17

Can't compile orcania.c ( e47c7ba commit )

Hi,
very usefull project.
Following your guide, I was trying to compile the ulfius project after I downloaded the submodules.
( e47c7ba commit )

gcc gave me the following error:
orcania.c: In function ‘json_search’: orcania.c:234:5: warning: implicit declaration of function ‘json_array_foreach’ [-Wimplicit-function-declaration] orcania.c:234:49: error: expected ‘;’ before ‘{’ token
Any issue?

Thank you,
Diego

pkg-config file is broken when CMAKE_INSTALL_{INCLUDE,LIB}DIR is absolute

As per title: liborcania.pc.in has

prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@

and so can’t handle absolute paths in CMAKE_INSTALL_{INCLUDE,LIB}DIR. This leads to broken .pc files on NixOS in particular.

See “Concatenating paths when building pkg-config files” for a thorough discussion of the problem and a suggested fix, or KDE’s extra-cmake-modules for a simpler approach.

Error when building orcania in release mode using MinGW toolchain

When building orcania in Release mode, using the system MinGW toolchain of Fedora 36 (gcc 11.2.1),
the following error is shown:

$ CC=i686-w64-mingw32-gcc cmake -S . -B build-mingw32 -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_BUILD_TYPE=Release
$ cmake --build build-mingw32

The error message is:

[ 50%] Building C object CMakeFiles/orcania.dir/src/orcania.c.obj
In function 'o_strncpy',
    inlined from 'mstrcatf' at /home/maarten/programming/orcania/src/orcania.c:151:11:
/home/maarten/programming/orcania/src/orcania.c:254:12: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
  254 |     return strncpy(p1, p2, n);
      |            ^~~~~~~~~~~~~~~~~~
/home/maarten/programming/orcania/src/orcania.c: In function 'mstrcatf':
/home/maarten/programming/orcania/src/orcania.c:425:12: note: length computed here
  425 |     return strlen(s);
      |            ^~~~~~~~~
cc1: all warnings being treated as errors

What does orcania mean ?

At first I thought it was a mis-spelling of Ocarina the music instrument - @babelouest what does orcania mean - and why did you name this repository so ?

Build bugs

Hey! It's me who is about cross-compiling your libs for armv7l :)

New makefile deploys new build error:

make: *** No rule to make target 'liborcania.so', needed by 'all'. Stop.

How to reproduce:

  1. git clone
  2. git checkout v1.2.9
  3. make

Memory leaks / Free on address which was not malloc()-ed

Hello,

Please consider the following example:

int main() {
    char **arr;
    split_string("abc 123", " ", &arr);
    while (*arr) {
        printf("%s\n", *arr);
        arr++;
    }
    free_string_array(arr);
    return 0;
}

Fist test:

$ gcc -fsanitize=leak main.c -o test && ./test
abc
123

=================================================================
==11643==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x7f5bc00e0795 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/liblsan.so.0+0xc795)
    #1 0x7f5bbfd958d9 in __strdup (/lib/x86_64-linux-gnu/libc.so.6+0x8a8d9)

SUMMARY: LeakSanitizer: 4 byte(s) leaked in 1 allocation(s).

Second test:

$ gcc -fsanitize=address main.c -o test && ./test
abc
123
=================================================================
==11684==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x60300000eff0 in thread T0
    #0 0x7f9238f4e2ca in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x982ca)
    #1 0x400f0b in free_string_array (/home/me/test+0x400f0b)
    #2 0x401020 in main (/home/me/test+0x401020)
    #3 0x7f9238b0d82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #4 0x400a48 in _start (/home/me/test+0x400a48)

0x60300000eff0 is located 16 bytes inside of 24-byte region [0x60300000efe0,0x60300000eff8)
allocated by thread T0 here:
    #0 0x7f9238f4e961 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98961)
    #1 0x400d56 in split_string (/home/me/test+0x400d56)
    #2 0x400fab in main (/home/me/test+0x400fab)
    #3 0x7f9238b0d82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: bad-free ??:0 __interceptor_free
==11684==ABORTING

ssize_t is not available on MSVC

Building orcania 2.3.1 with Visual Studio fails because ssize_t is not known.

This line fails to compile:

ssize_t offset;

with the following error:

C:\Users\maarten\.conan\data\orcania\2.3.1\_\_\build\3fb49604f9c2f729b85ba3115852006824e72cab\src\src\
orcania.c(347,11): error C2065: 'ssize_t': undeclared identifier [C:\Users\maarten\.conan\data\orcania
\2.3.1\_\_\build\3fb49604f9c2f729b85ba3115852006

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.