Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined symbol "ftime" #411

Closed
yurivict opened this issue Aug 12, 2021 · 4 comments
Closed

Undefined symbol "ftime" #411

yurivict opened this issue Aug 12, 2021 · 4 comments

Comments

@yurivict
Copy link

import siconos.kernel as sk fails:

Traceback (most recent call last):
  File "x.py", line 2, in <module>
    import siconos.kernel as sk
  File "/usr/local/lib/python3.8/site-packages/siconos/kernel.py", line 14, in <module>
    from . import _kernel
ImportError: /usr/local/lib/libsiconos_externals.so.6: Undefined symbol "ftime"

On FreeBSD the function ftime is in -lcompat.

Additionally, you should probably link such that undefined symbols are discovered during link, not at run-time.

OS: FreeBSD 13

@xhub
Copy link
Member

xhub commented Aug 12, 2021

That will be fixed by using a more recent time function. All the code in externals is not ours but imported. Defining a macro will make the code use a more recent time function.

Agreed for the undefined symbols, we should look into this.

@yurivict
Copy link
Author

-DCLOCKTIME helped. But I also had to add -DCLOCKS_PER_SEC=128 because #include <time.h> is missing in externals/SOL/lumod-c/commonlib.c in case CLOCKTIME is defined.

@xhub
Copy link
Member

xhub commented Aug 12, 2021

This is the diff I proposed internally. I wish to have some feedback from Mac OS user before merging it.
Note that we have an internal private gitlab instance, this repository is essentially a mirror of it.

diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt
index b5b8f54be13861a16f40ed622aac2196dbc4450a..39e4f889922c1bb37460dbe26f2bdcb9a9fd9a7d 100644
--- a/externals/CMakeLists.txt
+++ b/externals/CMakeLists.txt
@@ -177,6 +177,8 @@ get_target_property(externals_COMPILE_FLAGS externals COMPILE_OPTIONS)
 list(REMOVE_ITEM externals_COMPILE_FLAGS -Wall)
 list(REMOVE_ITEM externals_COMPILE_FLAGS -Wunused-variable)
 set_target_properties(externals PROPERTIES COMPILE_OPTIONS "${externals_COMPILE_FLAGS}")
+# This is ugly, but helps with old lumod code (12.08.2021) --xhub
+target_compile_definitions(externals PRIVATE CLOCKTIME)
 target_compile_options(externals PRIVATE "-w")
 target_compile_options(externals PRIVATE "-Wno-unused-variable")
 target_compile_options(externals PRIVATE "-Wno-unused-parameter")
diff --git a/externals/SOL/lumod-c/commonlib.c b/externals/SOL/lumod-c/commonlib.c
index 9625897fe8b53ef013101bb4b3e2ffea1a4aace4..8c7b6672900f3929e72b96099f609003252902a8 100644
--- a/externals/SOL/lumod-c/commonlib.c
+++ b/externals/SOL/lumod-c/commonlib.c
@@ -1,4 +1,4 @@
-#ifdef INTEGERTIME
+#if defined(INTEGERTIME) || defined(CLOCKTIME)
 # include <time.h>
 #else
 # include <sys/timeb.h>

@fperignon
Copy link
Contributor

Hi,

your patch works fine for me on macosx

siconos-team pushed a commit that referenced this issue Aug 23, 2021
do not use old/deprecated time function

See merge request nonsmooth/siconos!19
@vacary vacary closed this as completed Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants