slibc package using with Ubuntu 14.10

My wish is to use strcpy_s function (and others) into a C program with Ubuntu 14.10.

These commands were executed:
dpkg -i libslibc_0.9.3_amd64.deb => no error message
dpkg -i libslibc-dev_0.9.3_amd64.deb => no error message

My C program es.c:

#include <string.h>

char buf[10];

int main(void)
{
strcpy_s(buf, sizeof(buf), “123”);

return 0 ;
}

I have these errors:

$ gcc -o es es.c -lslibc
/usr/lib/gcc/x86_64-linux-gnu/4.8/…/…/…/…/lib/libslibc.so: référence indéfinie vers « __libc_ptf_call_always »
/usr/lib/gcc/x86_64-linux-gnu/4.8/…/…/…/…/lib/libslibc.so: référence indéfinie vers « _pthread_cleanup_push_defer »
/usr/lib/gcc/x86_64-linux-gnu/4.8/…/…/…/…/lib/libslibc.so: référence indéfinie vers « _pthread_cleanup_pop_restore »
/usr/lib/gcc/x86_64-linux-gnu/4.8/…/…/…/…/lib/libslibc.so: référence indéfinie vers « PTFAVAIL »
collect2: error: ld returned 1 exit status
$

Any help ?

Thank you

Hello,

Is this all on Ubuntu?

As these are the openSUSE forums, what is the reason you ask here instead of on some Ubuntu forum?

On 2015-04-20, ricou12 <ricou12@no-mx.forums.microfocus.com> wrote:
> My wish is to use strcpy_s function (and others) into a C program with
> Ubuntu 14.10.

Three points:

  1. This is an openSUSE forum, not an Ubuntu forum. You should ask there rather than here.
  2. IIRC strcpy_s is a Microsoft invention for C++ only. Why talk about Ubuntu and C?
  3. GCC has no strcpy_s, but I believe Sourceforge’s Safe C has an implementation.

Looks like you need “gcc -pthread” at least.

Because when you start from:
Google Code Archive - Long-term storage for Google Code Project Hosting.
to download the two packages you are invited to go here (for all platforms):
Welcome - openSUSE Build Service

Cheers.

Thank you for your suggestion but:

$ gcc -o es es.c -lslibc -pthread
/usr/lib/gcc/x86_64-linux-gnu/4.8/…/…/…/…/lib/libslibc.so: référence indéfinie vers « __libc_ptf_call_always »
/usr/lib/gcc/x86_64-linux-gnu/4.8/…/…/…/…/lib/libslibc.so: référence indéfinie vers « PTFAVAIL »
collect2: error: ld returned 1 exit status
$

On 2015-04-20, arvidjaar <arvidjaar@no-mx.forums.microfocus.com> wrote:
> Looks like you need “gcc -pthread” at least.

Just wondered if strcpy_s is included in -std=gnu11 since IIRC it might be in an Appendix of the C11 spec, but perhaps
it’s not mandatory. I think slibc also includes C11-style bounds-checking functions with `_s’ suffices.

Because when you start from:
Google Code Archive - Long-term storage for Google Code Project Hosting.
to download the two packages you are invited to go here (for all platforms):
https://build.opensuse.org/package/r…ia:slibc/slibc

Cheers.

On 2015-04-20, ricou12 <ricou12@no-mx.forums.microfocus.com> wrote:
> Because when you start from:
> https://code.google.com/p/slibc/
> to download the two packages you are invited to go here (for all
> platforms):
> http://tinyurl.com/lao8h5p
>
> Cheers.
>
>post

On 2015-04-20, arvidjaar <arvidjaar@no-mx.forums.microfocus.com> wrote:
> Looks like you need “gcc -pthread” at least.

Just wondered if strcpy_s is included in -std=gnu11 since IIRC it might be in an Appendix of the C11 spec, but perhaps
it’s not mandatory.

I think slibc also includes C11-style bounds-checking functions with `_s’ suffices, but we can’t help you installing it
because you don’t use openSUSE. You’ll find openSUSE uses RPM packages whereas Ubuntu uses DEB packages - they are not
inter-compatible. If you can’t find a Ubuntu package, then you’ll have to install from source. For help how to do that,
you need to ask Ubuntu users.

It seems that you are trying to use packages made on the openSUSE Build service. But you did not post in that section.

I will move this there and this is CLOSED for the moment.

Moved from Programming/Scripting and open again.

  1. The strcpy_s function is included into in Annex K of the current C standard, a.k.a. C11
  2. Thank you: there is an implementation of strcpy_s in Sourceforge’s Safe C