wpilibsuite / cscore

Camera access and streaming library (ARCHIVED, merged into allwpilib)
Other
24 stars 12 forks source link

Undefined references in gcc 6.3.0 (Failed to compile) #67

Closed smerkousdavid closed 7 years ago

smerkousdavid commented 7 years ago

Hello, I've successfully crossed compiled gcc 6.3.0 and its relative binutils, gdb and sysroot for the roborio (This version upgrade isn't necessary but I perceive it to be a greater issue). Everything works fine until I attempt to compile cscore (As being in conjunction with allwpilib). I get a undefined reference error (see below) to a function in HttpUtil.cpp. I was receiving the same error for a native build (Using gcc 6.2.0). I am curious to hear back from you guys. I don't know the code layout and am wondering if there is a version check define somewhere where the preprocessor removes those functions -- Or this could just an absurd single instanced error... :neutral_face:

:cscoreSourceZip
:build
:outputVersions
:arm:compileJava
Download http://first.wpi.edu/FRC/roborio/maven/development/org/opencv/opencv-ja
va/3.1.0/opencv-java-3.1.0.pom
Download http://first.wpi.edu/FRC/roborio/maven/development/org/opencv/opencv-ja
va/3.1.0/opencv-java-3.1.0.jar
Download https://repo1.maven.org/maven2/com/google/errorprone/error_prone_core/2
.0.9/error_prone_core-2.0.9.pom
Download https://repo1.maven.org/maven2/com/google/errorprone/error_prone_parent
/2.0.9/error_prone_parent-2.0.9.pom
Download https://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/7/oss-parent
-7.pom
Download https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annota
tion/2.0.9/error_prone_annotation-2.0.9.pom
Download https://repo1.maven.org/maven2/com/github/stephenc/jcip/jcip-annotation
s/1.0-1/jcip-annotations-1.0-1.pom
Download https://repo1.maven.org/maven2/org/pcollections/pcollections/2.1.2/pcol
lections-2.1.2.pom
Download https://repo1.maven.org/maven2/com/google/guava/guava/19.0/guava-19.0.p
om
Download https://repo1.maven.org/maven2/com/google/guava/guava-parent/19.0/guava
-parent-19.0.pom
Download https://repo1.maven.org/maven2/com/google/code/findbugs/jFormatString/3
.0.0/jFormatString-3.0.0.pom
Download https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.0/js
r305-3.0.0.pom
Download https://repo1.maven.org/maven2/org/checkerframework/dataflow/1.8.10/dat
aflow-1.8.10.pom
Download https://repo1.maven.org/maven2/com/google/errorprone/javac/1.9.0-dev-r2
973-2/javac-1.9.0-dev-r2973-2.pom
Download https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annota
tions/2.0.9/error_prone_annotations-2.0.9.pom
Download https://repo1.maven.org/maven2/org/checkerframework/javacutil/1.8.10/ja
vacutil-1.8.10.pom
Download https://repo1.maven.org/maven2/com/google/errorprone/error_prone_core/2
.0.9/error_prone_core-2.0.9.jar
Download https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annota
tion/2.0.9/error_prone_annotation-2.0.9.jar
Download https://repo1.maven.org/maven2/com/github/stephenc/jcip/jcip-annotation
s/1.0-1/jcip-annotations-1.0-1.jar
Download https://repo1.maven.org/maven2/org/pcollections/pcollections/2.1.2/pcol
lections-2.1.2.jar
Download https://repo1.maven.org/maven2/com/google/guava/guava/19.0/guava-19.0.j
ar
Download https://repo1.maven.org/maven2/com/google/code/findbugs/jFormatString/3
.0.0/jFormatString-3.0.0.jar
Download https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.0/js
r305-3.0.0.jar
Download https://repo1.maven.org/maven2/org/checkerframework/dataflow/1.8.10/dat
aflow-1.8.10.jar
Download https://repo1.maven.org/maven2/com/google/errorprone/javac/1.9.0-dev-r2
973-2/javac-1.9.0-dev-r2973-2.jar
Download https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annota
tions/2.0.9/error_prone_annotations-2.0.9.jar
Download https://repo1.maven.org/maven2/org/checkerframework/javacutil/1.8.10/ja
vacutil-1.8.10.jar
:arm:processResources UP-TO-DATE
:arm:classes
:arm:jniHeadersCscore
:downloadOpenCvHeaders
Download http://first.wpi.edu/FRC/roborio/maven/development/org/opencv/opencv-he
aders/3.1.0/opencv-headers-3.1.0.pom
Download http://first.wpi.edu/FRC/roborio/maven/development/org/opencv/opencv-he
aders/3.1.0/opencv-headers-3.1.0.jar
:arm:unzipOpenCvHeaders
:arm:downloadOpenCvJni_linux-arm
Download http://first.wpi.edu/FRC/roborio/maven/development/org/opencv/opencv-jn
i/3.1.0/opencv-jni-3.1.0.pom
Download http://first.wpi.edu/FRC/roborio/maven/development/org/opencv/opencv-jn
i/3.1.0/opencv-jni-3.1.0-linux-arm.jar
:arm:unzipOpenCvJni_linux-arm
:arm:downloadOpenCvNatives_linux-arm
Download http://first.wpi.edu/FRC/roborio/maven/development/org/opencv/opencv-na
tives/3.1.0/opencv-natives-3.1.0.pom
Download http://first.wpi.edu/FRC/roborio/maven/development/org/opencv/opencv-na
tives/3.1.0/opencv-natives-3.1.0-linux-arm.jar
:arm:unzipOpenCvNatives_linux-arm
:arm:downloadWpiUtil
Download http://first.wpi.edu/FRC/roborio/maven/development/edu/wpi/first/wpilib
/wpiutil/1.0.2-20170209040313-1-ge665632/wpiutil-1.0.2-20170209040313-1-ge665632
.pom
Download http://first.wpi.edu/FRC/roborio/maven/development/edu/wpi/first/wpilib
/wpiutil/1.0.2-20170209040313-1-ge665632/wpiutil-1.0.2-20170209040313-1-ge665632
-arm.zip
:arm:unzipWpiUtil
:arm:compileCscoreSharedLibraryCscoreCpp
:arm:linkCscoreSharedLibrary
:arm:cscoreSharedLibrary
:arm:assembleDependentsCscoreSharedLibrary
:arm:compileEnum_usbExecutableEnum_usbCpp
:arm:compileCscoreStaticLibraryCscoreCpp
:arm:createCscoreStaticLibrary
:arm:cscoreStaticLibrary
:arm:linkEnum_usbExecutable
C:\Users\USER\Desktop\cscore\cscore\arm\build\libs\cscore\static\libcscore.a(Ht
tpUtil.o): In function cs::HttpRequest::SetAuth(cs::HttpLocation const&):
C:\Users\USER\Desktop\cscore\cscore\src/HttpUtil.cpp:305: undefined reference t
o wpi::Base64Encode(llvm::StringRef, std::__cxx11::basic_string<char, std::char
_traits<char>, std::allocator<char> >*)
collect2.exe: error: ld returned 1 exit status

:arm:linkEnum_usbExecutable FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task :arm:linkEnum_usbExecutable.
> A build operation failed.
      Linker failed while linking enum_usb.

Regards, David Smerkous

ThadHouse commented 7 years ago

This happens because of the new string implementation in GCC 5 and above. The reason that error is happening is because it is attempting to get wpiutil from our server, which is built with GCC 4. The solution to this is to run a full publish build of ntcore, which will build wpiutil in a way that cscore can see it. cscore build should then work.

AJahueyM commented 7 years ago

Sorry, but I'm having the same issue. Could you please explain in greater detail how this could be solved?? Iḿ kind of new to all of this and I didn't understand completely how to fix this.

PeterJohnson commented 7 years ago

Clone the ntcore repository, run ./gradlew -PmakeDesktop publish on it, and then try building cscore.

PeterJohnson commented 7 years ago

Note you will likely run into issues linking with the NI libraries as well if you're targeting the roboRio. The NI libraries are built against the 4.X ABI.

AJahueyM commented 7 years ago

I'm just building it for native, but it still wont compile after doing the full publish build on ntcore.

See file:///home/alberto/Documents/cscore/native/build/tmp/linkEnum_usbExecutable/output.txt for all output for linkEnum_usbExecutable.
linking enum_usb failed.
/home/alberto/Documents/cscore/native/build/libs/cscore/static/libcscore.a(HttpUtil.o): In function `cs::HttpRequest::SetAuth(cs::HttpLocation const&)':
/home/alberto/Documents/cscore/src/HttpUtil.cpp:305: undefined reference to `wpi::Base64Encode(llvm::StringRef, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
collect2: error: ld returned 1 exit status

Finished linkEnum_usbExecutable, see full log file:///home/alberto/Documents/cscore/native/build/tmp/linkEnum_usbExecutable/output.txt.
AJahueyM commented 7 years ago

Nevermind, I cloned the cscore repository again and Gradlew managed to build it :D

PeterJohnson commented 7 years ago

We've migrated to all 5.x compilers (including the roborio) for 2018, so this should no longer be an issue.