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

Problems building #11

Open
et4te opened this issue Mar 12, 2017 · 6 comments
Open

Problems building #11

et4te opened this issue Mar 12, 2017 · 6 comments
Assignees
Labels

Comments

@et4te
Copy link

et4te commented Mar 12, 2017

After cloning and running ./install.sh and adding path to LD_LIBRARY_PATH, build attempt:

~/cpp/chaos$ g++ -std=c++11 main.cpp -I/usr/local/include/chaos/ -lchaos
/tmp/ccEHIRQi.o: In function `main':
main.cpp:(.text+0x2c): undefined reference to `chaos::engines::xorring64::push(unsigned long)'
main.cpp:(.text+0x42): undefined reference to `chaos::engines::xorring64::push(unsigned long)'
main.cpp:(.text+0x55): undefined reference to `chaos::engines::xorring64::pull()'
/tmp/ccEHIRQi.o: In function `chaos::machine<chaos::engines::xorring64>::reset()':
main.cpp:(.text._ZN5chaos7machineINS_7engines9xorring64EE5resetEv[_ZN5chaos7machineINS_7engines9xorring64EE5resetEv]+0x3c): undefined reference to `chaos::engines::xorring64::__reset()'
collect2: error: ld returned 1 exit status

Using the following code:

#include <iostream>
#include <chaos.h>

CHAOS_MACHINE_XORRING64 machine;

int main(void) {
  machine.set_space(100000);
  machine.push(0x8a5cd789635d2dff);    // add some data
  machine.push(0x284600e3f30e38c3);     // and other...
  while (true) putc_unlocked(machine.pull(), stdout);
}
@maciejczyzewski
Copy link
Owner

Could you paste/do:

  1. g++ --version; cmake --version and compare with https://travis-ci.org/maciejczyzewski/libchaos (working version). Try to update your cmake if possible.
  2. ls /usr/local/include/chaos/ (just check if it's correctly installed)
  3. replace #include <chaos.h> to:
#include <chaos/types.hh>
#include <chaos/macros.hh>
#include <chaos/seed.hh>
#include <chaos/machine.hh>
#include <chaos/engines/xorring.hh>

@et4te
Copy link
Author

et4te commented Mar 14, 2017

g++ (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

cmake version 3.5.2

With modified headers I still get the same error.

~/cpp/chaos$ ls /usr/local/include/chaos/
analysis.hh  engines  generators  machine.hh  macros.hh  prng.hh  seed.hh  truely.hh  types.hh
~/cpp/chaos$ export LD_LIBRARY_PATH=/usr/local/lib/
~/cpp/chaos$ g++ -std=c++11 main.cpp -I/usr/local/include/chaos/ -lchaos
/tmp/ccunREot.o: In function `main':
main.cpp:(.text+0x2c): undefined reference to `chaos::engines::xorring64::push(unsigned long)'
main.cpp:(.text+0x42): undefined reference to `chaos::engines::xorring64::push(unsigned long)'
main.cpp:(.text+0x55): undefined reference to `chaos::engines::xorring64::pull()'
/tmp/ccunREot.o: In function `chaos::machine<chaos::engines::xorring64>::reset()':
main.cpp:(.text._ZN5chaos7machineINS_7engines9xorring64EE5resetEv[_ZN5chaos7machineINS_7engines9xorring64EE5resetEv]+0x3c): undefined reference to `chaos::engines::xorring64::__reset()'
collect2: error: ld returned 1 exit status

@varqox
Copy link

varqox commented Dec 7, 2017

It is a linking error, you should specify the directory where libchaos library objects are installed. For example, if it is installed in /usr/local/lib the compilation flag is: -L/usr/local/lib/, so the whole command looks like it: g++ -std=c++11 main.cpp -I/usr/local/include/chaos/ -L/usr/local/lib/ -lchaos

@NTUNAKO
Copy link

NTUNAKO commented Sep 29, 2018

same problems here~~ I've tried all methods above but still get same error... I think the only different is:
I need to use sudo ./install.sh to install

Others such as path, comment and example are the same...
Is because I use sudo?? If yes, how can I install without sudo and without getting a permission denied error?? Or there are some other way to make it work??

Please help me... QAQ Thanks

@UInSomnia
Copy link

У меня такая же ошибка, компоновщик тела методов не находит
Ошибка и на моей машине и при сборке на сервере
ОС: KUbuntu самой новой версии
g++ version 13.2.0
cmake version 3.27.4
А эта библиотека подойдёт для генерации случайных значений в криптографических целях?

@UInSomnia
Copy link

Без sudo выдаёт ошибку доступа
С sudo установилось, но ошибка компоновщика, о чём выше идёт речь

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants