-
Notifications
You must be signed in to change notification settings - Fork 544
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
cpu-miner.c:(.text+0x8cf8): undefined reference to `set_incl' #420
Comments
This is typically a missing package. Review the build procedure and following it, make note of any deviations. Also provide your CPU model, OS, GCC version and any other relevant details. |
I could pass over the missing definition of 'set_incl' by changing the function declaration to be static. Below the gcc available:
CPU info:
Update, using the static, also worked for the declared function 'exp_n' at file algo/m7m/m7m.c. Need to change function reverse and tt10_swap at file algo/x11/timetravel10-gate.c Now compilation worked fine. |
It was never a problem before, even when GCC-6 was new. They all seem to be inline functions that aren't static. I have no idea why this matters. Edit: Some speculation Edit: these inline functions are not static but did not error: |
No, I just downloaded current's versions of automake, autoconf, m4, and libtool and compiled those dependencies, using the generate make, in my home folder. Then, I could execute the configure generation. During the configure execution, it did not detect several things and compilation stopped on some errors that I could figure out by error messages. So, I grabbed a current curl and compiled it in my home folder too. So it could find curl/curl.h After editing those files to add "static", the make finished the build process with success. I been long time without using GCC. I imagined this be some changes in C dialects. I know gcc has some switches to change that. That is why I asked help. |
What do you mean no? That's WAY off script! |
I mean that I followed your build procedure, as possible, as described at INSTALL_LINUX. Then I started building all dependencies required to make build.sh execute. |
My best guess is there's something in your custom environment causing the error. As I previously mentioned there seems to be confusion between the compiler (inlining the function code) and the linker (linking a discrete function via a pointer). It seems the linker was looking for a function pointer but the compiler never created one because all instances of the function were inlined. A static function doesn't have linkage so the linker doesn't look for it. I haven't found any documentation recommending inlined functions be static or that there may be problems if not static. You have found a workaround for your environment and this workaround happens to be how most inline functions in cpuminer are defined. I'll make the changes to make them consistent. |
But in the case of gcc, does not it make the two things at the same run, compile and link? #ifdef GNU_COMPILER I do not know if there is some m4 macro for this kind of thing. |
I am not a GCC expert so this is based on general compiler theory. Edit: My technical description above was a little off, it applies only to compiling source code, not header declarations. Header files are inlcuded in each caller's source file at compile time, there is no .o generated from a .h. I kinda like the idea of defining all inline functions static in a .h. It guarantees they will be inlined because there's no other way than to have the source code in the included .h. Otherwise the compiler may choose not to inline for whatever reason. |
Why are you using g++ to compile this, it's C code? The meaning of |
If you are using |
Good point you noted about .c files been compiled with GCC but the linker used g++!!!
Yes, it was gcc. Note that all this make process has been built by the configure and tools. And the error:
But going into file algo/m7m/m7m.c and just putting static before inline, at function declaration, all works fine. |
So then it's probably this ^^ That link explains how to make code written using gnu-inline semantics (the default in GCC 4.x) valid for C99 inline semantics (the default in GCC 5 and later). |
I added the "extern" decoration before unit name, at the .c source file and it also compiled without problems. |
That's a good question. The only c++ code is magimath.cpp. It isn't used anywhere but if the file is deleted the compile will fail. The file can be empty, it can be renamed, but a .cpp file must be present. It seems it triggers something that affects the build.
|
If you're linking a mix of C and C++ then using |
I've had no problems going back to gcc-4.8 so it doesn't seem to be related to the gcc version unless the said change was backported. I know it won't compile on Centos-6 (gcc-4.4) for various reasons but this appears to be gcc-6. This is the only case I'm aware of and it happens to be a custom build environment. Something in that environment creates the unique situation where the linker is looking for a linkable function that should alwas be inlined. I'm somewhat curious of the root cause but I'm satisfied with adding static to the inlines |
@sumariva is using If that overrides the default CFLAGS and replaces any optimization options like Presumably compiling without optimizations makes a miner incredibly slow, and wastes even more power than normal shitcoin mining. |
Humm, I did noted that CFLAGS would override all stuff. I will try update the build process and add -O3. UPDATE, I runned configure with the following, and code compiled without linker errors: Should I add -O3, max optimizations? |
Unoptimized is not supported, -O3 is recommended but -O2 also works but with a noticble loss in performance. I'll make the code changes anyway for consistency with other inline definitions. Maybe you should add CFLAGS to CPPFLAGS instead of overwriting it. |
How the right way to augment CFLAGS? I just followed tips from configure
I am trying to help configure find libraries, to to force C flags. |
The |
I got how to get rid off magimath.cpp. Hope get code better! |
Awesome! So linking with g++ instead of gcc is not about c++ but linking math. Thanks. |
Brain fart, I meant CXXFLAGS but that was wrong too because the problem wasn't due to using g++ for linking.
|
Removing the magimath hack worked on Linux but on Windows it segfaulted in sha256 code that was unchanged from the previous version. Something weird there that requires a deep dive. As a result I'm pulling this change from the next release. |
Where this sha256 is located, I may try look at it. Used the mingw64 gnu? |
It's located in algo/sha/sha256-hash.h which uses some trickery to call the correct targets. The crash I observerd was when calling sha256_ctx_init from scanhash_yespower. The CPU did not have SHA so the target was sph_sha256_init. I haven't done any further digging. Coincidentally sha256 is also used to generate the merkl root hash for all algos but that didn't seem to crash, it was only when called by yespower. The failed test used gcc-13.2 in case it's a compiler version issue. Edit: I apppreciate your interest in this, I hope to learn something from it. My coding background is not GNU/Linux/x86/C based. Edit: Power2b also crashes, it's the same as yespower but replaces sha256 with blake2b. |
v24.1 is released with a fix to the title issue. Regarding the gcc vs g++ linker issue, I don't have any leads. Perhaps it was the way I did the linkage, adding it to the same Makefile.am command that adds gmp linking, but it's just a wild guess. If you're still interested then this issue can remain open. I'm curious but stumped. |
Hello, I trying to compile cpuminer-opt version 23.15, lateste, at date March, 28, 2014.
I made adjustments on configure to give proper directories and linker files as process failed during build.
I finally could reach the last step, but got stop on linker faults.
The output of GCC is below. Those all looks like related to internal source code, not dependencies:
Any hints?
The text was updated successfully, but these errors were encountered: